Make PublicKeyCredentialRequestOptions Serializable#16438
Make PublicKeyCredentialRequestOptions Serializable#16438franticticktick wants to merge 1 commit intospring-projects:mainfrom
Conversation
87e31a2 to
6f3e2ac
Compare
rwinch
left a comment
There was a problem hiding this comment.
Thanks for the Pull Request. Historically the serialVersionUID no longer used for new classes implementing Serializable. Going forward we should generate a serialVersionUID.
|
Hi @rwinch, thanks for feedback. If we use the generated |
|
Please take a look at 6f379aa which was progress towards gh-16276 for an example for how to implement it. It uses generated NOTE: This PR has some overlap with gh-16285 (which I provided the same advice for) |
d646106 to
c845b68
Compare
|
Thanks for help @rwinch. Could you review changes please? |
rwinch
left a comment
There was a problem hiding this comment.
Thanks for the PR! I've provided feedback inline
There was a problem hiding this comment.
It looks like this failed to write
| CredProtectAuthenticationExtensionsClientInput.CredProtect credProtect = new CredProtectAuthenticationExtensionsClientInput.CredProtect( | ||
| CredProtectAuthenticationExtensionsClientInput.CredProtect.ProtectionPolicy.USER_VERIFICATION_OPTIONAL, | ||
| true); | ||
| Bytes id = new Bytes(("test").getBytes()); |
There was a problem hiding this comment.
I like that you used a constant value here vs generating a new value. Please use a more realistic value. To make this easy I recently added TestBytes.get() gh-16461
There was a problem hiding this comment.
ImmutableAuthenticationExtensionClientInput has generic parameter, so SpringSecurityCoreVersionSerializableTests doesn't work. To serialize the class I used this trick:
Object instance;
if(clazz.equals(ImmutableAuthenticationExtensionsClientInput.class)) {
instance = instancioWithParameter((Class<ImmutableAuthenticationExtensionsClientInput>) clazz)
.create();
} else {
instance = instancioWithDefaults(clazz).create();
}
private static InstancioApi<?> instancioWithParameter(Class<ImmutableAuthenticationExtensionsClientInput> clazz) {
InstancioApi<?> instancio = Instancio.of(clazz).withTypeParameters(Boolean.class);
if (generatorByClassName.containsKey(clazz)) {
instancio.supply(Select.all(clazz), generatorByClassName.get(clazz));
}
return instancio;
}
Perhaps there is an easier way to do this. We should think about this.
| generatorByClassName.put(Bytes.class, (b) -> id); | ||
| generatorByClassName.put(PublicKeyCredentialDescriptor.class, (d) -> descriptor); | ||
| // @formatter:off | ||
| generatorByClassName.put(PublicKeyCredentialRequestOptions.class, (o) -> PublicKeyCredentialRequestOptions.builder() |
There was a problem hiding this comment.
Please use (or at least start with) TestPublicKeyCredentialRequestOptions
1b421da to
cd8d6e0
Compare
Closes spring-projectsgh-16432 Signed-off-by: Max Batischev <mblancer@mail.ru>
cd8d6e0 to
87c4aa5
Compare
|
|
|
@franticticktick Thanks for the pull request. This is now merged into master along with a841737 to fix the generic types. NOTE: This can also be fixed using |
Closes gh-16432