FACTOR uses defaultEntryPoint when possible
Previously they used addEntryPointFor(entryPoint, AnyRequestMatcher.INSTANCE) to work around gh-17955. They now can use defaultEntryPoint which is more concise. Issue gh-gh-17955
This commit is contained in:
parent
029e31ebe8
commit
be20201bf7
|
@ -35,7 +35,6 @@ import org.springframework.security.web.authentication.ui.DefaultLoginPageGenera
|
||||||
import org.springframework.security.web.authentication.ui.DefaultResourcesFilter;
|
import org.springframework.security.web.authentication.ui.DefaultResourcesFilter;
|
||||||
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
|
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
|
||||||
import org.springframework.security.web.csrf.CsrfToken;
|
import org.springframework.security.web.csrf.CsrfToken;
|
||||||
import org.springframework.security.web.util.matcher.AnyRequestMatcher;
|
|
||||||
import org.springframework.security.web.webauthn.api.PublicKeyCredentialRpEntity;
|
import org.springframework.security.web.webauthn.api.PublicKeyCredentialRpEntity;
|
||||||
import org.springframework.security.web.webauthn.authentication.PublicKeyCredentialRequestOptionsFilter;
|
import org.springframework.security.web.webauthn.authentication.PublicKeyCredentialRequestOptionsFilter;
|
||||||
import org.springframework.security.web.webauthn.authentication.WebAuthnAuthenticationFilter;
|
import org.springframework.security.web.webauthn.authentication.WebAuthnAuthenticationFilter;
|
||||||
|
@ -159,8 +158,7 @@ public class WebAuthnConfigurer<H extends HttpSecurityBuilder<H>>
|
||||||
ExceptionHandlingConfigurer<H> exceptions = http.getConfigurer(ExceptionHandlingConfigurer.class);
|
ExceptionHandlingConfigurer<H> exceptions = http.getConfigurer(ExceptionHandlingConfigurer.class);
|
||||||
if (exceptions != null) {
|
if (exceptions != null) {
|
||||||
AuthenticationEntryPoint entryPoint = new LoginUrlAuthenticationEntryPoint("/login");
|
AuthenticationEntryPoint entryPoint = new LoginUrlAuthenticationEntryPoint("/login");
|
||||||
exceptions.defaultDeniedHandlerForMissingAuthority(
|
exceptions.defaultDeniedHandlerForMissingAuthority((ep) -> ep.defaultEntryPoint(entryPoint),
|
||||||
(ep) -> ep.addEntryPointFor(entryPoint, AnyRequestMatcher.INSTANCE),
|
|
||||||
GrantedAuthorities.FACTOR_WEBAUTHN_AUTHORITY);
|
GrantedAuthorities.FACTOR_WEBAUTHN_AUTHORITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.springframework.security.web.authentication.preauth.x509.SubjectDnX50
|
||||||
import org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter;
|
import org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter;
|
||||||
import org.springframework.security.web.authentication.preauth.x509.X509PrincipalExtractor;
|
import org.springframework.security.web.authentication.preauth.x509.X509PrincipalExtractor;
|
||||||
import org.springframework.security.web.context.RequestAttributeSecurityContextRepository;
|
import org.springframework.security.web.context.RequestAttributeSecurityContextRepository;
|
||||||
import org.springframework.security.web.util.matcher.AnyRequestMatcher;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds X509 based pre authentication to an application. Since validating the certificate
|
* Adds X509 based pre authentication to an application. Since validating the certificate
|
||||||
|
@ -187,8 +186,7 @@ public final class X509Configurer<H extends HttpSecurityBuilder<H>>
|
||||||
ExceptionHandlingConfigurer<H> exceptions = http.getConfigurer(ExceptionHandlingConfigurer.class);
|
ExceptionHandlingConfigurer<H> exceptions = http.getConfigurer(ExceptionHandlingConfigurer.class);
|
||||||
if (exceptions != null) {
|
if (exceptions != null) {
|
||||||
AuthenticationEntryPoint forbidden = new Http403ForbiddenEntryPoint();
|
AuthenticationEntryPoint forbidden = new Http403ForbiddenEntryPoint();
|
||||||
exceptions.defaultDeniedHandlerForMissingAuthority(
|
exceptions.defaultDeniedHandlerForMissingAuthority((ep) -> ep.defaultEntryPoint(forbidden),
|
||||||
(ep) -> ep.addEntryPointFor(forbidden, AnyRequestMatcher.INSTANCE),
|
|
||||||
GrantedAuthorities.FACTOR_X509_AUTHORITY);
|
GrantedAuthorities.FACTOR_X509_AUTHORITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue