Search in sources :

Example 21 with ClaimDTO

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;
}
Also used : ClaimDTO(org.wso2.carbon.identity.user.endpoint.dto.ClaimDTO)

Example 22 with 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;
}
Also used : ClaimDTO(org.wso2.carbon.identity.recovery.endpoint.dto.ClaimDTO) UserClaimDTO(org.wso2.carbon.identity.recovery.endpoint.dto.UserClaimDTO)

Example 23 with 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);
    }
}
Also used : ClaimDTO(org.wso2.carbon.um.ws.api.stub.ClaimDTO) JSONObject(org.json.simple.JSONObject) JSONArray(org.json.simple.JSONArray) JSONObject(org.json.simple.JSONObject)

Example 24 with ClaimDTO

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;
        }
    }
}
Also used : ClaimDTO(org.wso2.carbon.identity.test.integration.service.stub.ClaimDTO) ClaimValue(org.wso2.carbon.identity.test.integration.service.stub.ClaimValue)

Example 25 with ClaimDTO

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;
        }
    }
}
Also used : ClaimDTO(org.wso2.carbon.identity.test.integration.service.stub.ClaimDTO) ClaimValue(org.wso2.carbon.identity.test.integration.service.stub.ClaimValue)

Aggregations

ArrayList (java.util.ArrayList)9 ClaimDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimDTO)7 ClaimMappingDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimMappingDTO)7 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)5 Test (org.testng.annotations.Test)4 ClaimDialectDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimDialectDTO)4 Claim (org.wso2.carbon.user.api.Claim)4 HashMap (java.util.HashMap)3 ClaimAttributeDTO (org.wso2.carbon.claim.mgt.stub.dto.ClaimAttributeDTO)3 ClaimDTO (org.wso2.carbon.identity.test.integration.service.stub.ClaimDTO)3 ClaimDTO (org.wso2.carbon.identity.user.endpoint.dto.ClaimDTO)3 ClaimDTO (org.wso2.carbon.um.ws.api.stub.ClaimDTO)3 UserIdentityClaimDTO (org.wso2.carbon.identity.mgt.dto.UserIdentityClaimDTO)2 ClaimDTO (org.wso2.carbon.identity.recovery.endpoint.dto.ClaimDTO)2 ClaimValue (org.wso2.carbon.identity.test.integration.service.stub.ClaimValue)2 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Map (java.util.Map)1 BPackage (org.ballerinalang.jvm.types.BPackage)1 BArray (org.ballerinalang.jvm.values.api.BArray)1