java-webauthn-server
java-webauthn-server copied to clipboard
fromString on enums
Within my code I have the following in several places:
startAssertionOptionsBuilder.userVerification(UserVerificationRequirement.valueOf(userVerification.toUpperCase()));
...
authenticatorSelectionCriteriaBuilder
.residentKey(ResidentKeyRequirement.valueOf(residentKey.toUpperCase()));
while all these enums have a private static fromString
. Maybe make these methods public?
Hi! Please help me understand the use case. Why do you need to create these values like this?
Because my demo allows it: https://demo.e-contract.be/ejsf-demo/webauthn.xhtml
I see, thank you.
There are the functions PublicKeyCredentialCreationOptions.fromJson
and AssertionRequest.fromJson
that can parse those entire data structures from JSON, does that help?
But yeah, I also don't see much issue in making the fromString(String): Optional<(enum)>
functions public. There are even a few that are already public, like the ones in COSEAlgorithmIdentifier
and KeyProtectionType
, so I guess we might as well make them all public.
Well, I guess once an application allows these options to be somehow configurable (via some property file for example), they need such functions anyway.
This is now released in experimental release 2.6.0-alpha4
. Thanks!