use of org.wso2.carbon.identity.mgt.dto.UserChallengesDTO 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.dto.UserChallengesDTO in project carbon-identity-framework by wso2.
the class UserIdentityManagementUtil method handleChallengesError.
private static UserChallengesDTO handleChallengesError(String error, Exception e) {
UserChallengesDTO bean = new UserChallengesDTO();
if (error != null) {
bean.setError(error);
log.error(error, e);
} else {
bean.setError(e.getMessage());
log.error(e);
}
return bean;
}
use of org.wso2.carbon.identity.mgt.dto.UserChallengesDTO in project product-is by wso2.
the class UserInformationRecoveryServiceTestCase method testGetUserChallengeQuestion.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check get user challenge question", dependsOnMethods = "testGetUserChallengeQuestionIds")
public void testGetUserChallengeQuestion() throws Exception {
UserChallengesDTO bean = infoRecoveryClient.getUserChallengeQuestion("user11", confKey, "");
Assert.assertNotNull(bean, "Getting challenge question has failed with null return");
}
Aggregations