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
Modifier and Type Method Description default voidactivationWasCommitted(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String activationId, String userId, Long appId, ActivationType activationType, Map<String,Object> context)Method is called when activation commit succeeds.default voidactivationWasRemoved(String activationId, String userId, Long appId)Method is called after activation was just removed using the standard removal endpoint.default List<String>getActivationFlags(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String activationId, String userId, Long appId, ActivationType activationType, Map<String,Object> context)Get activation flags which should be saved for the created activation.default IntegergetMaxFailedAttemptCount(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String userId, ActivationType activationType, Map<String,Object> context)Get maximum failed attempt count for activations.default LonggetValidityPeriodDuringActivation(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String userId, ActivationType activationType, Map<String,Object> context)Get length of the period of activation record validity during activation in milliseconds.StringlookupUserIdForAttributes(Map<String,String> identityAttributes, Map<String,Object> context)This method is responsible for looking user ID up based on a provided set of identity attributes.default Map<String,Object>processCustomActivationAttributes(Map<String,Object> customAttributes, String activationId, String userId, Long appId, ActivationType activationType, Map<String,Object> context)Process custom attributes, in any way that is suitable for the purpose of your application.default booleanshouldAutoCommitActivation(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String activationId, String userId, Long appId, ActivationType activationType, Map<String,Object> context)Variable that specifies if the activation should be automatically committed based on provided attributes.default booleanshouldRevokeRecoveryCodeOnRemove(String activationId, String userId, Long appId)Method that indicates if the recovery codes should be revoked when an activation is removed.
-
Method Details
-
lookupUserIdForAttributes
String lookupUserIdForAttributes(Map<String,String> identityAttributes, Map<String,Object> context) throws PowerAuthActivationExceptionThis 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.context- Context for passing parameters between activation provider calls.- Returns:
- User ID value.
- Throws:
PowerAuthActivationException- In case of error in custom activation business logic that should terminate the rest of the activation.
-
processCustomActivationAttributes
default Map<String,Object> processCustomActivationAttributes(Map<String,Object> customAttributes, String activationId, String userId, Long appId, ActivationType activationType, Map<String,Object> context) throws PowerAuthActivationExceptionProcess custom attributes, in any way that is suitable for the purpose of your application.
This method is called for all activation types. Default implementation returns unmodified attributes.- 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.appId- Application ID of the application associated to the activation.activationType- Activation type.context- Context for passing parameters between activation provider calls.- 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
default boolean shouldAutoCommitActivation(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String activationId, String userId, Long appId, ActivationType activationType, Map<String,Object> context) throws PowerAuthActivationExceptionVariable 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 PENDING_COMMIT state.
Note that this setting only affects CUSTOM or RECOVERY activation types. On CODE activation type, auto-commit is always disabled. Default implementation returns false.- 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.appId- Application ID of the application associated to the activation.activationType- Activation type.context- Context for passing parameters between activation provider calls.- 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
default void activationWasCommitted(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String activationId, String userId, Long appId, ActivationType activationType, Map<String,Object> context) throws PowerAuthActivationExceptionMethod 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. Default implementation is no-op.- 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.appId- Application ID of the application associated to the activation.activationType- Activation type.context- Context for passing parameters between activation provider calls.- Throws:
PowerAuthActivationException- In case of error in custom activation business logic that should terminate the rest of the activation.
-
shouldRevokeRecoveryCodeOnRemove
Method that indicates if the recovery codes should be revoked when an activation is removed.- Parameters:
activationId- Activation ID.userId- User ID.appId- Application ID.- Returns:
- True in case the recovery codes should be revoked on remove, false otherwise.
-
activationWasRemoved
default void activationWasRemoved(String activationId, String userId, Long appId) throws PowerAuthActivationExceptionMethod is called after activation was just removed using the standard removal endpoint.
This method is called for all activations. Default implementation is no-op.- Parameters:
activationId- Activation ID.userId- User ID.appId- Application ID.- Throws:
PowerAuthActivationException- In case of error in custom activation business logic that should terminate the rest of the activation.
-
getMaxFailedAttemptCount
default Integer getMaxFailedAttemptCount(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String userId, ActivationType activationType, Map<String,Object> context) throws PowerAuthActivationExceptionGet 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. Default implementation returns null (use the server configured value).- Parameters:
identityAttributes- Identity related attributes.customAttributes- Custom attributes, not related to identity.userId- User ID of user who created the activation.activationType- Activation type.context- Context for passing parameters between activation provider calls.- 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
default Long getValidityPeriodDuringActivation(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String userId, ActivationType activationType, Map<String,Object> context) throws PowerAuthActivationExceptionGet 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. Default implementation returns null (use the server configured value).- Parameters:
identityAttributes- Identity related attributes.customAttributes- Custom attributes, not related to identity.userId- User ID of user who created the activation.activationType- Activation type.context- Context for passing parameters between activation provider calls.- 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.
-
getActivationFlags
default List<String> getActivationFlags(Map<String,String> identityAttributes, Map<String,Object> customAttributes, String activationId, String userId, Long appId, ActivationType activationType, Map<String,Object> context)Get activation flags which should be saved for the created activation.- Parameters:
identityAttributes- Identity related attributes.customAttributes- Custom attributes, not related to identity.activationId- Activation ID.userId- User ID of user who created the activation.appId- Application ID of the application associated to the activation.activationType- Activation type.context- Context for passing parameters between activation provider calls.- Returns:
- List of activation flags.
-