Skip to content

Commit e42865b

Browse files
committed
Merge branch '6.4.x'
2 parents f9e0459 + 9468126 commit e42865b

20 files changed

+155
-18
lines changed

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

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import org.apereo.cas.client.validation.AssertionImpl;
5151
import org.instancio.Instancio;
5252
import org.instancio.InstancioApi;
53+
import org.instancio.InstancioOfClassApi;
5354
import org.instancio.Select;
5455
import org.instancio.generator.Generator;
5556
import org.junit.jupiter.api.Disabled;
@@ -59,6 +60,7 @@
5960

6061
import org.springframework.beans.factory.config.BeanDefinition;
6162
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
63+
import org.springframework.core.ResolvableType;
6264
import org.springframework.core.type.filter.AssignableTypeFilter;
6365
import org.springframework.mock.web.MockHttpServletRequest;
6466
import org.springframework.mock.web.MockHttpSession;
@@ -217,21 +219,31 @@
217219
import org.springframework.security.web.server.firewall.ServerExchangeRejectedException;
218220
import org.springframework.security.web.session.HttpSessionCreatedEvent;
219221
import org.springframework.security.web.webauthn.api.AuthenticationExtensionsClientInputs;
222+
import org.springframework.security.web.webauthn.api.AuthenticationExtensionsClientOutputs;
223+
import org.springframework.security.web.webauthn.api.AuthenticatorAssertionResponse;
224+
import org.springframework.security.web.webauthn.api.AuthenticatorAttachment;
220225
import org.springframework.security.web.webauthn.api.AuthenticatorTransport;
221226
import org.springframework.security.web.webauthn.api.Bytes;
222227
import org.springframework.security.web.webauthn.api.CredProtectAuthenticationExtensionsClientInput;
228+
import org.springframework.security.web.webauthn.api.CredentialPropertiesOutput;
223229
import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInput;
224230
import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInputs;
231+
import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientOutputs;
225232
import org.springframework.security.web.webauthn.api.ImmutablePublicKeyCredentialUserEntity;
233+
import org.springframework.security.web.webauthn.api.PublicKeyCredential;
226234
import org.springframework.security.web.webauthn.api.PublicKeyCredentialDescriptor;
227235
import org.springframework.security.web.webauthn.api.PublicKeyCredentialRequestOptions;
228236
import org.springframework.security.web.webauthn.api.PublicKeyCredentialType;
229237
import org.springframework.security.web.webauthn.api.PublicKeyCredentialUserEntity;
238+
import org.springframework.security.web.webauthn.api.TestAuthenticationAssertionResponses;
230239
import org.springframework.security.web.webauthn.api.TestBytes;
240+
import org.springframework.security.web.webauthn.api.TestPublicKeyCredential;
231241
import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialRequestOptions;
232242
import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialUserEntity;
233243
import org.springframework.security.web.webauthn.api.UserVerificationRequirement;
234244
import org.springframework.security.web.webauthn.authentication.WebAuthnAuthentication;
245+
import org.springframework.security.web.webauthn.authentication.WebAuthnAuthenticationRequestToken;
246+
import org.springframework.security.web.webauthn.management.RelyingPartyAuthenticationRequest;
235247
import org.springframework.util.ReflectionUtils;
236248

237249
import static org.assertj.core.api.Assertions.assertThat;
@@ -621,6 +633,27 @@ class SpringSecurityCoreVersionSerializableTests {
621633
.allowCredentials(List.of(descriptor))
622634
.build()
623635
);
636+
637+
CredentialPropertiesOutput credentialOutput = new CredentialPropertiesOutput(false);
638+
AuthenticationExtensionsClientOutputs outputs = new ImmutableAuthenticationExtensionsClientOutputs(credentialOutput);
639+
AuthenticatorAssertionResponse response = TestAuthenticationAssertionResponses.createAuthenticatorAssertionResponse()
640+
.build();
641+
PublicKeyCredential<AuthenticatorAssertionResponse> credential = TestPublicKeyCredential.createPublicKeyCredential(
642+
response, outputs)
643+
.build();
644+
RelyingPartyAuthenticationRequest authRequest = new RelyingPartyAuthenticationRequest(
645+
TestPublicKeyCredentialRequestOptions.create().build(),
646+
credential
647+
);
648+
WebAuthnAuthenticationRequestToken requestToken = new WebAuthnAuthenticationRequestToken(authRequest);
649+
requestToken.setDetails(details);
650+
generatorByClassName.put(CredentialPropertiesOutput.class, (o) -> credentialOutput);
651+
generatorByClassName.put(ImmutableAuthenticationExtensionsClientOutputs.class, (o) -> outputs);
652+
generatorByClassName.put(AuthenticatorAssertionResponse.class, (r) -> response);
653+
generatorByClassName.put(RelyingPartyAuthenticationRequest.class, (r) -> authRequest);
654+
generatorByClassName.put(PublicKeyCredential.class, (r) -> credential);
655+
generatorByClassName.put(WebAuthnAuthenticationRequestToken.class, (r) -> requestToken);
656+
generatorByClassName.put(AuthenticatorAttachment.class, (r) -> AuthenticatorAttachment.PLATFORM);
624657
// @formatter:on
625658
generatorByClassName.put(ImmutablePublicKeyCredentialUserEntity.class,
626659
(r) -> TestPublicKeyCredentialUserEntity.userEntity().id(TestBytes.get()).build());
@@ -784,7 +817,11 @@ static Stream<Class<?>> getClassesToSerialize() throws Exception {
784817
}
785818

786819
private static InstancioApi<?> instancioWithDefaults(Class<?> clazz) {
787-
InstancioApi<?> instancio = Instancio.of(clazz);
820+
InstancioOfClassApi<?> instancio = Instancio.of(clazz);
821+
ResolvableType[] generics = ResolvableType.forClass(clazz).getGenerics();
822+
for (ResolvableType type : generics) {
823+
instancio.withTypeParameters(type.resolve());
824+
}
788825
if (generatorByClassName.containsKey(clazz)) {
789826
instancio.supply(Select.all(clazz), generatorByClassName.get(clazz));
790827
}
782 Bytes
Binary file not shown.
130 Bytes
Binary file not shown.
306 Bytes
Binary file not shown.
619 Bytes
Binary file not shown.
2.22 KB
Binary file not shown.
3.88 KB
Binary file not shown.
3.2 KB
Binary file not shown.

web/src/main/java/org/springframework/security/web/webauthn/api/AuthenticationExtensionsClientOutput.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-output">client extension
2123
* output</a> entry in {@link AuthenticationExtensionsClientOutputs}.
@@ -24,7 +26,7 @@
2426
* @see AuthenticationExtensionsClientOutputs#getOutputs()
2527
* @see CredentialPropertiesOutput
2628
*/
27-
public interface AuthenticationExtensionsClientOutput<T> {
29+
public interface AuthenticationExtensionsClientOutput<T> extends Serializable {
2830

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

web/src/main/java/org/springframework/security/web/webauthn/api/AuthenticationExtensionsClientOutputs.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 PublicKeyCredential#getClientExtensionResults()
3334
*/
34-
public interface AuthenticationExtensionsClientOutputs {
35+
public interface AuthenticationExtensionsClientOutputs extends Serializable {
3536

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

0 commit comments

Comments
 (0)