Search in sources :

Example 1 with ResendCodeRequestDTO

use of org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO in project identity-governance by wso2-extensions.

the class MeApiServiceImpl method doResendConfirmationCode.

private NotificationResponseBean doResendConfirmationCode(String recoveryScenario, NotificationResponseBean notificationResponseBean, ResendCodeRequestDTO resendCodeRequestDTO) {
    UserRecoveryData userRecoveryData = null;
    // Currently this me/resend-code API supports resend code during mobile verification scenario only.
    if (RecoveryScenarios.MOBILE_VERIFICATION_ON_UPDATE.toString().equals(recoveryScenario)) {
        userRecoveryData = Utils.getUserRecoveryData(resendCodeRequestDTO, recoveryScenario);
    }
    if (userRecoveryData == null) {
        return notificationResponseBean;
    }
    ResendConfirmationManager resendConfirmationManager = Utils.getResendConfirmationManager();
    if (RecoveryScenarios.MOBILE_VERIFICATION_ON_UPDATE.toString().equals(recoveryScenario) && RecoveryScenarios.MOBILE_VERIFICATION_ON_UPDATE.equals(userRecoveryData.getRecoveryScenario()) && RecoverySteps.VERIFY_MOBILE_NUMBER.equals(userRecoveryData.getRecoveryStep())) {
        notificationResponseBean = setNotificationResponseBean(resendConfirmationManager, RecoveryScenarios.MOBILE_VERIFICATION_ON_UPDATE.toString(), RecoverySteps.VERIFY_MOBILE_NUMBER.toString(), IdentityRecoveryConstants.NOTIFICATION_TYPE_VERIFY_MOBILE_ON_UPDATE, resendCodeRequestDTO);
    }
    return notificationResponseBean;
}
Also used : UserRecoveryData(org.wso2.carbon.identity.recovery.model.UserRecoveryData) ResendConfirmationManager(org.wso2.carbon.identity.recovery.confirmation.ResendConfirmationManager)

Example 2 with ResendCodeRequestDTO

use of org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO in project identity-governance by wso2-extensions.

the class ResendCodeApiServiceImplTest method duplicateScenarioResendCodeRequestDTO.

private ResendCodeRequestDTO duplicateScenarioResendCodeRequestDTO() {
    ResendCodeRequestDTO resendCodeRequestDTO = new ResendCodeRequestDTO();
    resendCodeRequestDTO.setUser(buildUserDTO());
    List<PropertyDTO> listProperty = new ArrayList<>();
    listProperty.add(recoveryScenarioPropertyDTO());
    listProperty.add(recoveryScenarioPropertyDTO());
    resendCodeRequestDTO.setProperties(listProperty);
    return resendCodeRequestDTO;
}
Also used : ArrayList(java.util.ArrayList) ResendCodeRequestDTO(org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO) PropertyDTO(org.wso2.carbon.identity.user.endpoint.dto.PropertyDTO)

Example 3 with ResendCodeRequestDTO

use of org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO in project identity-governance by wso2-extensions.

the class ResendCodeApiServiceImplTest method testIdentityRecoveryExceptioninResendCodePost.

@Test
public void testIdentityRecoveryExceptioninResendCodePost() throws IdentityRecoveryException {
    Mockito.when(userSelfRegistrationManager.resendConfirmationCode(Utils.getUser(resendCodeRequestDTO().getUser()), Utils.getProperties(resendCodeRequestDTO().getProperties()))).thenThrow(new IdentityRecoveryException("Recovery Exception"));
    assertEquals(resendCodeApiService.resendCodePost(resendCodeRequestDTO()).getStatus(), 501);
}
Also used : IdentityRecoveryException(org.wso2.carbon.identity.recovery.IdentityRecoveryException) Test(org.testng.annotations.Test)

Example 4 with ResendCodeRequestDTO

use of org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO in project identity-governance by wso2-extensions.

the class ResendCodeApiServiceImplTest method recoveryScenarioResendCodeRequestDTO.

private ResendCodeRequestDTO recoveryScenarioResendCodeRequestDTO() {
    ResendCodeRequestDTO resendCodeRequestDTO = new ResendCodeRequestDTO();
    resendCodeRequestDTO.setUser(buildUserDTO());
    List<PropertyDTO> listProperty = new ArrayList<>();
    listProperty.add(recoveryScenarioPropertyDTO());
    resendCodeRequestDTO.setProperties(listProperty);
    return resendCodeRequestDTO;
}
Also used : ArrayList(java.util.ArrayList) ResendCodeRequestDTO(org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO) PropertyDTO(org.wso2.carbon.identity.user.endpoint.dto.PropertyDTO)

Example 5 with ResendCodeRequestDTO

use of org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO in project identity-governance by wso2-extensions.

the class ResendCodeApiServiceImplTest method resendCodeRequestDTO.

private ResendCodeRequestDTO resendCodeRequestDTO() {
    ResendCodeRequestDTO resendCodeRequestDTO = new ResendCodeRequestDTO();
    resendCodeRequestDTO.setUser(buildUserDTO());
    List<PropertyDTO> listProperty = new ArrayList<>();
    listProperty.add(buildPropertyDTO());
    resendCodeRequestDTO.setProperties(listProperty);
    return resendCodeRequestDTO;
}
Also used : ArrayList(java.util.ArrayList) ResendCodeRequestDTO(org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO) PropertyDTO(org.wso2.carbon.identity.user.endpoint.dto.PropertyDTO)

Aggregations

ResendCodeRequestDTO (org.wso2.carbon.identity.user.endpoint.dto.ResendCodeRequestDTO)8 PropertyDTO (org.wso2.carbon.identity.user.endpoint.dto.PropertyDTO)7 ArrayList (java.util.ArrayList)6 UserRecoveryData (org.wso2.carbon.identity.recovery.model.UserRecoveryData)4 IdentityRecoveryException (org.wso2.carbon.identity.recovery.IdentityRecoveryException)3 Test (org.testng.annotations.Test)2 NotificationResponseBean (org.wso2.carbon.identity.recovery.bean.NotificationResponseBean)2 ResendConfirmationManager (org.wso2.carbon.identity.recovery.confirmation.ResendConfirmationManager)2 UserRecoveryDataStore (org.wso2.carbon.identity.recovery.store.UserRecoveryDataStore)2 ErrorDTO (org.wso2.carbon.identity.user.endpoint.dto.ErrorDTO)2 MeResendCodeRequestDTO (org.wso2.carbon.identity.user.endpoint.dto.MeResendCodeRequestDTO)2 InternalServerErrorException (org.wso2.carbon.identity.user.endpoint.exceptions.InternalServerErrorException)2 ResolvedUserResult (org.wso2.carbon.identity.multi.attribute.login.mgt.ResolvedUserResult)1 IdentityRecoveryClientException (org.wso2.carbon.identity.recovery.IdentityRecoveryClientException)1 UserDTO (org.wso2.carbon.identity.user.endpoint.dto.UserDTO)1