Search in sources :

Example 11 with ClaimValue

use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project carbon-identity-framework by wso2.

the class MultipleCredentialsUserProxy method addUser.

/**
 * @param credential
 * @param roles
 * @param claims
 * @param profileName
 * @throws MultipleCredentialsUserAdminException
 */
public void addUser(Credential credential, String[] roles, ClaimValue[] claims, String profileName) throws MultipleCredentialsUserAdminException {
    try {
        roles = checkRolesPermissions(roles);
        MultipleCredentialUserStoreManager mgr = getUserStoreManager();
        Map<String, String> claimMap = getClaimsMap(claims);
        mgr.addUser(credential, roles, claimMap, profileName);
    } catch (UserStoreException e) {
        // previously logged so logging not needed
        throw new MultipleCredentialsUserAdminException(e.getMessage(), e);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new MultipleCredentialsUserAdminException(e.getMessage(), e);
    }
}
Also used : MultipleCredentialUserStoreManager(org.wso2.carbon.user.core.multiplecredentials.MultipleCredentialUserStoreManager) MultipleCredentialsUserAdminException(org.wso2.carbon.user.mgt.common.MultipleCredentialsUserAdminException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) MultipleCredentialsUserAdminException(org.wso2.carbon.user.mgt.common.MultipleCredentialsUserAdminException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) UserStoreException(org.wso2.carbon.user.core.UserStoreException)

Example 12 with ClaimValue

use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project carbon-identity-framework by wso2.

the class MultipleCredentialsUserProxy method setUserClaimValues.

public void setUserClaimValues(String identifer, String credentialType, ClaimValue[] claim, String profileName) throws MultipleCredentialsUserAdminException {
    try {
        MultipleCredentialUserStoreManager mgr = getUserStoreManager();
        Map<String, String> claims = getClaimsMap(claim);
        mgr.setUserClaimValues(identifer, credentialType, claims, profileName);
    } catch (UserStoreException e) {
        // previously logged so logging not needed
        throw new MultipleCredentialsUserAdminException(e.getMessage(), e);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new MultipleCredentialsUserAdminException(e.getMessage(), e);
    }
}
Also used : MultipleCredentialUserStoreManager(org.wso2.carbon.user.core.multiplecredentials.MultipleCredentialUserStoreManager) MultipleCredentialsUserAdminException(org.wso2.carbon.user.mgt.common.MultipleCredentialsUserAdminException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) MultipleCredentialsUserAdminException(org.wso2.carbon.user.mgt.common.MultipleCredentialsUserAdminException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) UserStoreException(org.wso2.carbon.user.core.UserStoreException)

Example 13 with ClaimValue

use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project carbon-identity-framework by wso2.

the class MultipleCredentialsUserProxy method getClaimValues.

private ClaimValue[] getClaimValues(Map<String, String> claim) {
    if (claim != null) {
        ClaimValue[] claimValue = new ClaimValue[claim.size()];
        int i = 0;
        for (Map.Entry<String, String> entry : claim.entrySet()) {
            claimValue[i] = new ClaimValue();
            claimValue[i].setClaimURI(entry.getKey());
            claimValue[i].setValue(entry.getValue());
            i++;
        }
        return claimValue;
    }
    return new ClaimValue[0];
}
Also used : ClaimValue(org.wso2.carbon.user.mgt.common.ClaimValue) HashMap(java.util.HashMap) Map(java.util.Map)

Example 14 with ClaimValue

use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project carbon-identity-framework by wso2.

the class MultipleCredentialsUserProxy method setUserClaimValue.

public void setUserClaimValue(String identifer, String credentialType, String claimURI, String claimValue, String profileName) throws MultipleCredentialsUserAdminException {
    try {
        MultipleCredentialUserStoreManager mgr = getUserStoreManager();
        mgr.setUserClaimValue(identifer, credentialType, claimURI, claimValue, profileName);
    } catch (UserStoreException e) {
        throw new MultipleCredentialsUserAdminException(e.getMessage(), e);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new MultipleCredentialsUserAdminException(e.getMessage(), e);
    }
}
Also used : MultipleCredentialUserStoreManager(org.wso2.carbon.user.core.multiplecredentials.MultipleCredentialUserStoreManager) MultipleCredentialsUserAdminException(org.wso2.carbon.user.mgt.common.MultipleCredentialsUserAdminException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) MultipleCredentialsUserAdminException(org.wso2.carbon.user.mgt.common.MultipleCredentialsUserAdminException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) UserStoreException(org.wso2.carbon.user.core.UserStoreException)

Example 15 with ClaimValue

use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project carbon-identity-framework by wso2.

the class MultipleCredentialsUserProxy method addUser.

public void addUser(String userId, Credential credential, String[] roleList, ClaimValue[] claims, String profileName) throws MultipleCredentialsUserAdminException {
    try {
        roleList = checkRolesPermissions(roleList);
        MultipleCredentialUserStoreManager mgr = getUserStoreManager();
        Map<String, String> claimMap = getClaimsMap(claims);
        mgr.addUserWithUserId(userId, credential, roleList, claimMap, profileName);
    } catch (UserStoreException e) {
        // previously logged so logging not needed
        throw new MultipleCredentialsUserAdminException(e.getMessage(), e);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new MultipleCredentialsUserAdminException(e.getMessage(), e);
    }
}
Also used : MultipleCredentialUserStoreManager(org.wso2.carbon.user.core.multiplecredentials.MultipleCredentialUserStoreManager) MultipleCredentialsUserAdminException(org.wso2.carbon.user.mgt.common.MultipleCredentialsUserAdminException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) MultipleCredentialsUserAdminException(org.wso2.carbon.user.mgt.common.MultipleCredentialsUserAdminException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) UserStoreException(org.wso2.carbon.user.core.UserStoreException)

Aggregations

ClaimValue (org.wso2.carbon.um.ws.api.stub.ClaimValue)23 HashMap (java.util.HashMap)21 Test (org.testng.annotations.Test)19 UserStoreException (org.wso2.carbon.user.core.UserStoreException)14 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)14 Map (java.util.Map)13 ArrayList (java.util.ArrayList)11 RemoteException (java.rmi.RemoteException)9 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)9 UserStoreException (org.wso2.carbon.user.api.UserStoreException)9 ClaimValue (org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue)9 IdentityException (org.wso2.carbon.identity.base.IdentityException)8 WorkflowAdminServiceWorkflowException (org.wso2.carbon.identity.workflow.mgt.stub.WorkflowAdminServiceWorkflowException)8 Association (org.wso2.carbon.identity.workflow.mgt.stub.metadata.Association)8 Matchers.anyString (org.mockito.Matchers.anyString)7 FlaggedName (org.wso2.carbon.user.mgt.stub.types.carbon.FlaggedName)7 UserStoreManager (org.wso2.carbon.user.core.UserStoreManager)6 AuthenticatedUser (org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser)5 ClaimValue (org.wso2.carbon.user.mgt.common.ClaimValue)5 HashSet (java.util.HashSet)4