Package io.jmix.saml.mapper.user
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
FieldsModifier and TypeFieldDescriptionprotected com.google.common.util.concurrent.Striped<Lock> protected SamlProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetSamlUsername(org.opensaml.saml.saml2.core.Assertion assertion) Extracts username from SAML assertion.protected abstract TinitJmixUser(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 voidprotected voidperformAdditionalModifications(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 voidpopulateUserAttributes(org.opensaml.saml.saml2.core.Assertion assertion, org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken, T jmixUser) Fills attributes ofjmixUserbased on information from theassertionprotected abstract voidpopulateUserAuthorities(org.opensaml.saml.saml2.core.Assertion assertion, T jmixUser) Fills authorities ofjmixUserbased on information from theassertiontoJmixUser(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.
-
Field Details
-
samlProperties
-
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:
toJmixUserin interfaceSamlUserMapper<T extends JmixSamlUserDetails>- Parameters:
assertion- SAML assertionresponseToken- the object that stores information about the authentication response from SAML provider- Returns:
- Jmix user instance
-
getSamlUsername
Extracts username from SAML assertion.- Parameters:
assertion- SAML assertion- Returns:
- username
-
initJmixUser
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 ofjmixUserbased on information from theassertion- Parameters:
assertion- SAML assertionresponseToken- the object that stores information about the authentication response from SAML providerjmixUser- Jmix user instance
-
populateUserAuthorities
protected abstract void populateUserAuthorities(org.opensaml.saml.saml2.core.Assertion assertion, T jmixUser) Fills authorities ofjmixUserbased on information from theassertion- Parameters:
assertion- SAML assertionjmixUser- 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 theSynchronizingSamlUserMapper- Parameters:
assertion- SAML assertionresponseToken- the object that stores information about the authentication response from SAML providerjmixUser- Jmix user instance
-