Package io.jmix.saml.converter
Class SamlResponseAuthenticationConverter
java.lang.Object
io.jmix.saml.converter.SamlResponseAuthenticationConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken,org.springframework.security.saml2.provider.service.authentication.Saml2Authentication>
public class SamlResponseAuthenticationConverter
extends Object
implements org.springframework.core.convert.converter.Converter<org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken,org.springframework.security.saml2.provider.service.authentication.Saml2Authentication>
Converter that converts SAML response token to
Saml2Authentication object.
It constructs JmixSamlUserDetails from SAML assertion and sets it as authentication principal.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SamlUserMapper<? extends JmixSamlUserDetails> protected org.springframework.security.core.userdetails.UserDetailsChecker -
Constructor Summary
ConstructorsConstructorDescriptionSamlResponseAuthenticationConverter(SamlUserMapper<? extends JmixSamlUserDetails> samlUserMapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckUserDetails(JmixSamlUserDetails userDetails) Validates the account status of the mapped user.org.springframework.security.saml2.provider.service.authentication.Saml2Authenticationconvert(org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken) protected @Nullable org.opensaml.saml.saml2.core.AssertiongetAssertion(org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken) Extracts the assertion the user is mapped from.voidsetUserDetailsChecker(org.springframework.security.core.userdetails.UserDetailsChecker userDetailsChecker) Sets the checker used to validate the account status of the mapped user.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Field Details
-
samlUserMapper
-
userDetailsChecker
protected org.springframework.security.core.userdetails.UserDetailsChecker userDetailsChecker
-
-
Constructor Details
-
SamlResponseAuthenticationConverter
public SamlResponseAuthenticationConverter(SamlUserMapper<? extends JmixSamlUserDetails> samlUserMapper)
-
-
Method Details
-
setUserDetailsChecker
public void setUserDetailsChecker(org.springframework.security.core.userdetails.UserDetailsChecker userDetailsChecker) Sets the checker used to validate the account status of the mapped user. By default, disabled, locked and expired users are rejected. -
convert
public org.springframework.security.saml2.provider.service.authentication.Saml2Authentication convert(org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken) - Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken,org.springframework.security.saml2.provider.service.authentication.Saml2Authentication>
-
checkUserDetails
Validates the account status of the mapped user. Even though the identity provider has authenticated the user successfully, a user that is disabled, locked or expired in the Jmix application must not log in.- Throws:
org.springframework.security.authentication.AccountStatusException- if the user must not log in
-
getAssertion
protected @Nullable org.opensaml.saml.saml2.core.Assertion getAssertion(org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken) Extracts the assertion the user is mapped from. The default implementation takes the first assertion of the response, like the default converter ofOpenSaml5AuthenticationProviderdoes.
-