Package swiss.trustbroker.oidc.opensaml5
Class OpenSaml5AuthenticationTokenConverter
java.lang.Object
swiss.trustbroker.oidc.opensaml5.OpenSaml5AuthenticationTokenConverter
- All Implemented Interfaces:
org.springframework.security.web.authentication.AuthenticationConverter
public final class OpenSaml5AuthenticationTokenConverter
extends Object
implements org.springframework.security.web.authentication.AuthenticationConverter
An
AuthenticationConverter that generates a Saml2AuthenticationToken
appropriate for authenticated a SAML 2.0 Assertion against an
AuthenticationManager.- Since:
- 6.1
-
Constructor Summary
ConstructorsConstructorDescriptionOpenSaml5AuthenticationTokenConverter(org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository registrations) Constructs aOpenSaml5AuthenticationTokenConvertergiven a repository forRelyingPartyRegistrations -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationTokenconvert(jakarta.servlet.http.HttpServletRequest request) Resolve an authentication request from the givenHttpServletRequest.voidsetAuthenticationRequestRepository(org.springframework.security.saml2.provider.service.web.Saml2AuthenticationRequestRepository<org.springframework.security.saml2.provider.service.authentication.AbstractSaml2AuthenticationRequest> authenticationRequestRepository) Use the givenSaml2AuthenticationRequestRepositoryto load authentication request.voidsetRequestMatcher(org.springframework.security.web.util.matcher.RequestMatcher requestMatcher) Use the givenRequestMatcherto match the request.
-
Constructor Details
-
OpenSaml5AuthenticationTokenConverter
public OpenSaml5AuthenticationTokenConverter(org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository registrations) Constructs aOpenSaml5AuthenticationTokenConvertergiven a repository forRelyingPartyRegistrations- Parameters:
registrations- the repository forRelyingPartyRegistrationsRelyingPartyRegistrations
-
-
Method Details
-
convert
public org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationToken convert(jakarta.servlet.http.HttpServletRequest request) Resolve an authentication request from the givenHttpServletRequest.First uses the configured
RequestMatcherto deduce whether an authentication request is being made and optionally for whichregistrationId.If there is an associated
<saml2:AuthnRequest>, then theregistrationIdis looked up and used.If a
registrationIdis found in the request, then it is looked up and used. In that case, if none is found aSaml2AuthenticationExceptionis thrown.Finally, if no
registrationIdis found in the request, then the code attempts to resolve theRelyingPartyRegistrationfrom the SAML Response's Issuer.- Specified by:
convertin interfaceorg.springframework.security.web.authentication.AuthenticationConverter- Parameters:
request- the HTTP request- Returns:
- the
Saml2AuthenticationTokenauthentication request - Throws:
org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationException- if theRequestMatcherspecifies a non-existentregistrationId
-
setAuthenticationRequestRepository
public void setAuthenticationRequestRepository(org.springframework.security.saml2.provider.service.web.Saml2AuthenticationRequestRepository<org.springframework.security.saml2.provider.service.authentication.AbstractSaml2AuthenticationRequest> authenticationRequestRepository) Use the givenSaml2AuthenticationRequestRepositoryto load authentication request.- Parameters:
authenticationRequestRepository- theSaml2AuthenticationRequestRepositoryto use
-
setRequestMatcher
public void setRequestMatcher(org.springframework.security.web.util.matcher.RequestMatcher requestMatcher) Use the givenRequestMatcherto match the request.- Parameters:
requestMatcher- theRequestMatcherto use
-