Class BaseSamlUserMapper<T extends JmixSamlUserDetails>

java.lang.Object
io.jmix.saml.mapper.user.BaseSamlUserMapper<T>
Type Parameters:
T - class of Jmix user
All Implemented Interfaces:
SamlUserMapper<T>
Direct Known Subclasses:
DefaultSamlUserMapper, SynchronizingSamlUserMapper

@NullMarked public abstract class BaseSamlUserMapper<T extends JmixSamlUserDetails> extends Object implements SamlUserMapper<T>
Abstract class implements SamlUserMapper and may be used as super-class for your own SamlUserMapper.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.google.common.util.concurrent.Striped<Lock>
     
    protected SamlProperties
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    getSamlUsername(org.opensaml.saml.saml2.core.Assertion assertion)
    Extracts username from SAML assertion.
    protected abstract T
    initJmixUser(org.opensaml.saml.saml2.core.Assertion assertion)
    Returns an instance of Jmix user, which may be either a new instance or an instance loaded from the user repository.
    protected void
     
    protected void
    performAdditionalModifications(org.opensaml.saml.saml2.core.Assertion assertion, org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken, T jmixUser)
    Performs additional modifications of Jmix user instance.
    protected abstract void
    populateUserAttributes(org.opensaml.saml.saml2.core.Assertion assertion, org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken, T jmixUser)
    Fills attributes of jmixUser based on information from the assertion
    protected abstract void
    populateUserAuthorities(org.opensaml.saml.saml2.core.Assertion assertion, T jmixUser)
    Fills authorities of jmixUser based on information from the assertion
    toJmixUser(org.opensaml.saml.saml2.core.Assertion assertion, org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken)
    Returns an instance of Jmix user, which is enriched with additional data.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • samlProperties

      @Autowired protected SamlProperties samlProperties
    • locks

      protected com.google.common.util.concurrent.Striped<Lock> locks
  • Constructor Details

    • BaseSamlUserMapper

      public BaseSamlUserMapper()
  • Method Details

    • initLocks

      @PostConstruct protected void initLocks()
    • toJmixUser

      public T toJmixUser(org.opensaml.saml.saml2.core.Assertion assertion, org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken)
      Returns an instance of Jmix user, which is enriched with additional data.
      Specified by:
      toJmixUser in interface SamlUserMapper<T extends JmixSamlUserDetails>
      Parameters:
      assertion - SAML assertion
      responseToken - the object that stores information about the authentication response from SAML provider
      Returns:
      Jmix user instance
    • getSamlUsername

      protected String getSamlUsername(org.opensaml.saml.saml2.core.Assertion assertion)
      Extracts username from SAML assertion.
      Parameters:
      assertion - SAML assertion
      Returns:
      username
    • initJmixUser

      protected abstract T initJmixUser(org.opensaml.saml.saml2.core.Assertion assertion)
      Returns an instance of Jmix user, which may be either a new instance or an instance loaded from the user repository. Attributes and authorities will lately be filled in other methods. The responsibility of the current method is just to create or load an existing instance.
      Parameters:
      assertion - SAML assertion
      Returns:
      new Jmix user instance or Jmix user loaded from user repository
    • populateUserAttributes

      protected abstract void populateUserAttributes(org.opensaml.saml.saml2.core.Assertion assertion, org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken, T jmixUser)
      Fills attributes of jmixUser based on information from the assertion
      Parameters:
      assertion - SAML assertion
      responseToken - the object that stores information about the authentication response from SAML provider
      jmixUser - Jmix user instance
    • populateUserAuthorities

      protected abstract void populateUserAuthorities(org.opensaml.saml.saml2.core.Assertion assertion, T jmixUser)
      Fills authorities of jmixUser based on information from the assertion
      Parameters:
      assertion - SAML assertion
      jmixUser - Jmix user instance
    • performAdditionalModifications

      protected void performAdditionalModifications(org.opensaml.saml.saml2.core.Assertion assertion, org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken, T jmixUser)
      Performs additional modifications of Jmix user instance. Override this method in case you want to do some additional attribute values computations or if you want to do some operations with Jmix user instance, e.g., to store it in the database, like it is done in the SynchronizingSamlUserMapper
      Parameters:
      assertion - SAML assertion
      responseToken - the object that stores information about the authentication response from SAML provider
      jmixUser - Jmix user instance