Search in sources :

Example 16 with UserDTO

use of org.wso2.carbon.identity.mgt.dto.UserDTO in project carbon-identity-framework by wso2.

the class AuthenticationEndpointUtil method getUser.

/**
 * Build user object from complete username
 * @param userName
 * @return
 */
public static UserDTO getUser(String userName) {
    if (userName == null) {
        return null;
    }
    String userStoreDomain = extractDomainFromName(userName);
    String tenantDomain = MultitenantUtils.getTenantDomain(userName);
    String userNameWithoutTenantDomainAndUserStoreDomain = MultitenantUtils.getTenantAwareUsername(UserCoreUtil.removeDomainFromName(userName));
    UserDTO user = new UserDTO();
    user.setUsername(userNameWithoutTenantDomainAndUserStoreDomain);
    user.setRealm(userStoreDomain);
    user.setTenantDomain(tenantDomain);
    return user;
}
Also used : UserDTO(org.wso2.carbon.identity.application.authentication.endpoint.util.bean.UserDTO)

Example 17 with UserDTO

use of org.wso2.carbon.identity.mgt.dto.UserDTO in project carbon-identity-framework by wso2.

the class UserRegistrationAdminServiceClient method addUser.

/**
 * Add new user.
 *
 * @param username   Username of the user.
 * @param password   Password of the user.
 * @param userFields User fields to be updated.
 * @throws java.rmi.RemoteException
 * @throws UserRegistrationAdminServiceException
 */
public void addUser(String username, char[] password, List<UserFieldDTO> userFields) throws RemoteException, UserRegistrationAdminServiceException {
    UserDTO userDTO = new UserDTO();
    userDTO.setUserName(username);
    userDTO.setPassword(new String(password));
    userDTO.setUserFields(userFields.toArray(new UserFieldDTO[userFields.size()]));
    stub.addUser(userDTO);
}
Also used : UserFieldDTO(org.wso2.carbon.identity.user.registration.stub.dto.UserFieldDTO) UserDTO(org.wso2.carbon.identity.user.registration.stub.dto.UserDTO)

Example 18 with UserDTO

use of org.wso2.carbon.identity.mgt.dto.UserDTO in project identity-governance by wso2-extensions.

the class RecoverPasswordApiServiceImplTest method buildUserDTO.

private UserDTO buildUserDTO() {
    UserDTO userDTO = new UserDTO();
    userDTO.setUsername("dummy");
    return userDTO;
}
Also used : UserDTO(org.wso2.carbon.identity.recovery.endpoint.dto.UserDTO)

Example 19 with UserDTO

use of org.wso2.carbon.identity.mgt.dto.UserDTO in project identity-governance by wso2-extensions.

the class MeApiServiceImpl method getUser.

/**
 * Form UserDTO using username and tenant from context.
 *
 * @return userDTO.
 */
private UserDTO getUser() {
    String usernameFromContext = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
    String tenantFromContext = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
    UserDTO userDTO = new UserDTO();
    userDTO.setUsername(UserCoreUtil.removeDomainFromName(usernameFromContext));
    userDTO.setRealm(UserCoreUtil.extractDomainFromName(usernameFromContext));
    userDTO.setTenantDomain(tenantFromContext);
    return userDTO;
}
Also used : UserDTO(org.wso2.carbon.identity.user.endpoint.dto.UserDTO)

Example 20 with UserDTO

use of org.wso2.carbon.identity.mgt.dto.UserDTO in project identity-governance by wso2-extensions.

the class RecoveryUtil 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 : UserDTO(org.wso2.carbon.identity.recovery.endpoint.dto.UserDTO)

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