Search in sources :

Example 21 with UserDTO

use of org.wso2.carbon.apimgt.rest.api.store.dto.UserDTO in project identity-governance by wso2-extensions.

the class Utils method getRecoveryUser.

public static UserDTO getRecoveryUser(User user) {
    UserDTO userDTO = new UserDTO();
    userDTO.setRealm(user.getUserStoreDomain());
    userDTO.setTenantDomain(user.getTenantDomain());
    userDTO.setUsername(user.getUserName());
    return userDTO;
}
Also used : SelfRegistrationUserDTO(org.wso2.carbon.identity.user.endpoint.dto.SelfRegistrationUserDTO) UserDTO(org.wso2.carbon.identity.user.endpoint.dto.UserDTO)

Example 22 with UserDTO

use of org.wso2.carbon.apimgt.rest.api.store.dto.UserDTO in project identity-governance by wso2-extensions.

the class Utils method getUserDTO.

public static UserDTO getUserDTO(User user) {
    UserDTO userDTO = new UserDTO();
    if (user == null) {
        return userDTO;
    }
    userDTO.setTenantDomain(user.getTenantDomain());
    if (StringUtils.isNotBlank(user.getUserStoreDomain())) {
        userDTO.setRealm(user.getUserStoreDomain());
    } else {
        userDTO.setRealm(IdentityUtil.getPrimaryDomainName());
    }
    userDTO.setUsername(user.getUserName());
    return userDTO;
}
Also used : SelfRegistrationUserDTO(org.wso2.carbon.identity.user.endpoint.dto.SelfRegistrationUserDTO) UserDTO(org.wso2.carbon.identity.user.endpoint.dto.UserDTO)

Example 23 with UserDTO

use of org.wso2.carbon.apimgt.rest.api.store.dto.UserDTO in project identity-governance by wso2-extensions.

the class UtilsTest method buildSelfRegistrationUserDTO.

private SelfRegistrationUserDTO buildSelfRegistrationUserDTO() {
    SelfRegistrationUserDTO userDTO = new SelfRegistrationUserDTO();
    userDTO.setTenantDomain("testTenant");
    userDTO.setUsername("testUser");
    userDTO.setRealm("testRealm");
    return userDTO;
}
Also used : SelfRegistrationUserDTO(org.wso2.carbon.identity.user.endpoint.dto.SelfRegistrationUserDTO)

Example 24 with UserDTO

use of org.wso2.carbon.apimgt.rest.api.store.dto.UserDTO in project identity-governance by wso2-extensions.

the class UsernameUpdateServiceImplTest method buildUserDTO.

private UserDTO buildUserDTO(String existingUsername, String newUsername, String userStoreDomain, String tenantDomain) {
    UserDTO userDTO = new UserDTO();
    userDTO.setExistingUsername(existingUsername);
    userDTO.setNewUsername(newUsername);
    userDTO.setUserStoreDomain(userStoreDomain);
    userDTO.setTenantDomain(tenantDomain);
    return userDTO;
}
Also used : UserDTO(org.wso2.carbon.identity.user.rename.core.dto.UserDTO)

Example 25 with UserDTO

use of org.wso2.carbon.apimgt.rest.api.store.dto.UserDTO in project identity-governance by wso2-extensions.

the class UsernameUpdateServiceImplTest method testExceptionWhileRetrievingRealm.

@Test(expectedExceptions = UsernameUpdateException.class)
public void testExceptionWhileRetrievingRealm() throws Exception {
    UserDTO userDTO = buildUserDTO("testuser1", "testuser11", UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    RealmService realmService = mock(RealmService.class);
    TenantManager tenantManager = mock(TenantManager.class);
    when(realmService.getTenantManager()).thenReturn(tenantManager);
    when(tenantManager.getTenantId(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)).thenReturn(MultitenantConstants.SUPER_TENANT_ID);
    when(realmService.getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID)).thenThrow(new UserStoreException("Error while retrieving tenant realm"));
    UsernameUpdateServiceImpl usernameUpdateServiceImpl = new UsernameUpdateServiceImpl();
    usernameUpdateServiceImpl.setRealmService(realmService);
    usernameUpdateServiceImpl.updateUsername(userDTO);
}
Also used : RealmService(org.wso2.carbon.user.core.service.RealmService) UserDTO(org.wso2.carbon.identity.user.rename.core.dto.UserDTO) UserStoreException(org.wso2.carbon.user.api.UserStoreException) TenantManager(org.wso2.carbon.user.core.tenant.TenantManager) Test(org.testng.annotations.Test)

Aggregations

IdentityException (org.wso2.carbon.identity.base.IdentityException)23 UserDTO (org.wso2.carbon.identity.mgt.dto.UserDTO)22 VerificationBean (org.wso2.carbon.identity.mgt.beans.VerificationBean)19 RecoveryProcessor (org.wso2.carbon.identity.mgt.RecoveryProcessor)17 UserStoreException (org.wso2.carbon.user.api.UserStoreException)17 IdentityMgtServiceException (org.wso2.carbon.identity.mgt.IdentityMgtServiceException)14 PrivilegedCarbonContext (org.wso2.carbon.context.PrivilegedCarbonContext)12 Test (org.testng.annotations.Test)10 UserDTO (org.wso2.carbon.identity.user.rename.core.dto.UserDTO)10 UserRecoveryDTO (org.wso2.carbon.identity.mgt.dto.UserRecoveryDTO)9 UserStoreManager (org.wso2.carbon.user.api.UserStoreManager)9 RealmService (org.wso2.carbon.user.core.service.RealmService)9 TenantManager (org.wso2.carbon.user.core.tenant.TenantManager)8 UserDTO (org.wso2.carbon.identity.test.integration.service.stub.UserDTO)7 UserDTO (org.wso2.carbon.identity.user.endpoint.dto.UserDTO)6 NotificationDataDTO (org.wso2.carbon.identity.mgt.dto.NotificationDataDTO)5 UserChallengesDTO (org.wso2.carbon.identity.mgt.dto.UserChallengesDTO)4 User (org.wso2.carbon.apimgt.core.models.User)3 User (org.wso2.carbon.identity.application.common.model.User)3 ChallengeQuestionProcessor (org.wso2.carbon.identity.mgt.ChallengeQuestionProcessor)3