alfresco-ng2-components/docs/core/services/jwt-helper.service.md
Maurizio Vitale 28a47e83d2
Fetch the userInfo once loggedIn and expose the capability of admin (#7682)
* Fetch the userInfo once loggedIn and expose the cabilibility of admin

* Rollback method

* Return same use if defined

* Use the same pepleContent service for UserInfoCOmpnent

* Remove useless import

* Use interface

* Use angular resolver instead of guard

* Remove fdescribe

* Fix linting

* Regenerate doc

* Improve doc

* Fix optional

* Fix the unit test

* Fix comment

* Fix lint

* Fix unit

* Add fetch user as part of the ssoGuard

* Fix unit test after fetch

* Add additional unit

* Fix await
2022-06-27 12:02:01 +01:00

3.0 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
JWT helper service v3.0.0 Active 2019-01-09

JWT helper service

Decodes a JSON Web Token (JWT) to a JavaScript object.

Class members

Methods

  • decodeToken(token: any): any
    Decodes a JSON web token into a JS object.
    • token: any - Token in encoded form
    • Returns any - Decoded token data object
  • getAccessToken(): string
    Gets access token
    • Returns string - access token
  • getClientRoles(clientName: string): string[]
    Gets Client roles.
    • clientName: string -
    • Returns string[] - Array of client roles
  • getIdToken(): string
    Gets id token
    • Returns string - id token
  • getRealmRoles(): string[]
    Gets realm roles.
    • Returns string[] - Array of realm roles
  • getValueFromLocalAccessToken(key: string)
    Gets a named value from the user access token.
    • key: string - Key name of the field to retrieve
  • getValueFromLocalIdToken(key: string)
    Gets a named value from the user id token.
    • key: string - Key name of the field to retrieve
  • getValueFromLocalToken(key: string)
    Gets a named value from the user access or id token.
    • key: string - Key name of the field to retrieve
  • getValueFromToken(token: string, key: string)
    Gets a named value from the user access token.
    • token: string -
    • key: string - Key name of the field to retrieve
  • hasClientRole(clientName: string, role: string): boolean
    Checks for client role.
    • clientName: string - Targeted client name
    • role: string - Role name to check
    • Returns boolean - True if it contains given role, false otherwise
  • hasRealmRole(role: string): boolean
    Checks for single realm role.
    • role: string - Role name to check
    • Returns boolean - True if it contains given role, false otherwise
  • hasRealmRoles(rolesToCheck: string[]): boolean
    Checks for realm roles.
    • rolesToCheck: string[] - List of role names to check
    • Returns boolean - True if it contains at least one of the given roles, false otherwise
  • hasRealmRolesForClientRole(clientName: string, rolesToCheck: string[]): boolean
    Checks for client roles.
    • clientName: string - Targeted client name
    • rolesToCheck: string[] - List of role names to check
    • Returns boolean - True if it contains at least one of the given roles, false otherwise

Details

JWT is a standard for sending data securely that ADF uses during the OAuth2 authentication procedure. See the JWT website for full details of the standard and its uses.

See also