|  | 
| 211 | 211 | import org.springframework.security.web.savedrequest.SimpleSavedRequest; | 
| 212 | 212 | import org.springframework.security.web.server.firewall.ServerExchangeRejectedException; | 
| 213 | 213 | import org.springframework.security.web.session.HttpSessionCreatedEvent; | 
|  | 214 | +import org.springframework.security.web.webauthn.api.AuthenticationExtensionsClientInputs; | 
|  | 215 | +import org.springframework.security.web.webauthn.api.AuthenticatorTransport; | 
| 214 | 216 | import org.springframework.security.web.webauthn.api.Bytes; | 
|  | 217 | +import org.springframework.security.web.webauthn.api.CredProtectAuthenticationExtensionsClientInput; | 
|  | 218 | +import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInput; | 
|  | 219 | +import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInputs; | 
| 215 | 220 | import org.springframework.security.web.webauthn.api.ImmutablePublicKeyCredentialUserEntity; | 
|  | 221 | +import org.springframework.security.web.webauthn.api.PublicKeyCredentialDescriptor; | 
|  | 222 | +import org.springframework.security.web.webauthn.api.PublicKeyCredentialRequestOptions; | 
|  | 223 | +import org.springframework.security.web.webauthn.api.PublicKeyCredentialType; | 
| 216 | 224 | import org.springframework.security.web.webauthn.api.PublicKeyCredentialUserEntity; | 
| 217 | 225 | import org.springframework.security.web.webauthn.api.TestBytes; | 
|  | 226 | +import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialRequestOptions; | 
| 218 | 227 | import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialUserEntity; | 
|  | 228 | +import org.springframework.security.web.webauthn.api.UserVerificationRequirement; | 
| 219 | 229 | import org.springframework.security.web.webauthn.authentication.WebAuthnAuthentication; | 
|  | 230 | +import org.springframework.util.ReflectionUtils; | 
| 220 | 231 | 
 | 
| 221 | 232 | import static org.assertj.core.api.Assertions.assertThat; | 
| 222 | 233 | import static org.assertj.core.api.Assertions.fail; | 
| @@ -584,6 +595,41 @@ class SpringSecurityCoreVersionSerializableTests { | 
| 584 | 595 | 			webAuthnAuthentication.setDetails(details); | 
| 585 | 596 | 			return webAuthnAuthentication; | 
| 586 | 597 | 		}); | 
|  | 598 | + | 
|  | 599 | +		// webauthn | 
|  | 600 | +		CredProtectAuthenticationExtensionsClientInput.CredProtect credProtect = new CredProtectAuthenticationExtensionsClientInput.CredProtect( | 
|  | 601 | +				CredProtectAuthenticationExtensionsClientInput.CredProtect.ProtectionPolicy.USER_VERIFICATION_OPTIONAL, | 
|  | 602 | +				true); | 
|  | 603 | +		Bytes id = TestBytes.get(); | 
|  | 604 | +		AuthenticationExtensionsClientInputs inputs = new ImmutableAuthenticationExtensionsClientInputs( | 
|  | 605 | +				ImmutableAuthenticationExtensionsClientInput.credProps); | 
|  | 606 | +		// @formatter:off | 
|  | 607 | +		PublicKeyCredentialDescriptor descriptor = PublicKeyCredentialDescriptor.builder() | 
|  | 608 | +				.id(id) | 
|  | 609 | +				.type(PublicKeyCredentialType.PUBLIC_KEY) | 
|  | 610 | +				.transports(Set.of(AuthenticatorTransport.USB)) | 
|  | 611 | +				.build(); | 
|  | 612 | +		// @formatter:on | 
|  | 613 | +		generatorByClassName.put(AuthenticatorTransport.class, (a) -> AuthenticatorTransport.USB); | 
|  | 614 | +		generatorByClassName.put(PublicKeyCredentialType.class, (k) -> PublicKeyCredentialType.PUBLIC_KEY); | 
|  | 615 | +		generatorByClassName.put(UserVerificationRequirement.class, (r) -> UserVerificationRequirement.REQUIRED); | 
|  | 616 | +		generatorByClassName.put(CredProtectAuthenticationExtensionsClientInput.CredProtect.class, (c) -> credProtect); | 
|  | 617 | +		generatorByClassName.put(CredProtectAuthenticationExtensionsClientInput.class, | 
|  | 618 | +				(c) -> new CredProtectAuthenticationExtensionsClientInput(credProtect)); | 
|  | 619 | +		generatorByClassName.put(ImmutableAuthenticationExtensionsClientInputs.class, (i) -> inputs); | 
|  | 620 | +		Field credPropsField = ReflectionUtils.findField(ImmutableAuthenticationExtensionsClientInput.class, | 
|  | 621 | +				"credProps"); | 
|  | 622 | +		generatorByClassName.put(credPropsField.getType(), | 
|  | 623 | +				(i) -> ImmutableAuthenticationExtensionsClientInput.credProps); | 
|  | 624 | +		generatorByClassName.put(Bytes.class, (b) -> id); | 
|  | 625 | +		generatorByClassName.put(PublicKeyCredentialDescriptor.class, (d) -> descriptor); | 
|  | 626 | +		// @formatter:off | 
|  | 627 | +		generatorByClassName.put(PublicKeyCredentialRequestOptions.class, (o) -> TestPublicKeyCredentialRequestOptions.create() | 
|  | 628 | +				.extensions(inputs) | 
|  | 629 | +				.allowCredentials(List.of(descriptor)) | 
|  | 630 | +				.build() | 
|  | 631 | +		); | 
|  | 632 | +		// @formatter:on | 
| 587 | 633 | 	} | 
| 588 | 634 | 
 | 
| 589 | 635 | 	@ParameterizedTest | 
|  | 
0 commit comments