Skip to content

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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.JsonProperty;
import lombok.Builder;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;
Expand All @@ -18,7 +18,6 @@
@Value
@Builder
@Jacksonized
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class SupportedCtapOptions {

/**
Expand Down Expand Up @@ -157,4 +156,46 @@ public class SupportedCtapOptions {
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a>
*/
@Builder.Default boolean alwaysUv = false;

@JsonCreator
private SupportedCtapOptions(
@JsonProperty("plat") Boolean plat,
@JsonProperty("rk") Boolean rk,
@JsonProperty("clientPin") Boolean clientPin,
@JsonProperty("up") Boolean up,
@JsonProperty("uv") Boolean uv,
@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,
@JsonProperty("authnrCfg") Boolean authnrCfg,
@JsonProperty("uvAcfg") Boolean uvAcfg,
@JsonProperty("credMgmt") Boolean credMgmt,
@JsonProperty("credentialMgmtPreview") Boolean credentialMgmtPreview,
@JsonProperty("setMinPINLength") Boolean setMinPINLength,
@JsonProperty("makeCredUvNotRqd") Boolean makeCredUvNotRqd,
@JsonProperty("alwaysUv") Boolean alwaysUv) {
this.plat = plat;
this.rk = rk;
this.clientPin = clientPin != null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to update the JavaDoc for clientPin since the behaviour here is no longer the same as in the CTAP spec.

this.up = 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.credentialMgmtPreview = Boolean.TRUE.equals(credentialMgmtPreview);
this.setMinPINLength = Boolean.TRUE.equals(setMinPINLength);
this.makeCredUvNotRqd = Boolean.TRUE.equals(makeCredUvNotRqd);
this.alwaysUv = alwaysUv != null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv, ep, bioEnroll, userVerificationMgmtPreview and alwaysUv also need their JavaDoc updated.

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an perCredMgmtRO option has been added (between credMgmt and credentialMgmtPreview) since this class was written, we should add that too.

}