Skip to content

Commit 5af4b9a

Browse files
committed
Merge branch '6.4.x'
2 parents 67c1438 + 4b5bacf commit 5af4b9a

9 files changed

+38
-5
lines changed

config/src/test/java/org/springframework/security/SpringSecurityCoreVersionSerializableTests.java

+17
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,21 @@
178178
import org.springframework.security.oauth2.server.resource.introspection.OAuth2IntrospectionException;
179179
import org.springframework.security.saml2.Saml2Exception;
180180
import org.springframework.security.saml2.core.Saml2Error;
181+
import org.springframework.security.saml2.core.Saml2X509Credential;
182+
import org.springframework.security.saml2.credentials.TestSaml2X509Credentials;
181183
import org.springframework.security.saml2.provider.service.authentication.DefaultSaml2AuthenticatedPrincipal;
182184
import org.springframework.security.saml2.provider.service.authentication.Saml2Authentication;
183185
import org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationException;
186+
import org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationToken;
184187
import org.springframework.security.saml2.provider.service.authentication.Saml2PostAuthenticationRequest;
185188
import org.springframework.security.saml2.provider.service.authentication.Saml2RedirectAuthenticationRequest;
189+
import org.springframework.security.saml2.provider.service.authentication.TestSaml2AuthenticationTokens;
186190
import org.springframework.security.saml2.provider.service.authentication.TestSaml2Authentications;
187191
import org.springframework.security.saml2.provider.service.authentication.TestSaml2PostAuthenticationRequests;
188192
import org.springframework.security.saml2.provider.service.authentication.TestSaml2RedirectAuthenticationRequests;
193+
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
194+
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration.AssertingPartyDetails;
195+
import org.springframework.security.saml2.provider.service.registration.TestRelyingPartyRegistrations;
189196
import org.springframework.security.web.PortResolverImpl;
190197
import org.springframework.security.web.authentication.WebAuthenticationDetails;
191198
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
@@ -507,6 +514,16 @@ class SpringSecurityCoreVersionSerializableTests {
507514
(r) -> TestSaml2PostAuthenticationRequests.create());
508515
generatorByClassName.put(Saml2RedirectAuthenticationRequest.class,
509516
(r) -> TestSaml2RedirectAuthenticationRequests.create());
517+
generatorByClassName.put(Saml2X509Credential.class,
518+
(r) -> TestSaml2X509Credentials.relyingPartyVerifyingCredential());
519+
generatorByClassName.put(AssertingPartyDetails.class,
520+
(r) -> TestRelyingPartyRegistrations.full().build().getAssertingPartyMetadata());
521+
generatorByClassName.put(RelyingPartyRegistration.class, (r) -> TestRelyingPartyRegistrations.full().build());
522+
generatorByClassName.put(Saml2AuthenticationToken.class, (r) -> {
523+
Saml2AuthenticationToken token = TestSaml2AuthenticationTokens.tokenRequested();
524+
token.setDetails(details);
525+
return token;
526+
});
510527

511528
// web
512529
generatorByClassName.put(AnonymousAuthenticationToken.class, (r) -> {

saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/core/Saml2X509Credential.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.security.saml2.core;
1818

19+
import java.io.Serializable;
1920
import java.security.PrivateKey;
2021
import java.security.cert.X509Certificate;
2122
import java.util.Arrays;
@@ -35,7 +36,9 @@
3536
* @author Josh Cummings
3637
* @since 5.4
3738
*/
38-
public final class Saml2X509Credential {
39+
public final class Saml2X509Credential implements Serializable {
40+
41+
private static final long serialVersionUID = -1015853414272603517L;
3942

4043
private final PrivateKey privateKey;
4144

saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/AssertingPartyMetadata.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.security.saml2.provider.service.registration;
1818

19+
import java.io.Serializable;
1920
import java.util.Collection;
2021
import java.util.List;
2122
import java.util.function.Consumer;
@@ -28,7 +29,7 @@
2829
* @author Josh Cummings
2930
* @since 6.4
3031
*/
31-
public interface AssertingPartyMetadata {
32+
public interface AssertingPartyMetadata extends Serializable {
3233

3334
/**
3435
* Get the asserting party's <a href=

saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistration.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.security.saml2.provider.service.registration;
1818

19+
import java.io.Serializable;
1920
import java.util.ArrayList;
2021
import java.util.Collection;
2122
import java.util.Collections;
@@ -66,7 +67,9 @@
6667
* @author Josh Cummings
6768
* @since 5.2
6869
*/
69-
public class RelyingPartyRegistration {
70+
public class RelyingPartyRegistration implements Serializable {
71+
72+
private static final long serialVersionUID = -2718908121120942813L;
7073

7174
private final String registrationId;
7275

@@ -456,6 +459,8 @@ public static Builder withRelyingPartyRegistration(RelyingPartyRegistration regi
456459
*/
457460
public static class AssertingPartyDetails implements AssertingPartyMetadata {
458461

462+
private static final long serialVersionUID = 8728930758311995475L;
463+
459464
private final String entityId;
460465

461466
private final boolean wantAuthnRequestsSigned;

saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestSaml2AuthenticationTokens.java

+7
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ public static Saml2AuthenticationToken token() {
3535
return new Saml2AuthenticationToken(relyingPartyRegistration, "saml2-xml-response-object");
3636
}
3737

38+
public static Saml2AuthenticationToken tokenRequested() {
39+
RelyingPartyRegistration relyingPartyRegistration = TestRelyingPartyRegistrations.relyingPartyRegistration()
40+
.build();
41+
return new Saml2AuthenticationToken(relyingPartyRegistration, "saml2-xml-response-object",
42+
TestSaml2PostAuthenticationRequests.create());
43+
}
44+
3845
}

0 commit comments

Comments
 (0)