Interface AuthenticationMapper


public interface AuthenticationMapper
This interface should be implemented when a custom bean authentication provider is implemented and used in External Flows. The authentication mapper is dedicated to a single authentication type e.q. 'custom-bean', it can support multiple Authentication implementations and ContractVersions. A list of supported contract versions can be found here: SupportedContractVersions.
This interface should be able to transfer an Authentication object between the External Flow Target and Host.

To test the implementation of the AuthenticationMapper a round trip test is adviced. First fill call the fillModel(ObjectModelCreation, Authentication) with a new ObjectModel and the custom Authentication implementation. This should fill the ObjectModel with the provided properties to reconstruct the Authentication implementation in the toAuthentication(ObjectModelRetrieval). Afterwards the two Authentication objects can be compared.
  • Method Details

    • authenticationType

      String authenticationType()
      The supported authentication type for the custom authentication implementation e.q. 'custom-bean'. The authenticationType is used to identify the AuthenticationMapper.
      Returns:
      a custom authenticationType
    • supportsContract

      boolean supportsContract(ContractVersion contractVersion)
      A function that determines if the AuthenticationMapper know how to map the custom Authentication object for the provided ContractVersion. This applies for both fillModel(ObjectModelCreation, Authentication) and toAuthentication(ObjectModelRetrieval)
      Parameters:
      contractVersion - the contract version which the AuthenticationMapper should be able to map.
      Returns:
      true if the contract version is supported otherwise false.
    • canMap

      boolean canMap(org.springframework.security.core.Authentication authentication)
      A function that determines if the Authentication implementation is supported by this AuthenticationMapper.
      Parameters:
      authentication - The to be mapped Authentication object.
      Returns:
      true if the Authentication object can be mapped otherwise false.
    • fillModel

      void fillModel(ObjectModelCreation objectModel, org.springframework.security.core.Authentication authentication)
      This function is used fill the ObjectModelCreation with the required properties of the Authentication object. The objectModel should contain enough information for the toAuthentication(ObjectModelRetrieval) to recreate the Authentication.
      Parameters:
      objectModel - the object model to be filled with the Authentication properties.
      authentication - the authentication object
    • toAuthentication

      org.springframework.security.core.Authentication toAuthentication(ObjectModelRetrieval objectModel)
      This function uses data that is provided from the fillModel(ObjectModelCreation, Authentication) function to recreate the Authentication object.
      Parameters:
      objectModel - the object model where the information to provide a Authentication is retrieved from.
      Returns:
      the reconstructed Authentication object.