Class PowerAuthServiceClient

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean

    public class PowerAuthServiceClient
    extends org.springframework.ws.client.core.support.WebServiceGatewaySupport
    Class implementing a PowerAuth SOAP service client based on provided WSDL service description.
    Author:
    Petr Dvorak, petr@wultra.com
    • Constructor Detail

      • PowerAuthServiceClient

        public PowerAuthServiceClient()
    • Method Detail

      • initActivation

        public InitActivationResponse initActivation​(java.lang.String userId,
                                                     java.lang.Long applicationId)
        Call the initActivation method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        userId - User ID for which a new CREATED activation should be created.
        applicationId - Application ID for which a new CREATED activation should be created.
        Returns:
        InitActivationResponse
      • initActivation

        public InitActivationResponse initActivation​(java.lang.String userId,
                                                     java.lang.Long applicationId,
                                                     java.lang.Long maxFailureCount,
                                                     java.util.Date timestampActivationExpire)
        Call the initActivation method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        userId - User ID for which a new CREATED activation should be created.
        applicationId - Application ID for which a new CREATED activation should be created.
        maxFailureCount - How many failed attempts should be allowed for this activation.
        timestampActivationExpire - Timestamp until when the activation can be committed.
        Returns:
        InitActivationResponse
      • prepareActivation

        public PrepareActivationResponse prepareActivation​(java.lang.String activationCode,
                                                           java.lang.String applicationKey,
                                                           java.lang.String ephemeralPublicKey,
                                                           java.lang.String encryptedData,
                                                           java.lang.String mac)
        Call the prepareActivation method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationCode - Activation code.
        applicationKey - Application key.
        ephemeralPublicKey - Ephemeral public key for ECIES.
        encryptedData - Encrypted data for ECIES.
        mac - Mac of key and data for ECIES.
        Returns:
        PrepareActivationResponse
      • createActivation

        public CreateActivationResponse createActivation​(CreateActivationRequest request)
        Create a new activation directly, using the createActivation method of the PowerAuth Server SOAP interface.
        Parameters:
        request - Create activation request.
        Returns:
        Create activation response.
      • createActivation

        public CreateActivationResponse createActivation​(java.lang.String userId,
                                                         java.util.Date timestampActivationExpire,
                                                         java.lang.Long maxFailureCount,
                                                         java.lang.String applicationKey,
                                                         java.lang.String ephemeralPublicKey,
                                                         java.lang.String encryptedData,
                                                         java.lang.String mac)
        Call the createActivation method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        userId - User ID.
        timestampActivationExpire - Expiration timestamp for activation (optional).
        maxFailureCount - Maximum failure count (optional).
        applicationKey - Application key.
        ephemeralPublicKey - Ephemeral public key for ECIES.
        encryptedData - Encrypted data for ECIES.
        mac - Mac of key and data for ECIES.
        Returns:
        CreateActivationResponse
      • commitActivation

        public CommitActivationResponse commitActivation​(java.lang.String activationId,
                                                         java.lang.String externalUserId)
        Call the prepareActivation method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation ID for activation to be commited.
        externalUserId - User ID of user who committed the activation. Use null value if activation owner caused the change.
        Returns:
        CommitActivationResponse
      • getActivationStatus

        public GetActivationStatusResponse getActivationStatus​(java.lang.String activationId)
        Call the getActivationStatus method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation Id to lookup information for.
        Returns:
        GetActivationStatusResponse
      • getActivationListForUser

        public java.util.List<GetActivationListForUserResponse.Activations> getActivationListForUser​(java.lang.String userId)
        Call the getActivationListForUser method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        userId - User ID to fetch the activations for.
        Returns:
        List of activation instances for given user.
      • removeActivation

        public RemoveActivationResponse removeActivation​(java.lang.String activationId,
                                                         java.lang.String externalUserId)
        Call the removeActivation method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation ID of activation to be removed.
        externalUserId - User ID of user who removed the activation. Use null value if activation owner caused the change.
        Returns:
        RemoveActivationResponse
      • blockActivation

        public BlockActivationResponse blockActivation​(java.lang.String activationId,
                                                       java.lang.String reason,
                                                       java.lang.String externalUserId)
        Call the blockActivation method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation ID of activation to be blocked.
        externalUserId - User ID of user who blocked the activation. Use null value if activation owner caused the change.
        reason - Reason why activation is being blocked.
        Returns:
        BlockActivationResponse
      • unblockActivation

        public UnblockActivationResponse unblockActivation​(java.lang.String activationId,
                                                           java.lang.String externalUserId)
        Call the unblockActivation method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation ID of activation to be unblocked.
        externalUserId - User ID of user who blocked the activation. Use null value if activation owner caused the change.
        Returns:
        UnblockActivationResponse
      • unlockVault

        public VaultUnlockResponse unlockVault​(java.lang.String activationId,
                                               java.lang.String applicationKey,
                                               java.lang.String signature,
                                               SignatureType signatureType,
                                               java.lang.String signedData,
                                               java.lang.String ephemeralPublicKey,
                                               java.lang.String encryptedData,
                                               java.lang.String mac)
        Call the vaultUnlock method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation Id of an activation to be used for authentication.
        applicationKey - Application Key of an application related to the activation.
        signedData - Data to be signed encoded in format as specified by PowerAuth data normalization.
        signature - Vault opening request signature.
        signatureType - Vault opening request signature type.
        ephemeralPublicKey - Ephemeral public key for ECIES.
        encryptedData - Encrypted data for ECIES.
        mac - MAC of key and data for ECIES.
        Returns:
        VaultUnlockResponse
      • verifyOfflineSignature

        public VerifyOfflineSignatureResponse verifyOfflineSignature​(java.lang.String activationId,
                                                                     java.lang.String data,
                                                                     java.lang.String signature,
                                                                     boolean allowBiometry)
        Verify offline signature by calling verifyOfflineSignature method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation ID.
        data - Data for signature.
        signature - Signature value.
        allowBiometry - Whether POSSESSION_BIOMETRY signature type is allowed during signature verification.
        Returns:
        Offline signature verification response.
      • verifySignature

        public VerifySignatureResponse verifySignature​(java.lang.String activationId,
                                                       java.lang.String applicationKey,
                                                       java.lang.String data,
                                                       java.lang.String signature,
                                                       SignatureType signatureType,
                                                       java.lang.Long forcedSignatureVersion)
        Call the verifySignature method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation ID of activation to be used for authentication.
        applicationKey - Application Key of an application related to the activation.
        data - Data to be signed encoded in format as specified by PowerAuth data normalization.
        signature - Request signature.
        signatureType - Request signature type.
        forcedSignatureVersion - Forced signature version.
        Returns:
        Verify signature and return SOAP response with the verification results.
      • verifyECDSASignature

        public VerifyECDSASignatureResponse verifyECDSASignature​(java.lang.String activationId,
                                                                 java.lang.String data,
                                                                 java.lang.String signature)
        Call the verifyECDSASignature method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation ID of activation to be used for authentication.
        data - Data that were signed by ECDSA algorithm.
        signature - Request signature.
        Returns:
        Verify ECDSA signature and return SOAP response with the verification results.
      • getSignatureAuditLog

        public java.util.List<SignatureAuditResponse.Items> getSignatureAuditLog​(java.lang.String userId,
                                                                                 java.util.Date startingDate,
                                                                                 java.util.Date endingDate)
        Call the verifySignature method of the PowerAuth 3.0 Server SOAP interface and get signature audit log for all application of a given user.
        Parameters:
        userId - User ID to query the audit log against.
        startingDate - Limit the results to given starting date (= "newer than").
        endingDate - Limit the results to given ending date (= "older than").
        Returns:
        List of signature audit items. See: SignatureAuditResponse.Items.
      • getSignatureAuditLog

        public java.util.List<SignatureAuditResponse.Items> getSignatureAuditLog​(java.lang.String userId,
                                                                                 java.lang.Long applicationId,
                                                                                 java.util.Date startingDate,
                                                                                 java.util.Date endingDate)
        Call the verifySignature method of the PowerAuth 3.0 Server SOAP interface and get signature audit log for a single application.
        Parameters:
        userId - User ID to query the audit log against.
        applicationId - Application ID to query the audit log against.
        startingDate - Limit the results to given starting date (= "newer than").
        endingDate - Limit the results to given ending date (= "older than").
        Returns:
        List of signature audit items. See: SignatureAuditResponse.Items.
      • getActivationHistory

        public java.util.List<ActivationHistoryResponse.Items> getActivationHistory​(java.lang.String activationId,
                                                                                    java.util.Date startingDate,
                                                                                    java.util.Date endingDate)
        Call the getActivationHistory method of the PowerAuth 3.0 Server SOAP interface.
        Parameters:
        activationId - Activation ID.
        startingDate - Limit the results to given starting date (= "newer than").
        endingDate - Limit the results to given ending date (= "older than").
        Returns:
        List of activation history items. See: ActivationHistoryResponse.Items.
      • getApplicationList

        public java.util.List<GetApplicationListResponse.Applications> getApplicationList()
        Get the list of all applications that are registered in PowerAuth Server.
        Returns:
        List of applications.
      • getApplicationDetail

        public GetApplicationDetailResponse getApplicationDetail​(java.lang.Long applicationId)
        Get the detail of an application with given ID, including the version list.
        Parameters:
        applicationId - ID of an application to fetch.
        Returns:
        Application with given ID, including the version list.
      • lookupApplicationByAppKey

        public LookupApplicationByAppKeyResponse lookupApplicationByAppKey​(java.lang.String applicationKey)
        Lookup an application by application key.
        Parameters:
        applicationKey - Application key.
        Returns:
        Response with application ID.
      • createApplication

        public CreateApplicationResponse createApplication​(java.lang.String name)
        Create a new application with given name.
        Parameters:
        name - Name of the new application.
        Returns:
        Application with a given name.
      • createApplicationVersion

        public CreateApplicationVersionResponse createApplicationVersion​(java.lang.Long applicationId,
                                                                         java.lang.String versionName)
        Create a version with a given name for an application with given ID.
        Parameters:
        applicationId - ID of an application to create a version for.
        versionName - Name of the version. The value should follow some well received conventions (such as "1.0.3", for example).
        Returns:
        A new version with a given name and application key / secret.
      • unsupportApplicationVersion

        public UnsupportApplicationVersionResponse unsupportApplicationVersion​(java.lang.Long versionId)
        Cancel the support for a given application version.
        Parameters:
        versionId - Version to be unsupported.
        Returns:
        Information about success / failure.
      • supportApplicationVersion

        public SupportApplicationVersionResponse supportApplicationVersion​(java.lang.Long versionId)
        Renew the support for a given application version.
        Parameters:
        versionId - Version to be supported again.
        Returns:
        Information about success / failure.
      • createIntegration

        public CreateIntegrationResponse createIntegration​(CreateIntegrationRequest request)
        Create a new integration with given name.
        Parameters:
        request - Request specifying the integration name.
        Returns:
        New integration information.
      • createIntegration

        public CreateIntegrationResponse createIntegration​(java.lang.String name)
        Create a new integration with given name.
        Parameters:
        name - Integration name.
        Returns:
        New integration information.
      • getIntegrationList

        public java.util.List<GetIntegrationListResponse.Items> getIntegrationList()
        Get the list of integrations.
        Returns:
        List of integrations.
      • removeIntegration

        public RemoveIntegrationResponse removeIntegration​(java.lang.String id)
        Remove integration with given ID.
        Parameters:
        id - ID of integration to be removed.
        Returns:
        Removal status.
      • createCallbackUrl

        public CreateCallbackUrlResponse createCallbackUrl​(CreateCallbackUrlRequest request)
        Create a new callback URL with given request object.
        Parameters:
        request - SOAP request object with callback URL details.
        Returns:
        Information about new callback URL object.
      • createCallbackUrl

        public CreateCallbackUrlResponse createCallbackUrl​(java.lang.Long applicationId,
                                                           java.lang.String name,
                                                           java.lang.String callbackUrl)
        Create a new callback URL with given parameters.
        Parameters:
        applicationId - Application ID.
        name - Callback URL display name.
        callbackUrl - Callback URL value.
        Returns:
        Information about new callback URL object.
      • getCallbackUrlList

        public GetCallbackUrlListResponse getCallbackUrlList​(GetCallbackUrlListRequest request)
        Get the response with list of callback URL objects.
        Parameters:
        request - SOAP request object with application ID.
        Returns:
        Response with the list of all callback URLs for given application.
      • getCallbackUrlList

        public java.util.List<GetCallbackUrlListResponse.CallbackUrlList> getCallbackUrlList​(java.lang.Long applicationId)
        Get the list of callback URL objects.
        Parameters:
        applicationId - Application ID.
        Returns:
        List of all callback URLs for given application.
      • removeCallbackUrl

        public RemoveCallbackUrlResponse removeCallbackUrl​(java.lang.String callbackUrlId)
        Remove callback URL.
        Parameters:
        callbackUrlId - Callback URL ID.
        Returns:
        Information about removal status.
      • createToken

        public CreateTokenResponse createToken​(CreateTokenRequest request)
        Create a new token for basic token-based authentication.
        Parameters:
        request - Request with token information.
        Returns:
        Response with created token.
      • createToken

        public CreateTokenResponse createToken​(java.lang.String activationId,
                                               java.lang.String applicationKey,
                                               java.lang.String ephemeralPublicKey,
                                               java.lang.String encryptedData,
                                               java.lang.String mac,
                                               SignatureType signatureType)
        Create a new token for basic token-based authentication.
        Parameters:
        activationId - Activation ID for the activation that is associated with the token.
        applicationKey - Application key.
        ephemeralPublicKey - Ephemeral public key used for response encryption.
        encryptedData - Encrypted request data.
        mac - MAC computed for request key and data.
        signatureType - Type of the signature used for validating the create request.
        Returns:
        Response with created token.
      • validateToken

        public ValidateTokenResponse validateToken​(ValidateTokenRequest request)
        Validate credentials used for basic token-based authentication.
        Parameters:
        request - Credentials to validate.
        Returns:
        Response with the credentials validation status.
      • validateToken

        public ValidateTokenResponse validateToken​(java.lang.String tokenId,
                                                   java.lang.String nonce,
                                                   long timestamp,
                                                   java.lang.String tokenDigest)
        Validate credentials used for basic token-based authentication.
        Parameters:
        tokenId - Token ID.
        nonce - Random token nonce.
        timestamp - Token timestamp.
        tokenDigest - Token digest.
        Returns:
        Response with the credentials validation status.
      • removeToken

        public RemoveTokenResponse removeToken​(RemoveTokenRequest request)
        Remove token with given token ID.
        Parameters:
        request - Request with token ID.
        Returns:
        Response token removal result.
      • removeToken

        public RemoveTokenResponse removeToken​(java.lang.String tokenId,
                                               java.lang.String activationId)
        Remove token with given token ID.
        Parameters:
        tokenId - Token ID.
        activationId - ActivationId ID.
        Returns:
        Response token removal result.
      • getEciesDecryptor

        public GetEciesDecryptorResponse getEciesDecryptor​(java.lang.String activationId,
                                                           java.lang.String applicationKey,
                                                           java.lang.String ephemeralPublicKey)
        Get ECIES decryptor parameters.
        Parameters:
        activationId - Activation ID.
        applicationKey - Application key.
        ephemeralPublicKey - Ephemeral public key for ECIES.
        Returns:
        ECIES decryptor parameters.
      • startUpgrade

        public StartUpgradeResponse startUpgrade​(StartUpgradeRequest request)
        Start upgrade of activations to version 3.
        Parameters:
        request - Start upgrade request.
        Returns:
        Start upgrade response.
      • startUpgrade

        public StartUpgradeResponse startUpgrade​(java.lang.String activationId,
                                                 java.lang.String applicationKey,
                                                 java.lang.String ephemeralPublicKey,
                                                 java.lang.String encryptedData,
                                                 java.lang.String mac)
        Start upgrade of activations to version 3.
        Parameters:
        activationId - Activation ID.
        applicationKey - Application key.
        ephemeralPublicKey - Ephemeral public key used for response encryption.
        encryptedData - Encrypted request data.
        mac - MAC computed for request key and data.
        Returns:
        Start upgrade response.
      • commitUpgrade

        public CommitUpgradeResponse commitUpgrade​(CommitUpgradeRequest request)
        Commit upgrade of activations to version 3.
        Parameters:
        request - Commit upgrade request.
        Returns:
        Commit upgrade response.
      • commitUpgrade

        public CommitUpgradeResponse commitUpgrade​(java.lang.String activationId,
                                                   java.lang.String applicationKey)
        Commit upgrade of activations to version 3.
        Parameters:
        activationId - Activation ID.
        applicationKey - Application key.
        Returns:
        Commit upgrade response.
      • createRecoveryCode

        public CreateRecoveryCodeResponse createRecoveryCode​(java.lang.Long applicationId,
                                                             java.lang.String userId,
                                                             java.lang.Long pukCount)
        Create recovery code for user.
        Parameters:
        applicationId - Application ID.
        userId - User ID.
        pukCount - Number of PUKs to create.
        Returns:
        Create recovery code response.
      • confirmRecoveryCode

        public ConfirmRecoveryCodeResponse confirmRecoveryCode​(java.lang.String activationId,
                                                               java.lang.String applicationKey,
                                                               java.lang.String ephemeralPublicKey,
                                                               java.lang.String encryptedData,
                                                               java.lang.String mac)
        Confirm recovery code.
        Parameters:
        activationId - Activation ID.
        applicationKey - Application key.
        ephemeralPublicKey - Ephemeral public key for ECIES.
        encryptedData - Encrypted data for ECIES.
        mac - MAC of key and data for ECIES.
        Returns:
        Confirm recovery code response.
      • lookupRecoveryCodes

        public LookupRecoveryCodesResponse lookupRecoveryCodes​(java.lang.String userId,
                                                               java.lang.String activationId,
                                                               java.lang.Long applicationId,
                                                               RecoveryCodeStatus recoveryCodeStatus,
                                                               RecoveryPukStatus recoveryPukStatus)
        Lookup recovery codes.
        Parameters:
        userId - User ID.
        activationId - Activation ID.
        applicationId - Application ID.
        recoveryCodeStatus - Recovery code status.
        recoveryPukStatus - Recovery PUK status.
        Returns:
        Lookup recovery codes response.
      • revokeRecoveryCodes

        public RevokeRecoveryCodesResponse revokeRecoveryCodes​(java.util.List<java.lang.Long> recoveryCodeIds)
        Revoke recovery codes.
        Parameters:
        recoveryCodeIds - Identifiers of recovery codes to revoke.
        Returns:
        Revoke recovery code response.
      • createActivationUsingRecoveryCode

        public RecoveryCodeActivationResponse createActivationUsingRecoveryCode​(RecoveryCodeActivationRequest request)
        Create activation using recovery code.
        Parameters:
        request - Create activation using recovery code request.
        Returns:
        Create activation using recovery code response.
      • createActivationUsingRecoveryCode

        public RecoveryCodeActivationResponse createActivationUsingRecoveryCode​(java.lang.String recoveryCode,
                                                                                java.lang.String puk,
                                                                                java.lang.String applicationKey,
                                                                                java.lang.Long maxFailureCount,
                                                                                java.lang.String ephemeralPublicKey,
                                                                                java.lang.String encryptedData,
                                                                                java.lang.String mac)
        Create activation using recovery code.
        Parameters:
        recoveryCode - Recovery code.
        puk - Recovery PUK.
        applicationKey - Application key.
        maxFailureCount - Maximum failure count.
        ephemeralPublicKey - Ephemeral public key for ECIES.
        encryptedData - Encrypted data for ECIES.
        mac - MAC of key and data for ECIES.
        Returns:
        Create activation using recovery code response.
      • getRecoveryConfig

        public GetRecoveryConfigResponse getRecoveryConfig​(java.lang.Long applicationId)
        Get recovery configuration.
        Parameters:
        applicationId - Application ID.
        Returns:
        Get recovery configuration response.
      • updateRecoveryConfig

        public UpdateRecoveryConfigResponse updateRecoveryConfig​(java.lang.Long applicationId,
                                                                 java.lang.Boolean activationRecoveryEnabled,
                                                                 java.lang.Boolean recoveryPostcardEnabled,
                                                                 java.lang.Boolean allowMultipleRecoveryCodes,
                                                                 java.lang.String remoteRecoveryPublicKeyBase64)
        Update recovery configuration.
        Parameters:
        applicationId - Application ID.
        activationRecoveryEnabled - Whether activation recovery is enabled.
        recoveryPostcardEnabled - Whether recovery postcard is enabled.
        allowMultipleRecoveryCodes - Whether multiple recovery codes are allowed.
        remoteRecoveryPublicKeyBase64 - Base64 encoded remote public key.
        Returns:
        Update recovery configuration response.