From 144df2e8e22ce1fd0438e749d2e0915eacdbf12c Mon Sep 17 00:00:00 2001 From: Oguzcan Kirmemis Date: Fri, 17 Sep 2021 00:46:22 +0300 Subject: [PATCH] Fix bug: Keycloak producing tokens for Non-OISP clients with incorrect expire date closes #476 Signed-off-by: Oguzcan Kirmemis --- .../oisp-js-policies/src/main/resources/type-mapper.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/docker/keycloak/oisp-js-policies/src/main/resources/type-mapper.js b/docker/keycloak/oisp-js-policies/src/main/resources/type-mapper.js index 8466e980..82d8981a 100644 --- a/docker/keycloak/oisp-js-policies/src/main/resources/type-mapper.js +++ b/docker/keycloak/oisp-js-policies/src/main/resources/type-mapper.js @@ -47,14 +47,7 @@ if (expire.length > 0) { expire = parseInt(expire[0]); token.expiration(currentTimeInSeconds + expire); } else { - var ArrayList = Java.type("java.util.ArrayList"); - var roles = new ArrayList(); - var client = keycloakSession.getContext().getClient(); - var forEach = Array.prototype.forEach; - forEach.call(user.getClientRoleMappings(client).toArray(), function(roleModel) { - roles.add(roleModel.getName()); - }); - if (roles.contains('user') && accessType === USER) { + if (accessType === USER) { token.expiration(currentTimeInSeconds + USER_EXPIRE * 60); } else { token.expiration(currentTimeInSeconds + DEFAULT_EXPIRE * 60)