use of org.wso2.carbon.identity.mgt.beans.VerificationBean in project carbon-identity-framework by wso2.
the class UserIdentityManagementService method getChallengeQuestionsForUser.
/**
* get challenges of user
*
* @return array of challenges if null, return empty array
* @throws IdentityException if fails
*/
public UserChallengesDTO[] getChallengeQuestionsForUser(String userName, String confirmation) throws IdentityMgtServiceException {
UserDTO userDTO = null;
try {
userDTO = Utils.processUserId(userName);
} catch (IdentityException e) {
throw new IdentityMgtServiceException("Invalid user name.", e);
}
RecoveryProcessor processor = IdentityMgtServiceComponent.getRecoveryProcessor();
VerificationBean bean = processor.verifyConfirmationKey(confirmation);
if (bean.isVerified()) {
try {
processor.createConfirmationCode(userDTO, confirmation);
} catch (IdentityException e) {
log.error("Error in creating confirmation code.", e);
}
return processor.getQuestionProcessor().getChallengeQuestionsOfUser(userDTO.getUserId(), userDTO.getTenantId(), false);
}
return new UserChallengesDTO[0];
}
use of org.wso2.carbon.identity.mgt.beans.VerificationBean 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.beans.VerificationBean in project product-is by wso2.
the class UserInformationRecoveryServiceTestCase method testVerifyUserChallengeAnswer.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check verify user challenge question", dependsOnMethods = "testGetUserChallengeQuestion")
public void testVerifyUserChallengeAnswer() throws Exception {
VerificationBean bean = infoRecoveryClient.verifyUserChallengeAnswer("user11", confKey, "", "");
Assert.assertNotNull(bean, "Check verify user answer has failed with null return");
}
use of org.wso2.carbon.identity.mgt.beans.VerificationBean in project product-is by wso2.
the class UserInformationRecoveryServiceTestCase method testVerifyConfirmationCode.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check verify confirmation code", dependsOnMethods = "testSendRecoveryNotification")
public void testVerifyConfirmationCode() throws Exception {
VerificationBean bean = infoRecoveryClient.verifyConfirmationCode("user11", confKey, null);
Assert.assertNotNull(bean, "Verify confirmation code has failed with null return");
// Assert.assertNotNull(bean.getKey(), "Verify User has failed with null key return");
// confKey = bean.getKey();
// NotificationDataDTO dataDto = bean.getNotificationData();
}
use of org.wso2.carbon.identity.mgt.beans.VerificationBean 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");
}
Aggregations