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

    Fields
    Modifier and Type
    Field
    Description
    protected final SamlUserMapper<? extends JmixSamlUserDetails>
     
    protected org.springframework.security.core.userdetails.UserDetailsChecker
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Validates the account status of the mapped user.
    org.springframework.security.saml2.provider.service.authentication.Saml2Authentication
    convert(org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken responseToken)
     
    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.
    void
    setUserDetailsChecker(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, wait

    Methods inherited from interface org.springframework.core.convert.converter.Converter

    andThen
  • Field Details

    • samlUserMapper

      protected final SamlUserMapper<? extends JmixSamlUserDetails> samlUserMapper
    • userDetailsChecker

      protected org.springframework.security.core.userdetails.UserDetailsChecker userDetailsChecker
  • Constructor Details

  • 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:
      convert in interface org.springframework.core.convert.converter.Converter<org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseToken,org.springframework.security.saml2.provider.service.authentication.Saml2Authentication>
    • checkUserDetails

      protected void checkUserDetails(JmixSamlUserDetails userDetails)
      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 of OpenSaml5AuthenticationProvider does.