Skip to content

Commit f4981f2

Browse files
committed
Adjust parsing logic
1 parent c8a5523 commit f4981f2

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

webauthn-server-attestation/src/main/java/com/yubico/fido/metadata/SupportedCtapOptions.java

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.yubico.fido.metadata;
22

33
import com.fasterxml.jackson.annotation.JsonAlias;
4-
import lombok.AccessLevel;
5-
import lombok.AllArgsConstructor;
4+
import com.fasterxml.jackson.annotation.JsonCreator;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
66
import lombok.Builder;
77
import lombok.Value;
88
import lombok.extern.jackson.Jacksonized;
@@ -18,7 +18,6 @@
1818
@Value
1919
@Builder
2020
@Jacksonized
21-
@AllArgsConstructor(access = AccessLevel.PRIVATE)
2221
public class SupportedCtapOptions {
2322

2423
/**
@@ -157,4 +156,46 @@ public class SupportedCtapOptions {
157156
* to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04)</a>
158157
*/
159158
@Builder.Default boolean alwaysUv = false;
159+
160+
@JsonCreator
161+
private SupportedCtapOptions(
162+
@JsonProperty("plat") Boolean plat,
163+
@JsonProperty("rk") Boolean rk,
164+
@JsonProperty("clientPin") Boolean clientPin,
165+
@JsonProperty("up") Boolean up,
166+
@JsonProperty("uv") Boolean uv,
167+
@JsonProperty("pinUvAuthToken") Boolean pinUvAuthToken,
168+
@JsonProperty("noMcGaPermissionsWithClientPin") Boolean noMcGaPermissionsWithClientPin,
169+
@JsonProperty("largeBlobs") Boolean largeBlobs,
170+
@JsonProperty("ep") Boolean ep,
171+
@JsonProperty("bioEnroll") Boolean bioEnroll,
172+
@JsonProperty("userVerificationMgmtPreview") Boolean userVerificationMgmtPreview,
173+
@JsonProperty("uvBioEnroll") Boolean uvBioEnroll,
174+
@JsonProperty("authnrCfg") Boolean authnrCfg,
175+
@JsonProperty("uvAcfg") Boolean uvAcfg,
176+
@JsonProperty("credMgmt") Boolean credMgmt,
177+
@JsonProperty("credentialMgmtPreview") Boolean credentialMgmtPreview,
178+
@JsonProperty("setMinPINLength") Boolean setMinPINLength,
179+
@JsonProperty("makeCredUvNotRqd") Boolean makeCredUvNotRqd,
180+
@JsonProperty("alwaysUv") Boolean alwaysUv) {
181+
this.plat = plat;
182+
this.rk = rk;
183+
this.clientPin = clientPin != null;
184+
this.up = up;
185+
this.uv = uv != null;
186+
this.pinUvAuthToken = Boolean.TRUE.equals(pinUvAuthToken);
187+
this.noMcGaPermissionsWithClientPin = Boolean.TRUE.equals(noMcGaPermissionsWithClientPin);
188+
this.largeBlobs = Boolean.TRUE.equals(largeBlobs);
189+
this.ep = ep != null;
190+
this.bioEnroll = bioEnroll != null;
191+
this.userVerificationMgmtPreview = userVerificationMgmtPreview != null;
192+
this.uvBioEnroll = Boolean.TRUE.equals(uvBioEnroll);
193+
this.authnrCfg = Boolean.TRUE.equals(authnrCfg);
194+
this.uvAcfg = Boolean.TRUE.equals(uvAcfg);
195+
this.credMgmt = Boolean.TRUE.equals(credMgmt);
196+
this.credentialMgmtPreview = Boolean.TRUE.equals(credentialMgmtPreview);
197+
this.setMinPINLength = Boolean.TRUE.equals(setMinPINLength);
198+
this.makeCredUvNotRqd = Boolean.TRUE.equals(makeCredUvNotRqd);
199+
this.alwaysUv = alwaysUv != null;
200+
}
160201
}

0 commit comments

Comments
 (0)