-
Notifications
You must be signed in to change notification settings - Fork 159
MDS: Adjust SupportedCtapOptions parsing logic #419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f4981f2
Adjust parsing logic
fdennis 77a8af8
Add test of SupportedCtapOptions serialization stability
emlun 5bceb93
Fix parsing SupportedCtapOptions from empty JSON object
emlun ad36a8b
Remove redundant builder defaults
emlun 0452830
Move @JsonAlias alongside @JsonProperty in SupportedCtapOptions
emlun f51c289
Add perCredMgmtRO and fix url to CTAP
fdennis 8a97204
Update JavaDoc
fdennis 6801734
Add perCredMgmtRO to test
fdennis c8d349e
Add perCredMgmtRO to test generator
emlun a94d148
Add SupportedCtapOptions fix to NEWS
emlun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 114 additions & 48 deletions
162
webauthn-server-attestation/src/main/java/com/yubico/fido/metadata/SupportedCtapOptions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,160 +1,226 @@ | ||
package com.yubico.fido.metadata; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAlias; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Builder; | ||
import lombok.Value; | ||
import lombok.extern.jackson.Jacksonized; | ||
|
||
/** | ||
* A fixed-keys map of CTAP2 option names to Boolean values representing whether an authenticator | ||
* supports the respective option. | ||
* | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Value | ||
@Builder | ||
@Jacksonized | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class SupportedCtapOptions { | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean plat = false; | ||
boolean plat; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean rk = false; | ||
boolean rk; | ||
|
||
/** | ||
* If set to <code>true</code> the device is capable of accepting PIN. | ||
* | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean clientPin = false; | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
boolean clientPin; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean up = false; | ||
boolean up; | ||
|
||
/** | ||
* If set to <code>true</code> the device is capable of built-in user verification. | ||
* | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean uv = false; | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
boolean uv; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@JsonAlias("uvToken") | ||
@Builder.Default | ||
boolean pinUvAuthToken = false; | ||
boolean pinUvAuthToken; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean noMcGaPermissionsWithClientPin = false; | ||
boolean noMcGaPermissionsWithClientPin; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean largeBlobs = false; | ||
boolean largeBlobs; | ||
|
||
/** | ||
* If set to <code>true</code> the authenticator is enterprise attestation capable. | ||
* | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean ep = false; | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
boolean ep; | ||
|
||
/** | ||
* If set to <code>true</code> the authenticator supports the authenticatorBioEnrollment commands. | ||
* | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean bioEnroll = false; | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
boolean bioEnroll; | ||
|
||
/** | ||
* If set to <code>true</code> the authenticator supports the Prototype authenticatorBioEnrollment | ||
* (0x40) commands. | ||
* | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean userVerificationMgmtPreview = false; | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
boolean userVerificationMgmtPreview; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean uvBioEnroll = false; | ||
boolean uvBioEnroll; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@JsonAlias("config") | ||
@Builder.Default | ||
boolean authnrCfg = false; | ||
boolean authnrCfg; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean uvAcfg = false; | ||
boolean uvAcfg; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean credMgmt = false; | ||
boolean credMgmt; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean credentialMgmtPreview = false; | ||
boolean perCredMgmtRO; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean setMinPINLength = false; | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
boolean credentialMgmtPreview; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean makeCredUvNotRqd = false; | ||
boolean setMinPINLength; | ||
|
||
/** | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#authenticatorGetInfo">Client | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@Builder.Default boolean alwaysUv = false; | ||
boolean makeCredUvNotRqd; | ||
|
||
/** | ||
* If set to <code>true</code> the authenticator supports the Always Require User Verification | ||
* feature. | ||
* | ||
* @see <a | ||
* href="https://fidoalliance.org/specs/fido-v2.2-ps-20250228/fido-client-to-authenticator-protocol-v2.2-ps-20250228.html#authenticatorGetInfo">Client | ||
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a> | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
boolean alwaysUv; | ||
|
||
@JsonCreator | ||
private SupportedCtapOptions( | ||
@JsonProperty("plat") Boolean plat, | ||
@JsonProperty("rk") Boolean rk, | ||
@JsonProperty("clientPin") Boolean clientPin, | ||
@JsonProperty("up") Boolean up, | ||
@JsonProperty("uv") Boolean uv, | ||
@JsonAlias("uvToken") @JsonProperty("pinUvAuthToken") Boolean pinUvAuthToken, | ||
@JsonProperty("noMcGaPermissionsWithClientPin") Boolean noMcGaPermissionsWithClientPin, | ||
@JsonProperty("largeBlobs") Boolean largeBlobs, | ||
@JsonProperty("ep") Boolean ep, | ||
@JsonProperty("bioEnroll") Boolean bioEnroll, | ||
@JsonProperty("userVerificationMgmtPreview") Boolean userVerificationMgmtPreview, | ||
@JsonProperty("uvBioEnroll") Boolean uvBioEnroll, | ||
@JsonAlias("config") @JsonProperty("authnrCfg") Boolean authnrCfg, | ||
@JsonProperty("uvAcfg") Boolean uvAcfg, | ||
@JsonProperty("credMgmt") Boolean credMgmt, | ||
@JsonProperty("perCredMgmtRO") Boolean perCredMgmtRO, | ||
@JsonProperty("credentialMgmtPreview") Boolean credentialMgmtPreview, | ||
@JsonProperty("setMinPINLength") Boolean setMinPINLength, | ||
@JsonProperty("makeCredUvNotRqd") Boolean makeCredUvNotRqd, | ||
@JsonProperty("alwaysUv") Boolean alwaysUv) { | ||
this.plat = Boolean.TRUE.equals(plat); | ||
this.rk = Boolean.TRUE.equals(rk); | ||
this.clientPin = clientPin != null; | ||
this.up = Boolean.TRUE.equals(up); | ||
this.uv = uv != null; | ||
this.pinUvAuthToken = Boolean.TRUE.equals(pinUvAuthToken); | ||
this.noMcGaPermissionsWithClientPin = Boolean.TRUE.equals(noMcGaPermissionsWithClientPin); | ||
this.largeBlobs = Boolean.TRUE.equals(largeBlobs); | ||
this.ep = ep != null; | ||
this.bioEnroll = bioEnroll != null; | ||
this.userVerificationMgmtPreview = userVerificationMgmtPreview != null; | ||
this.uvBioEnroll = Boolean.TRUE.equals(uvBioEnroll); | ||
this.authnrCfg = Boolean.TRUE.equals(authnrCfg); | ||
this.uvAcfg = Boolean.TRUE.equals(uvAcfg); | ||
this.credMgmt = Boolean.TRUE.equals(credMgmt); | ||
this.perCredMgmtRO = Boolean.TRUE.equals(perCredMgmtRO); | ||
this.credentialMgmtPreview = Boolean.TRUE.equals(credentialMgmtPreview); | ||
this.setMinPINLength = Boolean.TRUE.equals(setMinPINLength); | ||
this.makeCredUvNotRqd = Boolean.TRUE.equals(makeCredUvNotRqd); | ||
this.alwaysUv = alwaysUv != null; | ||
} | ||
fdennis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.