diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/FederatedUserJWTTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/FederatedUserJWTTestCase.java index 434e69914e..a2888efd88 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/FederatedUserJWTTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/FederatedUserJWTTestCase.java @@ -288,6 +288,9 @@ public void testEnableJWTAndClaimsForJWTApp() throws Exception { assertTrue("JWT claim givenname not received" + claim, claim.contains("first name".concat(endUser))); claim = jsonObject.getString("http://wso2.org/claims/lastname"); assertTrue("JWT claim lastname not received" + claim, claim.contains("last name".concat(endUser))); + claim = jsonObject.getString("http://wso2.org/claims/region"); + assertTrue("JWT claim region not received" + claim, + claim.contains("[{\"areaId\":\"71224\",\"areaName\":\"20-NYU\"}]")); claim = jsonObject.getString("mobile"); assertTrue("JWT claim mobile not received" + claim, claim.contains("94123456987")); claim = jsonObject.getString("organization"); @@ -531,6 +534,8 @@ private void createUser() throws RemoteException, "http://wso2.org/claims/givenname", "first name".concat(user), DEFAULT_PROFILE); remoteUserStoreManagerServiceClient.setUserClaimValue(user, "http://wso2.org/claims/lastname", "last name".concat(user), DEFAULT_PROFILE); + remoteUserStoreManagerServiceClient.setUserClaimValue(user, + "http://wso2.org/claims/region", "[{'areaId':'71224','areaName':'20-NYU'}]", DEFAULT_PROFILE); remoteUserStoreManagerServiceClient.setUserClaimValue(user, "http://wso2.org/claims/organization", "ABC".concat(user), DEFAULT_PROFILE); remoteUserStoreManagerServiceClient.setUserClaimValue(user, @@ -660,7 +665,7 @@ private void updateServiceProviderWithRequiredClaims(String consumerKey) throws OAuthAdminServiceIdentityOAuthAdminException, RemoteException, IdentityApplicationManagementServiceIdentityApplicationManagementException { String[] requestedClaims = { "http://wso2.org/claims/givenname", "http://wso2.org/claims/lastname", - "http://wso2.org/claims/mobile", "http://wso2.org/claims/organization", + "http://wso2.org/claims/region", "http://wso2.org/claims/mobile", "http://wso2.org/claims/organization", "http://wso2.org/claims/telephone", "http://wso2.org/claims/emailaddress" }; OAuthConsumerAppDTO oAuthApplicationData = oAuthAdminServiceClient.getOAuthApplicationData(consumerKey); String applicationName = oAuthApplicationData.getApplicationName(); diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/JWTTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/JWTTestCase.java index dcb6506b30..35e8ff582f 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/JWTTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/JWTTestCase.java @@ -284,6 +284,9 @@ public void testEnableJWTAndClaimsForJWTApp() throws Exception { assertTrue("JWT claim givenname not received" + claim, claim.contains("first name".concat(endUser))); claim = jsonObject.getString("http://wso2.org/claims/lastname"); assertTrue("JWT claim lastname not received" + claim, claim.contains("last name".concat(endUser))); + claim = jsonObject.getString("http://wso2.org/claims/region"); + assertTrue("JWT claim region not received" + claim, + claim.contains("[{\"areaId\":\"71224\",\"areaName\":\"20-NYU\"}]")); claim = jsonObject.getString("mobile"); assertTrue("JWT claim mobile not received" + claim, claim.contains("94123456987")); claim = jsonObject.getString("organization"); @@ -510,6 +513,8 @@ private void createUser() throws RemoteException, "http://wso2.org/claims/givenname", "first name".concat(user), DEFAULT_PROFILE); remoteUserStoreManagerServiceClient.setUserClaimValue(user, "http://wso2.org/claims/lastname", "last name".concat(user), DEFAULT_PROFILE); + remoteUserStoreManagerServiceClient.setUserClaimValue(user, + "http://wso2.org/claims/region", "[{'areaId':'71224','areaName':'20-NYU'}]", DEFAULT_PROFILE); remoteUserStoreManagerServiceClient.setUserClaimValue(user, "http://wso2.org/claims/organization", "ABC".concat(user), DEFAULT_PROFILE); remoteUserStoreManagerServiceClient.setUserClaimValue(user, @@ -532,8 +537,8 @@ private void createClaimMapping() throws RemoteException, ClaimMetadataManagemen private void updateServiceProviderWithRequiredClaims(String consumerKey) throws OAuthAdminServiceIdentityOAuthAdminException, RemoteException, IdentityApplicationManagementServiceIdentityApplicationManagementException { - String[] requestedClaims = {"http://wso2.org/claims/givenname","http://wso2.org/claims/lastname","http://wso2" + - ".org/claims/organization","http://wso2.org/claims/mobile"}; + String[] requestedClaims = {"http://wso2.org/claims/givenname","http://wso2.org/claims/lastname", + "http://wso2.org/claims/region","http://wso2.org/claims/organization","http://wso2.org/claims/mobile"}; OAuthConsumerAppDTO oAuthApplicationData = oAuthAdminServiceClient.getOAuthApplicationData(consumerKey); String applicationName = oAuthApplicationData.getApplicationName(); ServiceProvider application = applicationManagementClient.getApplication(applicationName); @@ -694,6 +699,9 @@ private void verifyUserProfileInfoClaims(JSONObject decodedJWTJSONObject, String assertTrue("JWT claim givenname not received" + claim, claim.contains("first name".concat(endUser))); claim = decodedJWTJSONObject.getString("http://wso2.org/claims/lastname"); assertTrue("JWT claim lastname not received" + claim, claim.contains("last name".concat(endUser))); + claim = decodedJWTJSONObject.getString("http://wso2.org/claims/region"); + assertTrue("JWT claim region not received" + claim, + claim.contains("[{\"areaId\":\"71224\",\"areaName\":\"20-NYU\"}]")); claim = decodedJWTJSONObject.getString("http://wso2.org/claims/mobile"); assertTrue("JWT claim mobile not received" + claim, claim.contains("94123456987")); claim = decodedJWTJSONObject.getString("http://wso2.org/claims/organization"); diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/urlsafe/URLSafeJWTTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/urlsafe/URLSafeJWTTestCase.java index b175554f07..8244496af8 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/urlsafe/URLSafeJWTTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/jwt/urlsafe/URLSafeJWTTestCase.java @@ -166,6 +166,9 @@ public void testEnableJWTAndClaimsForOauthApp() throws Exception { assertTrue("JWT claim givenname not received" + claim, claim.contains("first name")); claim = jsonObject.getString("http://wso2.org/claims/lastname"); assertTrue("JWT claim lastname not received" + claim, claim.contains("last name")); + claim = jsonObject.getString("http://wso2.org/claims/region"); + assertTrue("JWT claim region not received" + claim, + claim.contains("[{\"areaId\":\"71224\",\"areaName\":\"20-NYU\"}]")); boolean bExceptionOccured = false; try { jsonObject.getString("http://wso2.org/claims/wrongclaim"); @@ -276,6 +279,8 @@ private void createUser() throws RemoteException, "http://wso2.org/claims/givenname", "first name", DEFAULT_PROFILE); remoteUserStoreManagerServiceClient.setUserClaimValue(enduserName, "http://wso2.org/claims/lastname", "last name", DEFAULT_PROFILE); + remoteUserStoreManagerServiceClient.setUserClaimValue(enduserName, + "http://wso2.org/claims/region", "[{'areaId':'71224','areaName':'20-NYU'}]", DEFAULT_PROFILE); }