Search in sources :

Example 1 with ActivationStatusResponse

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

the class ActivationController method getActivationStatus.

/**
 * Get activation status.
 * @param request PowerAuth RESTful request with {@link ActivationStatusRequest} payload.
 * @return PowerAuth RESTful response with {@link ActivationStatusResponse} payload.
 * @throws RemoteException In case SOAP communication fails
 */
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Path("status")
public ObjectResponse<ActivationStatusResponse> getActivationStatus(ObjectRequest<ActivationStatusRequest> request) throws RemoteException, PowerAuthActivationException {
    if (request.getRequestObject() == null) {
        throw new PowerAuthActivationException();
    }
    try {
        String activationId = request.getRequestObject().getActivationId();
        PowerAuthPortServiceStub.GetActivationStatusResponse soapResponse = powerAuthClient.getActivationStatus(activationId);
        ActivationStatusResponse response = new ActivationStatusResponse();
        response.setActivationId(soapResponse.getActivationId());
        response.setEncryptedStatusBlob(soapResponse.getEncryptedStatusBlob());
        if (applicationConfiguration != null) {
            response.setCustomObject(applicationConfiguration.statusServiceCustomObject());
        }
        return new ObjectResponse<>(response);
    } catch (Exception e) {
        throw new PowerAuthActivationException();
    }
}
Also used : PowerAuthActivationException(io.getlime.security.powerauth.rest.api.base.exception.PowerAuthActivationException) PowerAuthPortServiceStub(io.getlime.powerauth.soap.PowerAuthPortServiceStub) ObjectResponse(io.getlime.core.rest.model.base.response.ObjectResponse) PowerAuthAuthenticationException(io.getlime.security.powerauth.rest.api.base.exception.PowerAuthAuthenticationException) RemoteException(java.rmi.RemoteException) PowerAuthActivationException(io.getlime.security.powerauth.rest.api.base.exception.PowerAuthActivationException) ActivationStatusResponse(io.getlime.security.powerauth.rest.api.model.response.ActivationStatusResponse)

Example 2 with ActivationStatusResponse

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

the class ActivationController method getActivationStatus.

/**
 * Get activation status.
 * @param request PowerAuth RESTful request with {@link ActivationStatusRequest} payload.
 * @return PowerAuth RESTful response with {@link ActivationStatusResponse} payload.
 */
@RequestMapping(value = "status", method = RequestMethod.POST)
@ResponseBody
public ObjectResponse<ActivationStatusResponse> getActivationStatus(@RequestBody ObjectRequest<ActivationStatusRequest> request) throws PowerAuthActivationException {
    try {
        String activationId = request.getRequestObject().getActivationId();
        GetActivationStatusResponse soapResponse = powerAuthClient.getActivationStatus(activationId);
        ActivationStatusResponse response = new ActivationStatusResponse();
        response.setActivationId(soapResponse.getActivationId());
        response.setEncryptedStatusBlob(soapResponse.getEncryptedStatusBlob());
        if (applicationConfiguration != null) {
            response.setCustomObject(applicationConfiguration.statusServiceCustomObject());
        }
        return new ObjectResponse<>(response);
    } catch (Exception ex) {
        throw new PowerAuthActivationException();
    }
}
Also used : PowerAuthActivationException(io.getlime.security.powerauth.rest.api.base.exception.PowerAuthActivationException) GetActivationStatusResponse(io.getlime.powerauth.soap.GetActivationStatusResponse) ObjectResponse(io.getlime.core.rest.model.base.response.ObjectResponse) PowerAuthAuthenticationException(io.getlime.security.powerauth.rest.api.base.exception.PowerAuthAuthenticationException) PowerAuthActivationException(io.getlime.security.powerauth.rest.api.base.exception.PowerAuthActivationException) ActivationStatusResponse(io.getlime.security.powerauth.rest.api.model.response.ActivationStatusResponse) GetActivationStatusResponse(io.getlime.powerauth.soap.GetActivationStatusResponse)

Aggregations

ObjectResponse (io.getlime.core.rest.model.base.response.ObjectResponse)2 PowerAuthActivationException (io.getlime.security.powerauth.rest.api.base.exception.PowerAuthActivationException)2 PowerAuthAuthenticationException (io.getlime.security.powerauth.rest.api.base.exception.PowerAuthAuthenticationException)2 ActivationStatusResponse (io.getlime.security.powerauth.rest.api.model.response.ActivationStatusResponse)2 GetActivationStatusResponse (io.getlime.powerauth.soap.GetActivationStatusResponse)1 PowerAuthPortServiceStub (io.getlime.powerauth.soap.PowerAuthPortServiceStub)1 RemoteException (java.rmi.RemoteException)1