@chapeaux/cpx-state
v0.4.0
Published
Chapeaux State Management Component
Downloads
6
Readme
= Chapeaux User Component
== Events
user-ready- fires when the.userobject data is populateduser-update- fires when the.userobject is updated
== Usage
User data is always stored on the .user property once it is
available.
=== Server-side or on-page
.Server-side Data inclusion example [source,html]
=== JSON Web Token
Requires that jwt_decode library be available globally.
Available component properties:
jwt-cookie: sets the cookie to parse for JWT datajwt-token: sets the JWT token to parse for data
.JWT Cookie [source,html]
.JWT Token [source,html]
=== Keycloak
Requires keycloak.js to be available, and the following attributes to
be set with the appropriate values:
kc-url- the Keycloak server urlkc-realm- the Keycloak realmkc-client-id- the Keycloak client ID
Available component methods:
login(): log in using the Keycloak configlogout(): log out using the Keycloak configregister(): send user to registration screen based on Keycloak configaccount(): send user to account management screen based on Keycloak configtoken.createLoginUrl(): creates URL to direct user to login screentoken.createLogoutUrl(): creates URL to log user out
Available component properties:
token: the Keycloak object for authenticated users
.Keycloak [source,html]
=== Scripts
