diff --git a/modules_core/com.smf.securewebservices/src/com/smf/securewebservices/utils/SecureWebServicesUtils.java b/modules_core/com.smf.securewebservices/src/com/smf/securewebservices/utils/SecureWebServicesUtils.java index 9a87f4a5..0231bb9a 100644 --- a/modules_core/com.smf.securewebservices/src/com/smf/securewebservices/utils/SecureWebServicesUtils.java +++ b/modules_core/com.smf.securewebservices/src/com/smf/securewebservices/utils/SecureWebServicesUtils.java @@ -691,10 +691,10 @@ private static Builder getJwtBuilder(User user, Role selectedRole, Organization return JWT.create() .withIssuer("sws") .withAudience("sws") - .withClaim("ad_user_id", user.getId()) - .withClaim("ad_client_id", selectedRole.getClient().getId()) - .withClaim("ad_role_id", selectedRole.getId()) - .withClaim("ad_org_id", selectedOrg.getId()) + .withClaim("user", user.getId()) + .withClaim("client", selectedRole.getClient().getId()) + .withClaim("role", selectedRole.getId()) + .withClaim("organization", selectedOrg.getId()) .withClaim("warehouse", selectedWarehouse.getId()) .withIssuedAt(new Date()); } diff --git a/src-test/src/com/smf/securewebservices/utils/SecureWebServicesUtilsTest.java b/src-test/src/com/smf/securewebservices/utils/SecureWebServicesUtilsTest.java index b1020e77..3293830d 100644 --- a/src-test/src/com/smf/securewebservices/utils/SecureWebServicesUtilsTest.java +++ b/src-test/src/com/smf/securewebservices/utils/SecureWebServicesUtilsTest.java @@ -101,9 +101,9 @@ public void testGenerateAndDecodeTokenWithHS256Algorithm() throws Exception { String token = SecureWebServicesUtils.generateToken(user, role, org, warehouse); DecodedJWT decodedToken = SecureWebServicesUtils.decodeToken(token); - assertEquals(user.getId(), decodedToken.getClaim("ad_user_id").asString()); - assertEquals(role.getId(), decodedToken.getClaim("ad_role_id").asString()); - assertEquals(org.getId(), decodedToken.getClaim("ad_org_id").asString()); + assertEquals(user.getId(), decodedToken.getClaim("user").asString()); + assertEquals(role.getId(), decodedToken.getClaim("role").asString()); + assertEquals(org.getId(), decodedToken.getClaim("organization").asString()); } /** @@ -121,9 +121,9 @@ public void testGenerateAndDecodeTokenWithES256Algorithm() throws Exception { String token = SecureWebServicesUtils.generateToken(user, role, org, warehouse); DecodedJWT decodedToken = SecureWebServicesUtils.decodeToken(token); - assertEquals(user.getId(), decodedToken.getClaim("ad_user_id").asString()); - assertEquals(role.getId(), decodedToken.getClaim("ad_role_id").asString()); - assertEquals(org.getId(), decodedToken.getClaim("ad_org_id").asString()); + assertEquals(user.getId(), decodedToken.getClaim("user").asString()); + assertEquals(role.getId(), decodedToken.getClaim("role").asString()); + assertEquals(org.getId(), decodedToken.getClaim("organization").asString()); } /**