Skip to content

Commit 4559837

Browse files
Implement Serial for PublicKeyCredentialCreationOptions
Signed-off-by: Tran Ngoc Nhan <[email protected]>
1 parent c04463a commit 4559837

8 files changed

+25
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,32 +207,41 @@
207207
import org.springframework.security.web.server.firewall.ServerExchangeRejectedException;
208208
import org.springframework.security.web.session.HttpSessionCreatedEvent;
209209
import org.springframework.security.web.session.HttpSessionIdChangedEvent;
210+
import org.springframework.security.web.webauthn.api.AttestationConveyancePreference;
210211
import org.springframework.security.web.webauthn.api.AuthenticationExtensionsClientInputs;
211212
import org.springframework.security.web.webauthn.api.AuthenticationExtensionsClientOutputs;
212213
import org.springframework.security.web.webauthn.api.AuthenticatorAssertionResponse;
213214
import org.springframework.security.web.webauthn.api.AuthenticatorAttachment;
215+
import org.springframework.security.web.webauthn.api.AuthenticatorSelectionCriteria;
214216
import org.springframework.security.web.webauthn.api.AuthenticatorTransport;
215217
import org.springframework.security.web.webauthn.api.Bytes;
218+
import org.springframework.security.web.webauthn.api.COSEAlgorithmIdentifier;
216219
import org.springframework.security.web.webauthn.api.CredProtectAuthenticationExtensionsClientInput;
217220
import org.springframework.security.web.webauthn.api.CredentialPropertiesOutput;
218221
import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInput;
219222
import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientInputs;
220223
import org.springframework.security.web.webauthn.api.ImmutableAuthenticationExtensionsClientOutputs;
221224
import org.springframework.security.web.webauthn.api.ImmutablePublicKeyCredentialUserEntity;
222225
import org.springframework.security.web.webauthn.api.PublicKeyCredential;
226+
import org.springframework.security.web.webauthn.api.PublicKeyCredentialCreationOptions;
223227
import org.springframework.security.web.webauthn.api.PublicKeyCredentialDescriptor;
228+
import org.springframework.security.web.webauthn.api.PublicKeyCredentialParameters;
224229
import org.springframework.security.web.webauthn.api.PublicKeyCredentialRequestOptions;
230+
import org.springframework.security.web.webauthn.api.PublicKeyCredentialRpEntity;
225231
import org.springframework.security.web.webauthn.api.PublicKeyCredentialType;
226232
import org.springframework.security.web.webauthn.api.PublicKeyCredentialUserEntity;
233+
import org.springframework.security.web.webauthn.api.ResidentKeyRequirement;
227234
import org.springframework.security.web.webauthn.api.TestAuthenticationAssertionResponses;
228235
import org.springframework.security.web.webauthn.api.TestBytes;
236+
import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialCreationOptions;
229237
import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialRequestOptions;
230238
import org.springframework.security.web.webauthn.api.TestPublicKeyCredentialUserEntities;
231239
import org.springframework.security.web.webauthn.api.TestPublicKeyCredentials;
232240
import org.springframework.security.web.webauthn.api.UserVerificationRequirement;
233241
import org.springframework.security.web.webauthn.authentication.WebAuthnAuthentication;
234242
import org.springframework.security.web.webauthn.authentication.WebAuthnAuthenticationRequestToken;
235243
import org.springframework.security.web.webauthn.management.RelyingPartyAuthenticationRequest;
244+
import org.springframework.security.web.webauthn.management.TestPublicKeyCredentialRpEntities;
236245
import org.springframework.util.ReflectionUtils;
237246

238247
final class SerializationSamples {
@@ -668,6 +677,22 @@ final class SerializationSamples {
668677
});
669678
// @formatter:on
670679

680+
generatorByClassName.put(AttestationConveyancePreference.class,
681+
(r) -> AttestationConveyancePreference.INDIRECT);
682+
generatorByClassName.put(AuthenticatorSelectionCriteria.class,
683+
(r) -> AuthenticatorSelectionCriteria.builder()
684+
.userVerification(UserVerificationRequirement.REQUIRED)
685+
.build());
686+
generatorByClassName.put(COSEAlgorithmIdentifier.class, (r) -> COSEAlgorithmIdentifier.ES256);
687+
generatorByClassName.put(PublicKeyCredentialParameters.class, (r) -> PublicKeyCredentialParameters.ES256);
688+
generatorByClassName.put(PublicKeyCredentialRpEntity.class,
689+
(r) -> TestPublicKeyCredentialRpEntities.createRpEntity().build());
690+
generatorByClassName.put(ResidentKeyRequirement.class, (r) -> ResidentKeyRequirement.REQUIRED);
691+
generatorByClassName.put(PublicKeyCredentialCreationOptions.class,
692+
(r) -> TestPublicKeyCredentialCreationOptions.createPublicKeyCredentialCreationOptions()
693+
.rp(TestPublicKeyCredentialRpEntities.createRpEntity().build())
694+
.build());
695+
671696
generatorByClassName.put(CredentialPropertiesOutput.ExtensionOutput.class,
672697
(r) -> new CredentialPropertiesOutput(true).getOutput());
673698

0 commit comments

Comments
 (0)