Skip to content

Commit 61c80bc

Browse files
committed
Move Saml2 Authentication Filters
Closes gh-8819
1 parent 48e31f8 commit 61c80bc

File tree

12 files changed

+20
-22
lines changed

12 files changed

+20
-22
lines changed

Diff for: config/src/main/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ final class FilterOrderRegistration {
8585
"org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter",
8686
order.next());
8787
this.filterToOrder.put(
88-
"org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationRequestFilter",
88+
"org.springframework.security.saml2.provider.service.web.Saml2WebSsoAuthenticationRequestFilter",
8989
order.next());
9090
put(X509AuthenticationFilter.class, order.next());
9191
put(AbstractPreAuthenticatedProcessingFilter.class, order.next());
9292
this.filterToOrder.put("org.springframework.security.cas.web.CasAuthenticationFilter", order.next());
9393
this.filterToOrder.put("org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter",
9494
order.next());
9595
this.filterToOrder.put(
96-
"org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter",
96+
"org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter",
9797
order.next());
9898
put(UsernamePasswordAuthenticationFilter.class, order.next());
9999
order.next(); // gh-8105

Diff for: config/src/main/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
import org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationProvider;
3434
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
3535
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository;
36-
import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter;
37-
import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationRequestFilter;
3836
import org.springframework.security.saml2.provider.service.web.DefaultRelyingPartyRegistrationResolver;
3937
import org.springframework.security.saml2.provider.service.web.HttpSessionSaml2AuthenticationRequestRepository;
4038
import org.springframework.security.saml2.provider.service.web.RelyingPartyRegistrationResolver;
4139
import org.springframework.security.saml2.provider.service.web.Saml2AuthenticationRequestRepository;
4240
import org.springframework.security.saml2.provider.service.web.Saml2AuthenticationTokenConverter;
41+
import org.springframework.security.saml2.provider.service.web.Saml2WebSsoAuthenticationRequestFilter;
4342
import org.springframework.security.saml2.provider.service.web.authentication.OpenSaml4AuthenticationRequestResolver;
4443
import org.springframework.security.saml2.provider.service.web.authentication.Saml2AuthenticationRequestResolver;
44+
import org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter;
4545
import org.springframework.security.web.AuthenticationEntryPoint;
4646
import org.springframework.security.web.authentication.AuthenticationConverter;
4747
import org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint;

Diff for: config/src/main/java/org/springframework/security/config/http/Saml2LoginBeanDefinitionParser.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
import org.springframework.security.config.Elements;
4040
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
4141
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository;
42-
import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter;
43-
import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationRequestFilter;
42+
import org.springframework.security.saml2.provider.service.web.Saml2WebSsoAuthenticationRequestFilter;
43+
import org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter;
4444
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
4545
import org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter;
4646
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;

Diff for: config/src/test/kotlin/org/springframework/security/config/annotation/web/Saml2DslTests.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import org.springframework.security.saml2.provider.service.registration.InMemory
4040
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration
4141
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository
4242
import org.springframework.security.saml2.provider.service.registration.TestRelyingPartyRegistrations
43-
import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter
43+
import org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter
4444
import org.springframework.security.web.SecurityFilterChain
4545
import org.springframework.test.web.servlet.MockMvc
4646
import org.springframework.test.web.servlet.get

Diff for: docs/modules/ROOT/pages/whats-new.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ Use the OpenSaml 4 Support instead.
1111
* https://github.com/spring-projects/spring-security/issues/8980[gh-8980] - Remove unsafe/deprecated `Encryptors.querableText(CharSequence,CharSequence)`.
1212
Instead use data storage to encrypt values.
1313
* https://github.com/spring-projects/spring-security/issues/11520[gh-11520] - Remember Me uses SHA256 by default
14+
* https://github.com/spring-projects/spring-security/issues/8819 - Move filters to web package
15+
Reorganize imports

Diff for: saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/Saml2AuthenticationToken.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.springframework.security.authentication.AbstractAuthenticationToken;
2222
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
23+
import org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter;
2324
import org.springframework.util.Assert;
2425

