Skip to content

Commit 6c14a51

Browse files
authored
Merge pull request #484 from sumesh-aot/release/7.0.1
Update to use roles attribute from the token and not from resource_access
2 parents abbde59 + 92b7bb4 commit 6c14a51

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

forms-flow-service/src/keycloak/KeycloakService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ import Keycloak, {
117117
.then((authenticated) => {
118118
if (authenticated) {
119119
console.log("Authenticated");
120-
if (!!this.kc?.resourceAccess) {
121-
const UserRoles = this.kc?.resourceAccess[this.kc.clientId!]?.roles;
120+
const tokenParsed = this.kc.tokenParsed || {};
121+
const UserRoles = tokenParsed.roles || tokenParsed.role || tokenParsed.client_roles || [];
122+
if (UserRoles.length > 0) {
122123
if(!UserRoles){
123124
callback(false);
124125
}

0 commit comments

Comments
 (0)