use of org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO in project carbon-identity-framework by wso2.
the class UserIdentityManagementUtil method getUserSecurityQuestions.
/**
* Returns security questions of the logged in user
*
* @param userStoreManager
* @return
* @throws IdentityMgtServiceException
*/
public static UserIdentityClaimDTO[] getUserSecurityQuestions(String userName, UserStoreManager userStoreManager) throws IdentityMgtServiceException {
UserIdentityDataStore store = IdentityMgtConfig.getInstance().getIdentityDataStore();
UserIdentityClaimsDO userIdentityDO;
userIdentityDO = store.load(userName, userStoreManager);
if (userIdentityDO != null) {
return userIdentityDO.getUserSequeiryQuestions();
} else {
throw new IdentityMgtServiceException("No user account found for user " + userName);
}
}
use of org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO in project carbon-identity-framework by wso2.
the class UserIdentityManagementUtil method getUserIdentityClaims.
/**
* Returns all user claims which can be used in the identity recovery
* process
*
* @param userName
* @param userStoreManager
* @return
* @throws IdentityException
*/
public static UserIdentityClaimDTO[] getUserIdentityClaims(String userName, UserStoreManager userStoreManager) throws IdentityException {
UserIdentityDataStore store = IdentityMgtConfig.getInstance().getIdentityDataStore();
UserIdentityClaimsDO userIdentityDO = store.load(userName, userStoreManager);
if (userIdentityDO != null) {
return userIdentityDO.getUserIdentityRecoveryData();
} else {
throw IdentityException.error("No user account found for user " + userName);
}
}
use of org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO in project product-is by wso2.
the class UserInformationRecoveryServiceTestCase method testRegisterUserWithInvalidTenant.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check user registration validation with Invalid Tenant", dependsOnMethods = "testRegisterUser")
public void testRegisterUserWithInvalidTenant() throws Exception {
UserIdentityClaimDTO[] claims = new UserIdentityClaimDTO[2];
UserIdentityClaimDTO claimEmail = new UserIdentityClaimDTO();
claimEmail.setClaimUri("http://wso2.org/claims/emailaddress");
claimEmail.setClaimValue("user2@wso2.com");
UserIdentityClaimDTO claimLastName = new UserIdentityClaimDTO();
claimLastName.setClaimUri("http://wso2.org/claims/givenname");
claimLastName.setClaimValue("user2");
claims[0] = claimEmail;
claims[1] = claimLastName;
VerificationBean bean = infoRecoveryClient.registerUser(null, "passWord1@", claims, "default", "tenant");
Assert.assertNotNull(bean.getError(), "The expected error message is null with null return");
}
use of org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO in project product-is by wso2.
the class UserInformationRecoveryServiceTestCase method testRegisterUserWithEmptyPassword.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check user registration validation with empty password", dependsOnMethods = "testRegisterUser")
public void testRegisterUserWithEmptyPassword() throws Exception {
UserIdentityClaimDTO[] claims = new UserIdentityClaimDTO[2];
UserIdentityClaimDTO claimEmail = new UserIdentityClaimDTO();
claimEmail.setClaimUri("http://wso2.org/claims/emailaddress");
claimEmail.setClaimValue("user2@wso2.com");
UserIdentityClaimDTO claimLastName = new UserIdentityClaimDTO();
claimLastName.setClaimUri("http://wso2.org/claims/givenname");
claimLastName.setClaimValue("user2");
claims[0] = claimEmail;
claims[1] = claimLastName;
VerificationBean bean = infoRecoveryClient.registerUser("user3", null, claims, "default", null);
Assert.assertNotNull(bean.getError(), "The expected error message is null with null return");
}
use of org.wso2.carbon.identity.mgt.stub.dto.UserIdentityClaimDTO in project product-is by wso2.
the class UserInformationRecoveryServiceTestCase method testRegisterExistingUser.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check existing user registration validation", dependsOnMethods = "testRegisterUser")
public void testRegisterExistingUser() throws Exception {
UserIdentityClaimDTO[] claims = new UserIdentityClaimDTO[2];
UserIdentityClaimDTO claimEmail = new UserIdentityClaimDTO();
claimEmail.setClaimUri("http://wso2.org/claims/emailaddress");
claimEmail.setClaimValue("user2@wso2.com");
UserIdentityClaimDTO claimLastName = new UserIdentityClaimDTO();
claimLastName.setClaimUri("http://wso2.org/claims/givenname");
claimLastName.setClaimValue("user2");
claims[0] = claimEmail;
claims[1] = claimLastName;
VerificationBean bean = infoRecoveryClient.registerUser("user2", "passWord1@", claims, "default", null);
Assert.assertNotNull(bean.getError(), "The expected error message is null with null return");
}
Aggregations