Class OpenSaml5AuthenticationProvider.ResponseAuthenticationConverter
java.lang.Object
org.springframework.security.saml2.provider.service.authentication.OpenSaml5AuthenticationProvider.ResponseAuthenticationConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<OpenSaml5AuthenticationProvider.ResponseToken,Saml2Authentication>
- Enclosing class:
- OpenSaml5AuthenticationProvider
public static final class OpenSaml5AuthenticationProvider.ResponseAuthenticationConverter
extends Object
implements org.springframework.core.convert.converter.Converter<OpenSaml5AuthenticationProvider.ResponseToken,Saml2Authentication>
A default implementation of
OpenSaml5AuthenticationProvider's response
authentication converter. It will take the principal name from the
NameID element. It will also extract the
assertion attributes and session indexes. You can either configure the principal
name converter and granted authorities converter in this class or you can
post-process this class's result through delegation.- Since:
- 6.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(OpenSaml5AuthenticationProvider.ResponseToken responseToken) voidsetGrantedAuthoritiesConverter(org.springframework.core.convert.converter.Converter<org.opensaml.saml.saml2.core.Assertion, Collection<org.springframework.security.core.GrantedAuthority>> grantedAuthoritiesConverter) Use this strategy to grant authorities to a principal given the firstAssertionin the response.voidsetPrincipalNameConverter(org.springframework.core.convert.converter.Converter<org.opensaml.saml.saml2.core.Assertion, String> principalNameConverter) Use this strategy to extract the principal name from theAssertion.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
-
Constructor Details
-
ResponseAuthenticationConverter
public ResponseAuthenticationConverter()
-
-
Method Details
-
convert
- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<OpenSaml5AuthenticationProvider.ResponseToken,Saml2Authentication>
-
setPrincipalNameConverter
public void setPrincipalNameConverter(org.springframework.core.convert.converter.Converter<org.opensaml.saml.saml2.core.Assertion, String> principalNameConverter) Use this strategy to extract the principal name from theAssertion. By default, this will retrieve it from theSubject'sNameIDvalue.Note that because of this, if there is no
NameIDpresent, then the default throws an exception.- Parameters:
principalNameConverter- the conversion strategy to use
-
setGrantedAuthoritiesConverter
public void setGrantedAuthoritiesConverter(org.springframework.core.convert.converter.Converter<org.opensaml.saml.saml2.core.Assertion, Collection<org.springframework.security.core.GrantedAuthority>> grantedAuthoritiesConverter) Use this strategy to grant authorities to a principal given the firstAssertionin the response. By default, this will grantROLE_USER.- Parameters:
grantedAuthoritiesConverter- the conversion strategy to use
-