Skip to content

Commit be20201

Browse files
committed
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
1 parent 029e31e commit be20201

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/WebAuthnConfigurer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.springframework.security.web.authentication.ui.DefaultResourcesFilter;
3636
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
3737
import org.springframework.security.web.csrf.CsrfToken;
38-
import org.springframework.security.web.util.matcher.AnyRequestMatcher;
3938
import org.springframework.security.web.webauthn.api.PublicKeyCredentialRpEntity;
4039
import org.springframework.security.web.webauthn.authentication.PublicKeyCredentialRequestOptionsFilter;
4140
import org.springframework.security.web.webauthn.authentication.WebAuthnAuthenticationFilter;
@@ -159,8 +158,7 @@ public void init(H http) throws Exception {
159158
ExceptionHandlingConfigurer<H> exceptions = http.getConfigurer(ExceptionHandlingConfigurer.class);
160159
if (exceptions != null) {
161160
AuthenticationEntryPoint entryPoint = new LoginUrlAuthenticationEntryPoint("/login");
162-
exceptions.defaultDeniedHandlerForMissingAuthority(
163-
(ep) -> ep.addEntryPointFor(entryPoint, AnyRequestMatcher.INSTANCE),
161+
exceptions.defaultDeniedHandlerForMissingAuthority((ep) -> ep.defaultEntryPoint(entryPoint),
164162
GrantedAuthorities.FACTOR_WEBAUTHN_AUTHORITY);
165163
}
166164
}

config/src/main/java/org/springframework/security/config/annotation/web/configurers/X509Configurer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter;
4040
import org.springframework.security.web.authentication.preauth.x509.X509PrincipalExtractor;
4141
import org.springframework.security.web.context.RequestAttributeSecurityContextRepository;
42-
import org.springframework.security.web.util.matcher.AnyRequestMatcher;
4342

4443
/**
4544
* Adds X509 based pre authentication to an application. Since validating the certificate
@@ -187,8 +186,7 @@ public void init(H http) {
187186
ExceptionHandlingConfigurer<H> exceptions = http.getConfigurer(ExceptionHandlingConfigurer.class);
188187
if (exceptions != null) {
189188
AuthenticationEntryPoint forbidden = new Http403ForbiddenEntryPoint();
190-
exceptions.defaultDeniedHandlerForMissingAuthority(
191-
(ep) -> ep.addEntryPointFor(forbidden, AnyRequestMatcher.INSTANCE),
189+
exceptions.defaultDeniedHandlerForMissingAuthority((ep) -> ep.defaultEntryPoint(forbidden),
192190
GrantedAuthorities.FACTOR_X509_AUTHORITY);
193191
}
194192
}

0 commit comments

Comments
 (0)