Skip to content

Commit ee25efa

Browse files
Add Serializable for RelyingPartyRegistration
Closes gh-16286
1 parent fd267df commit ee25efa

7 files changed

+17
-5
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@
126126
import org.springframework.security.saml2.provider.service.authentication.TestSaml2Authentications;
127127
import org.springframework.security.saml2.provider.service.authentication.TestSaml2PostAuthenticationRequests;
128128
import org.springframework.security.saml2.provider.service.authentication.TestSaml2RedirectAuthenticationRequests;
129+
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
130+
import org.springframework.security.saml2.provider.service.registration.TestRelyingPartyRegistrations;
129131
import org.springframework.security.web.authentication.WebAuthenticationDetails;
130132
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
131133
import org.springframework.security.web.authentication.preauth.PreAuthenticatedCredentialsNotFoundException;
@@ -322,6 +324,7 @@ class SpringSecurityCoreVersionSerializableTests {
322324
(r) -> TestSaml2PostAuthenticationRequests.create());
323325
generatorByClassName.put(Saml2RedirectAuthenticationRequest.class,
324326
(r) -> TestSaml2RedirectAuthenticationRequests.create());
327+
generatorByClassName.put(RelyingPartyRegistration.class, (r) -> TestRelyingPartyRegistrations.full().build());
325328

326329
// web
327330
generatorByClassName.put(AnonymousAuthenticationToken.class, (r) -> {

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

Lines changed: 5 additions & 2 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 7 additions & 2 deletions
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;

0 commit comments

Comments
 (0)