Class X509ChainCustomizer
java.lang.Object
com.irurueta.authserver.authorization.api.web.x509.X509ChainCustomizer
- All Implemented Interfaces:
LoginChainCustomizer
Adds the sign-in with a client certificate to the login/UI chain through
http.x509(...). The filter only
looks at POST /login/x509, the form of X509LoginMethodFragment on the login page, which carries the
CSRF token like every other form of the chain; the CSRF filter runs before the X.509 one, so a cross-site page can
never make a browser sign in with its certificate. The form posts to the TLS port that requests a certificate (or
to the proxy that forwards one); every other request of the chain is untouched, and GET /login/x509 is not
a sign-in at all (it is not opened, so it ends with the chain's catch-all rule). A certificate that is bound to an
account signs it in and resumes the interrupted request, anything else goes back to the login page. The path is
open to everybody, because it is where the certificate is checked. When a proxy may forward the certificate,
ForwardedCertificateFilter runs first. Once the chain is configured, the success handler gets the chain's
session authentication strategy, the one the form login uses.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classHands the session authentication strategy of the chain to the success handler. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringWhere a failed sign-in goes.private final X509LoginFilterThe filter that authenticates the certificate.private final ForwardedCertificateFilterThe filter that reads a forwarded certificate, ornullwhen the transport is off.static final StringPath of the sign-in with a certificate, which is served by the security filter.static final intOrder of the customizer: after the social login one.private final org.springframework.security.web.authentication.preauth.x509.X509PrincipalExtractorTakes the principal of the certificate.private final X509AuthenticationSuccessHandlerCompletes the sign-in.private final org.springframework.security.core.userdetails.AuthenticationUserDetailsService<org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken> Loads the account of the certificate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcustomize(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Customizes the login/UI chain.private voidprepare(X509LoginFilter loginFilter, org.springframework.security.web.util.matcher.RequestMatcher loginRequest, org.springframework.security.config.annotation.web.builders.HttpSecurity http) Sets up the filter, which thex509configurer takes as it is.
-
Field Details
-
ORDER
public static final int ORDEROrder of the customizer: after the social login one.- See Also:
-
LOGIN_PATH
Path of the sign-in with a certificate, which is served by the security filter.- See Also:
-
FAILURE_URL
Where a failed sign-in goes.- See Also:
-
filter
The filter that authenticates the certificate. -
principalExtractor
private final org.springframework.security.web.authentication.preauth.x509.X509PrincipalExtractor principalExtractorTakes the principal of the certificate. -
userDetailsService
private final org.springframework.security.core.userdetails.AuthenticationUserDetailsService<org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken> userDetailsServiceLoads the account of the certificate. -
forwardedFilter
The filter that reads a forwarded certificate, ornullwhen the transport is off. -
successHandler
Completes the sign-in.
-
-
Constructor Details
-
X509ChainCustomizer
public X509ChainCustomizer()
-
-
Method Details
-
customize
public void customize(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Customizes the login/UI chain.- Specified by:
customizein interfaceLoginChainCustomizer- Parameters:
http- security builder of the chain.
-
prepare
private void prepare(X509LoginFilter loginFilter, org.springframework.security.web.util.matcher.RequestMatcher loginRequest, org.springframework.security.config.annotation.web.builders.HttpSecurity http) Sets up the filter, which thex509configurer takes as it is.- Parameters:
loginFilter- the filter.loginRequest- matcher of the sign-in requests.http- security builder of the chain, whose authentication manager the filter uses once built.
-