Interface CustomActivationProvider


  • public interface CustomActivationProvider
    Interface which enables implementation of custom activations. The interface defines a method for obtaining a user ID based on arbitrary identity attributes, processing of custom activation attributes and configuration of auto-commit mode.
    Author:
    Petr Dvorak, petr@wultra.com, Roman Strobl, roman.strobl@wultra.com
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void activationWasCommitted​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes, java.util.Map<java.lang.String,​java.lang.Object> customAttributes, java.lang.String activationId, java.lang.String userId, io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
      Method is called when activation commit succeeds.
      java.lang.Integer getMaxFailedAttemptCount​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes, java.util.Map<java.lang.String,​java.lang.Object> customAttributes, java.lang.String userId, io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
      Get maximum failed attempt count for activations.
      java.lang.Integer getValidityPeriodDuringActivation​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes, java.util.Map<java.lang.String,​java.lang.Object> customAttributes, java.lang.String userId, io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
      Get length of the period of activation record validity during activation in milliseconds.
      java.lang.String lookupUserIdForAttributes​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes)
      This method is responsible for looking user ID up based on a provided set of identity attributes.
      java.util.Map<java.lang.String,​java.lang.Object> processCustomActivationAttributes​(java.util.Map<java.lang.String,​java.lang.Object> customAttributes, java.lang.String activationId, java.lang.String userId, io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
      Process custom attributes, in any way that is suitable for the purpose of your application.
      boolean shouldAutoCommitActivation​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes, java.util.Map<java.lang.String,​java.lang.Object> customAttributes, java.lang.String activationId, java.lang.String userId, io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
      Variable that specifies if the activation should be automatically committed based on provided attributes.
    • Method Detail

      • lookupUserIdForAttributes

        java.lang.String lookupUserIdForAttributes​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes)
                                            throws PowerAuthActivationException
        This method is responsible for looking user ID up based on a provided set of identity attributes.

        This method is called for the CUSTOM activation type only.
        Parameters:
        identityAttributes - Attributes that uniquely identify user with given ID.
        Returns:
        User ID value.
        Throws:
        PowerAuthActivationException - In case of error in custom activation business logic that should terminate the rest of the activation.
      • processCustomActivationAttributes

        java.util.Map<java.lang.String,​java.lang.Object> processCustomActivationAttributes​(java.util.Map<java.lang.String,​java.lang.Object> customAttributes,
                                                                                                 java.lang.String activationId,
                                                                                                 java.lang.String userId,
                                                                                                 io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
                                                                                          throws PowerAuthActivationException
        Process custom attributes, in any way that is suitable for the purpose of your application.

        This method is called for all activation types.
        Parameters:
        customAttributes - Custom attributes (not related to identity) to be processed.
        activationId - Activation ID of created activation.
        userId - User ID of user who created the activation.
        activationType - Activation type.
        Returns:
        Custom attributes after processing.
        Throws:
        PowerAuthActivationException - In case of error in custom activation business logic that should terminate the rest of the activation.
      • shouldAutoCommitActivation

        boolean shouldAutoCommitActivation​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes,
                                           java.util.Map<java.lang.String,​java.lang.Object> customAttributes,
                                           java.lang.String activationId,
                                           java.lang.String userId,
                                           io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
                                    throws PowerAuthActivationException
        Variable that specifies if the activation should be automatically committed based on provided attributes. Return true in case you would like to create an activation that is ready to be used for signing (ACTIVE), and false for the cases when you need activation to remain in OTP_USED state.

        Note that this setting only affects CUSTOM or RECOVERY activation types. On CODE activation type, auto-commit is always disabled.
        Parameters:
        identityAttributes - Identity related attributes.
        customAttributes - Custom attributes, not related to identity.
        activationId - Activation ID of created activation.
        userId - User ID of user who created the activation.
        activationType - Activation type.
        Returns:
        True in case activation should be committed, false otherwise.
        Throws:
        PowerAuthActivationException - In case of error in custom activation business logic that should terminate the rest of the activation.
      • activationWasCommitted

        void activationWasCommitted​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes,
                                    java.util.Map<java.lang.String,​java.lang.Object> customAttributes,
                                    java.lang.String activationId,
                                    java.lang.String userId,
                                    io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
                             throws PowerAuthActivationException
        Method is called when activation commit succeeds.

        Note that this method is only called for CUSTOM or RECOVERY activation types, and only in the case activation was successfully committed on the server side. Method is not called in case commit fails on server. On CODE activation type, auto-commit is always disabled and hence this method is not called.
        Parameters:
        identityAttributes - Identity related attributes.
        customAttributes - Custom attributes, not related to identity.
        activationId - Activation ID of created activation.
        userId - User ID of user who created the activation.
        activationType - Activation type.
        Throws:
        PowerAuthActivationException - In case of error in custom activation business logic that should terminate the rest of the activation.
      • getMaxFailedAttemptCount

        java.lang.Integer getMaxFailedAttemptCount​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes,
                                                   java.util.Map<java.lang.String,​java.lang.Object> customAttributes,
                                                   java.lang.String userId,
                                                   io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
                                            throws PowerAuthActivationException
        Get maximum failed attempt count for activations. Use null value for using value which is configured on PowerAuth server.

        Note that this method is only called for CUSTOM or RECOVERY activation types, since for CODE activation, the number of max. failed attempts is set earlier while creating the activation code.
        Parameters:
        identityAttributes - Identity related attributes.
        customAttributes - Custom attributes, not related to identity.
        userId - User ID of user who created the activation.
        activationType - Activation type.
        Returns:
        Maximum failed attempt count for activations.
        Throws:
        PowerAuthActivationException - In case of error in custom activation business logic that should terminate the rest of the activation.
      • getValidityPeriodDuringActivation

        java.lang.Integer getValidityPeriodDuringActivation​(java.util.Map<java.lang.String,​java.lang.String> identityAttributes,
                                                            java.util.Map<java.lang.String,​java.lang.Object> customAttributes,
                                                            java.lang.String userId,
                                                            io.getlime.security.powerauth.rest.api.model.entity.ActivationType activationType)
                                                     throws PowerAuthActivationException
        Get length of the period of activation record validity during activation in milliseconds. Use null value for using value which is configured on PowerAuth server.

        Note that this method is only called for CUSTOM or RECOVERY activation types, since for CODE activation, the expiration period for activation is set earlier while creating the activation code.
        Parameters:
        identityAttributes - Identity related attributes.
        customAttributes - Custom attributes, not related to identity.
        userId - User ID of user who created the activation.
        activationType - Activation type.
        Returns:
        Period in milliseconds during which activation is valid before it expires.
        Throws:
        PowerAuthActivationException - In case of error in custom activation business logic that should terminate the rest of the activation.