use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project identity-governance by wso2-extensions.
the class MeApiServiceImplTest method buildClaimDTO.
private ClaimDTO buildClaimDTO() {
ClaimDTO claimDTO = new ClaimDTO();
claimDTO.setUri("http://wso2.org.email");
claimDTO.setValue("test@gmail.com");
return claimDTO;
}
use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project identity-governance by wso2-extensions.
the class RecoveryUtil method getClaimDTO.
public static ClaimDTO getClaimDTO(Claim claim) {
ClaimDTO claimDTO = new ClaimDTO();
claimDTO.setUri(claim.getClaimUri());
claimDTO.setValue(claim.getValue());
claimDTO.setDialect(claim.getDialectURI());
claimDTO.setDescription(claim.getDescription());
claimDTO.setReadOnly(claim.isReadOnly());
claimDTO.setRequired(claim.isRequired());
claimDTO.setDisplayName(claim.getDisplayTag());
claimDTO.setValidationRegex(claim.getRegEx());
return claimDTO;
}
use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project product-is by wso2.
the class SelfRegistrationTestCase method validateUserClaims.
private void validateUserClaims(ClaimDTO[] claimDTOs) {
if (((JSONObject) registerRequestJSON.get(USER)).get(CLAIMS) == null) {
return;
}
JSONArray claims = (JSONArray) ((JSONObject) registerRequestJSON.get(USER)).get(CLAIMS);
for (Object claim : claims) {
JSONObject claimJSON = (JSONObject) claim;
String claimUri = claimJSON.get(URI).toString();
boolean found = false;
for (ClaimDTO claimDTO : claimDTOs) {
if (claimUri.equals(claimDTO.getClaimUri())) {
assertEquals(claimDTO.getValue(), claimJSON.get(VALUE).toString(), "Invalid claim value for the Claim URI: " + claimUri);
found = true;
break;
}
}
assertTrue(found, "ClaimDTO not found for the Claim URI: " + claimUri);
}
}
use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project product-is by wso2.
the class AbstractUUIDUMTestCase method testSetUserClaimValues.
public void testSetUserClaimValues() throws Exception {
String claimValueStr = "last name";
String claimURIStr = "http://wso2.org/claims/lastname";
ClaimValue claimValue = new ClaimValue();
claimValue.setClaimUri(claimURIStr);
claimValue.setClaimValue(claimValueStr);
userMgtClient.setUserClaimValuesWithID(userId, new ClaimValue[] { claimValue }, defaultProfile);
ClaimDTO[] claimDTOs = userMgtClient.getUserClaimValuesWithID(userId, defaultProfile);
for (ClaimDTO claimDTO : claimDTOs) {
if (claimURIStr.equals(claimDTO.getClaimUri())) {
Assert.assertEquals(claimDTO.getValue(), claimValueStr);
break;
}
}
}
use of org.wso2.micro.gateway.jwt.generator.ClaimDTO in project product-is by wso2.
the class AbstractUUIDUMTestCase method testDeleteUserClaimValuesWithID.
public void testDeleteUserClaimValuesWithID() throws Exception {
String claimValueStr = "Sri Lanka";
String claimURIStr = "http://wso2.org/claims/country";
ClaimValue claimValue = new ClaimValue();
claimValue.setClaimUri(claimURIStr);
claimValue.setClaimValue(claimValueStr);
userMgtClient.setUserClaimValuesWithID(userId, new ClaimValue[] { claimValue }, defaultProfile);
userMgtClient.deleteUserClaimValuesWithID(userId, new String[] { claimURIStr }, defaultProfile);
ClaimDTO[] claimDTOs = userMgtClient.getUserClaimValuesWithID(userId, defaultProfile);
for (ClaimDTO claimDTO : claimDTOs) {
if (claimURIStr.equals(claimDTO.getClaimUri())) {
Assert.assertNotEquals(claimValue, claimDTO.getValue());
break;
}
}
}
Aggregations