|
20 | 20 | import java.io.Serializable; |
21 | 21 | import java.lang.reflect.Field; |
22 | 22 | import java.security.Principal; |
| 23 | +import java.time.Duration; |
23 | 24 | import java.time.Instant; |
24 | 25 | import java.util.Collection; |
25 | 26 | import java.util.Date; |
|
245 | 246 | import org.springframework.security.web.server.firewall.ServerExchangeRejectedException; |
246 | 247 | import org.springframework.security.web.session.HttpSessionCreatedEvent; |
247 | 248 | import org.springframework.security.web.session.HttpSessionIdChangedEvent; |
248 | | -import org.springframework.security.web.webauthn.api.AuthenticationExtensionsClientInputs; |
249 | | -import org.springframework.security.web.webauthn.api.AuthenticationExtensionsClientOutputs; |
250 | | -import org.springframework.security.web.webauthn.api.AuthenticatorAssertionResponse; |
251 | | -import org.springframework.security.web.webauthn.api.AuthenticatorAttachment; |
252 | | -import org.springframework.security.web.webauthn.api.AuthenticatorTransport; |
253 | | -import org.springframework.security.web.webauthn.api.Bytes; |
254 | | -import org.springframework.security.web.webauthn.api.CredProtectAuthenticationExtensionsClientInput; |
255 | | -import org.springframework.security.web.webauthn.api.CredentialPropertiesOutput; |
256 | | -import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInput; |
257 | | -import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInputs; |
258 | | -import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientOutputs; |
259 | | -import org.springframework.security.web.webauthn.api.ImmutablePublicKeyCredentialUserEntity; |
260 | | -import org.springframework.security.web.webauthn.api.PublicKeyCredential; |
261 | | -import org.springframework.security.web.webauthn.api.PublicKeyCredentialDescriptor; |
262 | | -import org.springframework.security.web.webauthn.api.PublicKeyCredentialRequestOptions; |
263 | | -import org.springframework.security.web.webauthn.api.PublicKeyCredentialType; |
264 | | -import org.springframework.security.web.webauthn.api.PublicKeyCredentialUserEntity; |
265 | | -import org.springframework.security.web.webauthn.api.TestAuthenticationAssertionResponses; |
266 | | -import org.springframework.security.web.webauthn.api.TestBytes; |
267 | | -import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialRequestOptions; |
268 | | -import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialUserEntities; |
269 | | -import org.springframework.security.web.webauthn.api.TestPublicKeyCredentials; |
270 | | -import org.springframework.security.web.webauthn.api.UserVerificationRequirement; |
| 249 | +import org.springframework.security.web.webauthn.api.*; |
271 | 250 | import org.springframework.security.web.webauthn.authentication.WebAuthnAuthentication; |
272 | 251 | import org.springframework.security.web.webauthn.authentication.WebAuthnAuthenticationRequestToken; |
273 | 252 | import org.springframework.security.web.webauthn.management.RelyingPartyAuthenticationRequest; |
| 253 | +import org.springframework.security.web.webauthn.management.TestPublicKeyCredentialRpEntities; |
274 | 254 | import org.springframework.util.ReflectionUtils; |
275 | 255 |
|
276 | 256 | final class SerializationSamples { |
@@ -879,6 +859,37 @@ final class SerializationSamples { |
879 | 859 | generatorByClassName.put(CredentialPropertiesOutput.ExtensionOutput.class, |
880 | 860 | (r) -> new CredentialPropertiesOutput(true).getOutput()); |
881 | 861 |
|
| 862 | + AttestationConveyancePreference attestationConveyancePreference = AttestationConveyancePreference.DIRECT; |
| 863 | + ResidentKeyRequirement residentKeyRequirement = ResidentKeyRequirement.REQUIRED; |
| 864 | + AuthenticatorSelectionCriteria authenticatorSelectionCriteria = AuthenticatorSelectionCriteria.builder() |
| 865 | + .authenticatorAttachment(AuthenticatorAttachment.PLATFORM) |
| 866 | + .residentKey(residentKeyRequirement) |
| 867 | + .userVerification(UserVerificationRequirement.REQUIRED) |
| 868 | + .build(); |
| 869 | + PublicKeyCredentialParameters publicKeyCredentialParameters = PublicKeyCredentialParameters.RS256; |
| 870 | + PublicKeyCredentialRpEntity publicKeyCredentialRpEntity = TestPublicKeyCredentialRpEntities.createRpEntity().build(); |
| 871 | + |
| 872 | + generatorByClassName.put(AttestationConveyancePreference.class, (r) -> attestationConveyancePreference); |
| 873 | + generatorByClassName.put(ResidentKeyRequirement.class, (r) -> residentKeyRequirement); |
| 874 | + generatorByClassName.put(AuthenticatorSelectionCriteria.class, (r) -> authenticatorSelectionCriteria); |
| 875 | + generatorByClassName.put(COSEAlgorithmIdentifier.class, (r -> COSEAlgorithmIdentifier.RS256)); |
| 876 | + generatorByClassName.put(PublicKeyCredentialParameters.class, (r) -> publicKeyCredentialParameters); |
| 877 | + generatorByClassName.put(PublicKeyCredentialRpEntity.class, (r) -> publicKeyCredentialRpEntity); |
| 878 | + generatorByClassName.put(PublicKeyCredentialCreationOptions.class, (o) -> TestPublicKeyCredentialCreationOptions.createPublicKeyCredentialCreationOptions() |
| 879 | + .extensions(inputs) |
| 880 | + .attestation(attestationConveyancePreference) |
| 881 | + .authenticatorSelection(authenticatorSelectionCriteria) |
| 882 | + .challenge(TestBytes.get()) |
| 883 | + .excludeCredentials(List.of(descriptor)) |
| 884 | + .rp(publicKeyCredentialRpEntity) |
| 885 | + .pubKeyCredParams(publicKeyCredentialParameters) |
| 886 | + .timeout(Duration.ofMinutes(5)) |
| 887 | + .user(TestPublicKeyCredentialUserEntities.userEntity() |
| 888 | + .id(TestBytes.get()) |
| 889 | + .build()) |
| 890 | + .build() |
| 891 | + ); |
| 892 | + |
882 | 893 | // One-Time Token |
883 | 894 | DefaultOneTimeToken oneTimeToken = new DefaultOneTimeToken(UUID.randomUUID().toString(), "user", |
884 | 895 | Instant.now().plusSeconds(300)); |
|
0 commit comments