Search in sources :

Example 1 with PrepareActivationResponse

use of io.getlime.powerauth.soap.PrepareActivationResponse in project powerauth-restful-integration by lime-company.

the class ActivationController method createActivation.

/**
 * Create a new activation.
 * @param request PowerAuth RESTful request with {@link ActivationCreateRequest} payload.
 * @return PowerAuth RESTful response with {@link ActivationCreateResponse} payload.
 */
@RequestMapping(value = "create", method = RequestMethod.POST)
@ResponseBody
public ObjectResponse<ActivationCreateResponse> createActivation(@RequestBody ObjectRequest<ActivationCreateRequest> request) throws PowerAuthActivationException {
    try {
        String activationIDShort = request.getRequestObject().getActivationIdShort();
        String activationNonce = request.getRequestObject().getActivationNonce();
        String cDevicePublicKey = request.getRequestObject().getEncryptedDevicePublicKey();
        String activationName = request.getRequestObject().getActivationName();
        String extras = request.getRequestObject().getExtras();
        String applicationKey = request.getRequestObject().getApplicationKey();
        String applicationSignature = request.getRequestObject().getApplicationSignature();
        String clientEphemeralKey = request.getRequestObject().getEphemeralPublicKey();
        PrepareActivationResponse soapResponse = powerAuthClient.prepareActivation(activationIDShort, activationName, activationNonce, clientEphemeralKey, cDevicePublicKey, extras, applicationKey, applicationSignature);
        ActivationCreateResponse response = new ActivationCreateResponse();
        response.setActivationId(soapResponse.getActivationId());
        response.setActivationNonce(soapResponse.getActivationNonce());
        response.setEncryptedServerPublicKey(soapResponse.getEncryptedServerPublicKey());
        response.setEncryptedServerPublicKeySignature(soapResponse.getEncryptedServerPublicKeySignature());
        response.setEphemeralPublicKey(soapResponse.getEphemeralPublicKey());
        return new ObjectResponse<>(response);
    } catch (Exception ex) {
        throw new PowerAuthActivationException();
    }
}
Also used : PrepareActivationResponse(io.getlime.powerauth.soap.PrepareActivationResponse) PowerAuthActivationException(io.getlime.security.powerauth.rest.api.base.exception.PowerAuthActivationException) ActivationCreateResponse(io.getlime.security.powerauth.rest.api.model.response.ActivationCreateResponse) 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)

Aggregations

ObjectResponse (io.getlime.core.rest.model.base.response.ObjectResponse)1 PrepareActivationResponse (io.getlime.powerauth.soap.PrepareActivationResponse)1 PowerAuthActivationException (io.getlime.security.powerauth.rest.api.base.exception.PowerAuthActivationException)1 PowerAuthAuthenticationException (io.getlime.security.powerauth.rest.api.base.exception.PowerAuthAuthenticationException)1 ActivationCreateResponse (io.getlime.security.powerauth.rest.api.model.response.ActivationCreateResponse)1