Retrieve jwt user info from id token (#7424)

Co-authored-by: Nelson Silva <nsilva@nuxeo.com>
This commit is contained in:
Eugenio Romano
2021-12-14 10:44:19 +01:00
committed by GitHub
parent ddcd97ca37
commit 1cbee53cdb
3 changed files with 48 additions and 10 deletions

View File

@@ -49,10 +49,10 @@ export class IdentityUserService implements IdentityUserServiceInterface {
* @returns The user's details
*/
getCurrentUserInfo(): IdentityUserModel {
const familyName = this.jwtHelperService.getValueFromLocalAccessToken<string>(JwtHelperService.FAMILY_NAME);
const givenName = this.jwtHelperService.getValueFromLocalAccessToken<string>(JwtHelperService.GIVEN_NAME);
const email = this.jwtHelperService.getValueFromLocalAccessToken<string>(JwtHelperService.USER_EMAIL);
const username = this.jwtHelperService.getValueFromLocalAccessToken<string>(JwtHelperService.USER_PREFERRED_USERNAME);
const familyName = this.jwtHelperService.getValueFromLocalToken<string>(JwtHelperService.FAMILY_NAME);
const givenName = this.jwtHelperService.getValueFromLocalToken<string>(JwtHelperService.GIVEN_NAME);
const email = this.jwtHelperService.getValueFromLocalToken<string>(JwtHelperService.USER_EMAIL);
const username = this.jwtHelperService.getValueFromLocalToken<string>(JwtHelperService.USER_PREFERRED_USERNAME);
return { firstName: givenName, lastName: familyName, email: email, username: username };
}