2526
/**
@@ -42,9 +43,8 @@ public class Saml2AuthenticationToken extends AbstractAuthenticationToken {
4243
* Creates a {@link Saml2AuthenticationToken} with the provided parameters.
4344
*
4445
* Note that the given {@link RelyingPartyRegistration} should have all its templates
45-
* resolved at this point. See
46-
* {@link org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter}
47-
* for an example of performing that resolution.
46+
* resolved at this point. See {@link Saml2WebSsoAuthenticationFilter} for an example
47+
* of performing that resolution.
4848
* @param relyingPartyRegistration the resolved {@link RelyingPartyRegistration} to
4949
* use
5050
* @param saml2Response the SAML 2.0 response to authenticate
@@ -66,9 +66,8 @@ public Saml2AuthenticationToken(RelyingPartyRegistration relyingPartyRegistratio
6666
* Creates a {@link Saml2AuthenticationToken} with the provided parameters
6767
*
6868
* Note that the given {@link RelyingPartyRegistration} should have all its templates
69-
* resolved at this point. See
70-
* {@link org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter}
71-
* for an example of performing that resolution.
69+
* resolved at this point. See {@link Saml2WebSsoAuthenticationFilter} for an example
70+
* of performing that resolution.
7271
* @param relyingPartyRegistration the resolved {@link RelyingPartyRegistration} to
7372
* use
7473
* @param saml2Response the SAML 2.0 response to authenticate
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.security.saml2.provider.service.servlet.filter;
17+
package org.springframework.security.saml2.provider.service.web;
1818

1919
import java.io.IOException;
2020
import java.nio.charset.StandardCharsets;
@@ -30,8 +30,6 @@
3030
import org.springframework.security.saml2.provider.service.authentication.Saml2PostAuthenticationRequest;
3131
import org.springframework.security.saml2.provider.service.authentication.Saml2RedirectAuthenticationRequest;
3232
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
33-
import org.springframework.security.saml2.provider.service.web.HttpSessionSaml2AuthenticationRequestRepository;
34-
import org.springframework.security.saml2.provider.service.web.Saml2AuthenticationRequestRepository;
3533
import org.springframework.security.saml2.provider.service.web.authentication.Saml2AuthenticationRequestResolver;
3634
import org.springframework.util.Assert;
3735
import org.springframework.util.StringUtils;
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.security.saml2.provider.service.servlet.filter;
17+
package org.springframework.security.saml2.provider.service.web.authentication;
1818

1919
import jakarta.servlet.http.HttpServletRequest;
2020
import jakarta.servlet.http.HttpServletResponse;

Diff for: saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import org.springframework.security.saml2.core.Saml2X509Credential;
2222
import org.springframework.security.saml2.core.TestSaml2X509Credentials;
23-
import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter;
23+
import org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter;
2424

2525
import static org.assertj.core.api.Assertions.assertThat;
2626

Diff for: saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/TestRelyingPartyRegistrations.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import org.springframework.security.saml2.core.Saml2X509Credential;
2020
import org.springframework.security.saml2.credentials.TestSaml2X509Credentials;
21-
import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter;
21+
import org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter;
2222

2323
/**
2424
* Preconfigured test data for {@link RelyingPartyRegistration} objects
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.security.saml2.provider.service.servlet.filter;
17+
package org.springframework.security.saml2.provider.service.web;
1818

1919
import java.io.IOException;
2020
import java.nio.charset.StandardCharsets;
@@ -37,7 +37,6 @@
3737
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository;
3838
import org.springframework.security.saml2.provider.service.registration.Saml2MessageBinding;
3939
import org.springframework.security.saml2.provider.service.registration.TestRelyingPartyRegistrations;
40-
import org.springframework.security.saml2.provider.service.web.Saml2AuthenticationRequestRepository;
4140
import org.springframework.security.saml2.provider.service.web.authentication.Saml2AuthenticationRequestResolver;
4241
import org.springframework.web.util.HtmlUtils;
4342
import org.springframework.web.util.UriUtils;
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.security.saml2.provider.service.servlet.filter;
17+
package org.springframework.security.saml2.provider.service.web.authentication;
1818

1919
import jakarta.servlet.http.HttpServletResponse;
2020
import org.junit.jupiter.api.Assertions;

0 commit comments

Comments
 (0)