| 
194 | 194 | import org.springframework.security.web.webauthn.api.AttestationConveyancePreference;  | 
195 | 195 | import org.springframework.security.web.webauthn.api.AuthenticatorAttachment;  | 
196 | 196 | import org.springframework.security.web.webauthn.api.AuthenticatorSelectionCriteria;  | 
 | 197 | +import org.springframework.security.web.webauthn.api.AuthenticatorTransport;  | 
197 | 198 | import org.springframework.security.web.webauthn.api.Bytes;  | 
 | 199 | +import org.springframework.security.web.webauthn.api.COSEAlgorithmIdentifier;  | 
 | 200 | +import org.springframework.security.web.webauthn.api.CredentialRecord;  | 
 | 201 | +import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInput;  | 
 | 202 | +import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInputs;  | 
198 | 203 | import org.springframework.security.web.webauthn.api.PublicKeyCredentialCreationOptions;  | 
 | 204 | +import org.springframework.security.web.webauthn.api.PublicKeyCredentialDescriptor;  | 
 | 205 | +import org.springframework.security.web.webauthn.api.PublicKeyCredentialParameters;  | 
199 | 206 | import org.springframework.security.web.webauthn.api.PublicKeyCredentialRpEntity;  | 
 | 207 | +import org.springframework.security.web.webauthn.api.PublicKeyCredentialType;  | 
200 | 208 | import org.springframework.security.web.webauthn.api.ResidentKeyRequirement;  | 
 | 209 | +import org.springframework.security.web.webauthn.api.TestCredentialRecord;  | 
 | 210 | +import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialCreationOptions;  | 
 | 211 | +import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialUserEntity;  | 
201 | 212 | import org.springframework.security.web.webauthn.api.UserVerificationRequirement;  | 
 | 213 | +import org.springframework.security.web.webauthn.management.TestPublicKeyCredentialRpEntity;  | 
202 | 214 | 
 
  | 
203 | 215 | import static org.assertj.core.api.Assertions.assertThat;  | 
204 | 216 | import static org.assertj.core.api.Assertions.fail;  | 
@@ -518,17 +530,39 @@ class SpringSecurityCoreVersionSerializableTests {  | 
518 | 530 | 				(r) -> new HttpSessionCreatedEvent(new MockHttpSession()));  | 
519 | 531 | 
 
  | 
520 | 532 | 		// webauthn  | 
521 |  | -		generatorByClassName.put(PublicKeyCredentialCreationOptions.class,  | 
522 |  | -				(r) -> PublicKeyCredentialCreationOptions.builder().build());  | 
 | 533 | +		generatorByClassName.put(PublicKeyCredentialCreationOptions.class, (r) -> {  | 
 | 534 | +			CredentialRecord credentialRecord = TestCredentialRecord.userCredential().build();  | 
 | 535 | +			PublicKeyCredentialDescriptor descriptor = PublicKeyCredentialDescriptor.builder()  | 
 | 536 | +				.id(credentialRecord.getCredentialId())  | 
 | 537 | +				.transports(credentialRecord.getTransports())  | 
 | 538 | +				.build();  | 
 | 539 | +			return TestPublicKeyCredentialCreationOptions.createPublicKeyCredentialCreationOptions()  | 
 | 540 | +				.rp(TestPublicKeyCredentialRpEntity.createRpEntity().build())  | 
 | 541 | +				.user(TestPublicKeyCredentialUserEntity.userEntity().build())  | 
 | 542 | +				.excludeCredentials(List.of(descriptor))  | 
 | 543 | +				.build();  | 
 | 544 | +		});  | 
523 | 545 | 		generatorByClassName.put(PublicKeyCredentialRpEntity.class,  | 
524 |  | -				(r) -> PublicKeyCredentialRpEntity.builder().build());  | 
 | 546 | +				(r) -> TestPublicKeyCredentialRpEntity.createRpEntity().build());  | 
525 | 547 | 		generatorByClassName.put(Bytes.class, (r) -> Bytes.random());  | 
526 | 548 | 		generatorByClassName.put(AuthenticatorSelectionCriteria.class,  | 
527 | 549 | 				(r) -> AuthenticatorSelectionCriteria.builder().build());  | 
528 | 550 | 		generatorByClassName.put(AuthenticatorAttachment.class, (r) -> AuthenticatorAttachment.CROSS_PLATFORM);  | 
529 | 551 | 		generatorByClassName.put(ResidentKeyRequirement.class, (r) -> ResidentKeyRequirement.REQUIRED);  | 
530 | 552 | 		generatorByClassName.put(UserVerificationRequirement.class, (r) -> UserVerificationRequirement.REQUIRED);  | 
531 | 553 | 		generatorByClassName.put(AttestationConveyancePreference.class, (r) -> AttestationConveyancePreference.NONE);  | 
 | 554 | +		generatorByClassName.put(PublicKeyCredentialParameters.class, (r) -> PublicKeyCredentialParameters.EdDSA);  | 
 | 555 | +		generatorByClassName.put(COSEAlgorithmIdentifier.class, (r) -> COSEAlgorithmIdentifier.EdDSA);  | 
 | 556 | +		generatorByClassName.put(ImmutableAuthenticationExtensionsClientInputs.class,  | 
 | 557 | +				(r) -> new ImmutableAuthenticationExtensionsClientInputs(  | 
 | 558 | +						ImmutableAuthenticationExtensionsClientInput.credProps));  | 
 | 559 | +		generatorByClassName.put(PublicKeyCredentialDescriptor.class,  | 
 | 560 | +				(r) -> PublicKeyCredentialDescriptor.builder()  | 
 | 561 | +					.transports(AuthenticatorTransport.HYBRID)  | 
 | 562 | +					.id(Bytes.fromBase64("ChfoCM8CJA_wwUGDdzdtuw"))  | 
 | 563 | +					.build());  | 
 | 564 | +		generatorByClassName.put(PublicKeyCredentialType.class, (r) -> PublicKeyCredentialType.PUBLIC_KEY);  | 
 | 565 | +		generatorByClassName.put(AuthenticatorTransport.class, (r) -> AuthenticatorTransport.HYBRID);  | 
532 | 566 | 	}  | 
533 | 567 | 
 
  | 
534 | 568 | 	@ParameterizedTest  | 
 | 
0 commit comments