Search in sources :

Example 1 with ActivationStatusResponse

use of io.getlime.security.powerauth.rest.api.model.response.v3.ActivationStatusResponse in project powerauth-restful-integration by lime-company.

the class ActivationService method getActivationStatus.

/**
 * Get activation status.
 *
 * @param request Activation status request.
 * @return Activation status response.
 * @throws PowerAuthActivationException In case retrieving activation status fails.
 */
public ActivationStatusResponse getActivationStatus(ActivationStatusRequest request) throws PowerAuthActivationException {
    try {
        final String activationId = request.getActivationId();
        final String challenge = request.getChallenge();
        final GetActivationStatusResponse paResponse = powerAuthClient.getActivationStatusWithEncryptedStatusBlob(activationId, challenge);
        final ActivationStatusResponse response = new ActivationStatusResponse();
        response.setActivationId(paResponse.getActivationId());
        response.setEncryptedStatusBlob(paResponse.getEncryptedStatusBlob());
        response.setNonce(paResponse.getEncryptedStatusBlobNonce());
        if (applicationConfiguration != null) {
            final ActivationContext activationContext = activationContextConverter.fromActivationDetailResponse(paResponse);
            response.setCustomObject(applicationConfiguration.statusServiceCustomObject(activationContext));
        }
        return response;
    } catch (Exception ex) {
        logger.warn("PowerAuth activation status check failed, error: {}", ex.getMessage());
        logger.debug(ex.getMessage(), ex);
        throw new PowerAuthActivationException();
    }
}
Also used : PowerAuthActivationException(io.getlime.security.powerauth.rest.api.spring.exception.PowerAuthActivationException) ActivationContext(io.getlime.security.powerauth.rest.api.spring.model.ActivationContext) PowerAuthActivationException(io.getlime.security.powerauth.rest.api.spring.exception.PowerAuthActivationException) PowerAuthInvalidRequestException(io.getlime.security.powerauth.rest.api.spring.exception.authentication.PowerAuthInvalidRequestException) PowerAuthClientException(com.wultra.security.powerauth.client.model.error.PowerAuthClientException) PowerAuthRecoveryException(io.getlime.security.powerauth.rest.api.spring.exception.PowerAuthRecoveryException) ActivationStatusResponse(io.getlime.security.powerauth.rest.api.model.response.v3.ActivationStatusResponse)

Aggregations

PowerAuthClientException (com.wultra.security.powerauth.client.model.error.PowerAuthClientException)1 ActivationStatusResponse (io.getlime.security.powerauth.rest.api.model.response.v3.ActivationStatusResponse)1 PowerAuthActivationException (io.getlime.security.powerauth.rest.api.spring.exception.PowerAuthActivationException)1 PowerAuthRecoveryException (io.getlime.security.powerauth.rest.api.spring.exception.PowerAuthRecoveryException)1 PowerAuthInvalidRequestException (io.getlime.security.powerauth.rest.api.spring.exception.authentication.PowerAuthInvalidRequestException)1 ActivationContext (io.getlime.security.powerauth.rest.api.spring.model.ActivationContext)1