Skip to content

Commit 87e31a2

Browse files
Make PublicKeyCredentialRequestOptions Serializable
Closes gh-16432 Signed-off-by: Max Batischev <[email protected]>
1 parent d8783b3 commit 87e31a2

11 files changed

+70
-20
lines changed

web/src/main/java/org/springframework/security/web/webauthn/api/AuthenticationExtensionsClientInput.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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,8 @@
1616

1717
package org.springframework.security.web.webauthn.api;
1818

19+
import java.io.Serializable;
20+
1921
/**
2022
* A <a href="https://www.w3.org/TR/webauthn-3/#client-extension-input">client extension
2123
* input</a> entry in the {@link AuthenticationExtensionsClientInputs}.
@@ -25,7 +27,7 @@
2527
* @since 6.4
2628
* @see ImmutableAuthenticationExtensionsClientInput
2729
*/
28-
public interface AuthenticationExtensionsClientInput<T> {
30+
public interface AuthenticationExtensionsClientInput<T> extends Serializable {
2931

3032
/**
3133
* Gets the <a href="https://www.w3.org/TR/webauthn-3/#extension-identifier">extension

web/src/main/java/org/springframework/security/web/webauthn/api/AuthenticationExtensionsClientInputs.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.web.webauthn.api;
1818

19+
import java.io.Serializable;
1920
import java.util.List;
2021

2122
/**
@@ -31,7 +32,7 @@
3132
* @since 6.4
3233
* @see PublicKeyCredentialCreationOptions#getExtensions()
3334
*/
34-
public interface AuthenticationExtensionsClientInputs {
35+
public interface AuthenticationExtensionsClientInputs extends Serializable {
3536

3637
/**
3738
* Gets all of the {@link AuthenticationExtensionsClientInput}.

web/src/main/java/org/springframework/security/web/webauthn/api/AuthenticatorTransport.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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,10 @@
1616

1717
package org.springframework.security.web.webauthn.api;
1818

19+
import java.io.Serializable;
20+
21+
import org.springframework.security.core.SpringSecurityCoreVersion;
22+
1923
/**
2024
* <a href=
2125
* "https://www.w3.org/TR/webauthn-3/#enumdef-authenticatortransport">AuthenticatorTransport</a>
@@ -25,7 +29,9 @@
2529
* @author Rob Winch
2630
* @since 6.4
2731
*/
28-
public final class AuthenticatorTransport {
32+
public final class AuthenticatorTransport implements Serializable {
33+
34+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
2935

3036
/**
3137
* <a href="https://www.w3.org/TR/webauthn-3/#dom-authenticatortransport-usb">usbc</a>

web/src/main/java/org/springframework/security/web/webauthn/api/Bytes.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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,10 +16,12 @@
1616

1717
package org.springframework.security.web.webauthn.api;
1818

19+
import java.io.Serializable;
1920
import java.security.SecureRandom;
2021
import java.util.Arrays;
2122
import java.util.Base64;
2223

24+
import org.springframework.security.core.SpringSecurityCoreVersion;
2325
import org.springframework.util.Assert;
2426

2527
/**
@@ -28,7 +30,9 @@
2830
* @author Rob Winch
2931
* @since 6.4
3032
*/
31-
public final class Bytes {
33+
public final class Bytes implements Serializable {
34+
35+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
3236

3337
private static final SecureRandom RANDOM = new SecureRandom();
3438

web/src/main/java/org/springframework/security/web/webauthn/api/CredProtectAuthenticationExtensionsClientInput.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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,10 @@
1616

1717
package org.springframework.security.web.webauthn.api;
1818

19+
import java.io.Serializable;
20+
21+
import org.springframework.security.core.SpringSecurityCoreVersion;
22+
1923
/**
2024
* Implements <a href=
2125
* "https://fidoalliance.org/specs/fido-v2.2-rd-20230321/fido-client-to-authenticator-protocol-v2.2-rd-20230321.html#sctn-credProtect-extension">
@@ -27,6 +31,8 @@
2731
public class CredProtectAuthenticationExtensionsClientInput
2832
implements AuthenticationExtensionsClientInput<CredProtectAuthenticationExtensionsClientInput.CredProtect> {
2933

34+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
35+
3036
private final CredProtect input;
3137

3238
public CredProtectAuthenticationExtensionsClientInput(CredProtect input) {
@@ -43,7 +49,9 @@ public CredProtect getInput() {
4349
return this.input;
4450
}
4551

46-
public static class CredProtect {
52+
public static class CredProtect implements Serializable {
53+
54+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
4755

4856
private final ProtectionPolicy credProtectionPolicy;
4957

web/src/main/java/org/springframework/security/web/webauthn/api/ImmutableAuthenticationExtensionsClientInput.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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,8 @@
1616

1717
package org.springframework.security.web.webauthn.api;
1818

19+
import org.springframework.security.core.SpringSecurityCoreVersion;
20+
1921
/**
2022
* An immutable {@link AuthenticationExtensionsClientInput}.
2123
*
@@ -26,6 +28,8 @@
2628
*/
2729
public class ImmutableAuthenticationExtensionsClientInput<T> implements AuthenticationExtensionsClientInput<T> {
2830

31+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
32+
2933
/**
3034
* https://www.w3.org/TR/webauthn-3/#sctn-authenticator-credential-properties-extension
3135
*/

web/src/main/java/org/springframework/security/web/webauthn/api/ImmutableAuthenticationExtensionsClientInputs.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -19,6 +19,8 @@
1919
import java.util.Arrays;
2020
import java.util.List;
2121

22+
import org.springframework.security.core.SpringSecurityCoreVersion;
23+
2224
/**
2325
* An immutable implementation of {@link AuthenticationExtensionsClientInputs}.
2426
*
@@ -27,6 +29,8 @@
2729
*/
2830
public class ImmutableAuthenticationExtensionsClientInputs implements AuthenticationExtensionsClientInputs {
2931

32+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
33+
3034
private final List<AuthenticationExtensionsClientInput> inputs;
3135

3236
public ImmutableAuthenticationExtensionsClientInputs(List<AuthenticationExtensionsClientInput> inputs) {

web/src/main/java/org/springframework/security/web/webauthn/api/PublicKeyCredentialDescriptor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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,8 +16,11 @@
1616

1717
package org.springframework.security.web.webauthn.api;
1818

19+
import java.io.Serializable;
1920
import java.util.Set;
2021

22+
import org.springframework.security.core.SpringSecurityCoreVersion;
23+
2124
/**
2225
* <a href=
2326
* "https://www.w3.org/TR/webauthn-3/#dictdef-publickeycredentialdescriptor">PublicKeyCredentialDescriptor</a>
@@ -29,7 +32,9 @@
2932
* @author Rob Winch
3033
* @since 6.4
3134
*/
32-
public final class PublicKeyCredentialDescriptor {
35+
public final class PublicKeyCredentialDescriptor implements Serializable {
36+
37+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
3338

3439
private final PublicKeyCredentialType type;
3540

web/src/main/java/org/springframework/security/web/webauthn/api/PublicKeyCredentialRequestOptions.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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,12 +16,14 @@
1616

1717
package org.springframework.security.web.webauthn.api;
1818

19+
import java.io.Serializable;
1920
import java.time.Duration;
2021
import java.util.ArrayList;
2122
import java.util.Collections;
2223
import java.util.List;
2324
import java.util.function.Consumer;
2425

26+
import org.springframework.security.core.SpringSecurityCoreVersion;
2527
import org.springframework.util.Assert;
2628

2729
/**
@@ -32,7 +34,9 @@
3234
* @author Rob Winch
3335
* @since 6.4
3436
*/
35-
public final class PublicKeyCredentialRequestOptions {
37+
public final class PublicKeyCredentialRequestOptions implements Serializable {
38+
39+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
3640

3741
private final Bytes challenge;
3842

web/src/main/java/org/springframework/security/web/webauthn/api/PublicKeyCredentialType.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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,10 @@
1616

1717
package org.springframework.security.web.webauthn.api;
1818

19+
import java.io.Serializable;
20+
21+
import org.springframework.security.core.SpringSecurityCoreVersion;
22+
1923
/**
2024
* The <a href=
2125
* "https://www.w3.org/TR/webauthn-3/#enum-credentialType">PublicKeyCredentialType</a>
@@ -24,7 +28,9 @@
2428
* @author Rob Winch
2529
* @since 6.4
2630
*/
27-
public final class PublicKeyCredentialType {
31+
public final class PublicKeyCredentialType implements Serializable {
32+
33+
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
2834

2935
/**
3036
* The only credential type that currently exists.

0 commit comments

Comments
 (0)