44 */
55package io .imunity .fido .credential ;
66
7- import com .fasterxml .jackson .annotation .JsonIgnore ;
8- import com .fasterxml .jackson .core .JsonProcessingException ;
9- import com .fasterxml .jackson .core .type .TypeReference ;
10- import com .yubico .webauthn .RegisteredCredential ;
11- import com .yubico .webauthn .attestation .Attestation ;
12- import com .yubico .webauthn .attestation .Transport ;
13- import com .yubico .webauthn .data .ByteArray ;
14- import org .apache .logging .log4j .LogManager ;
15- import org .apache .logging .log4j .Logger ;
16- import pl .edu .icm .unity .Constants ;
7+ import static java .util .Objects .isNull ;
178
189import java .io .IOException ;
1910import java .util .Collections ;
20- import java .util .HashMap ;
21- import java .util .HashSet ;
2211import java .util .List ;
23- import java .util .Map ;
2412import java .util .Objects ;
2513import java .util .Optional ;
26- import java .util .Set ;
2714
28- import static java .util .Objects .isNull ;
29- import static java .util .Objects .nonNull ;
15+ import org .apache .logging .log4j .LogManager ;
16+ import org .apache .logging .log4j .Logger ;
17+
18+ import com .fasterxml .jackson .annotation .JsonIgnore ;
19+ import com .fasterxml .jackson .core .JsonProcessingException ;
20+ import com .fasterxml .jackson .core .type .TypeReference ;
21+ import com .yubico .webauthn .RegisteredCredential ;
22+ import com .yubico .webauthn .data .ByteArray ;
23+
24+ import pl .edu .icm .unity .Constants ;
3025
3126/**
3227 * Holds information about Fido 2 credential details - represents single public key information.
@@ -74,22 +69,6 @@ private FidoCredentialInfo()
7469 */
7570 private String aaguid ;
7671
77- // Attestation properties
78- /**
79- * Indicates if attestation key was confirmed as trusted during registration.
80- */
81- private boolean attestationTrusted ;
82- /**
83- * Metadata and authenticator properties
84- */
85- private String metadataIdentifier ;
86- private Map <String , String > vendorProperties ;
87- private Map <String , String > deviceProperties ;
88- /**
89- * What transport of data is supported by Authenticator.
90- */
91- private Set <Transport > transports ;
92-
9372 // Mutable fields
9473 /**
9574 * Number of times private key was used to sign challenge - stored also on Authenticator
@@ -134,36 +113,11 @@ public String getAaguid()
134113 return aaguid ;
135114 }
136115
137- public boolean isAttestationTrusted ()
138- {
139- return attestationTrusted ;
140- }
141-
142116 public String getAttestationFormat ()
143117 {
144118 return attestationFormat ;
145119 }
146120
147- public String getMetadataIdentifier ()
148- {
149- return metadataIdentifier ;
150- }
151-
152- public Map <String , String > getVendorProperties ()
153- {
154- return vendorProperties ;
155- }
156-
157- public Map <String , String > getDeviceProperties ()
158- {
159- return deviceProperties ;
160- }
161-
162- public Set <Transport > getTransports ()
163- {
164- return transports ;
165- }
166-
167121 public long getSignatureCount ()
168122 {
169123 return signatureCount ;
@@ -242,24 +196,21 @@ public boolean equals(Object o)
242196 return registrationTimestamp == that .registrationTimestamp &&
243197 userPresent == that .userPresent &&
244198 userVerified == that .userVerified &&
245- attestationTrusted == that .attestationTrusted &&
246199 signatureCount == that .signatureCount &&
247200 Objects .equals (credentialId , that .credentialId ) &&
248201 Objects .equals (publicKeyCose , that .publicKeyCose ) &&
249202 Objects .equals (attestationFormat , that .attestationFormat ) &&
250203 Objects .equals (aaguid , that .aaguid ) &&
251- Objects .equals (metadataIdentifier , that .metadataIdentifier ) &&
252- Objects .equals (vendorProperties , that .vendorProperties ) &&
253- Objects .equals (deviceProperties , that .deviceProperties ) &&
254- Objects .equals (transports , that .transports ) &&
255204 Objects .equals (description , that .description ) &&
256205 Objects .equals (userHandle , that .userHandle );
257206 }
258207
259208 @ Override
260209 public int hashCode ()
261210 {
262- return Objects .hash (registrationTimestamp , credentialId , publicKeyCose , userPresent , userVerified , attestationFormat , aaguid , attestationTrusted , metadataIdentifier , vendorProperties , deviceProperties , transports , signatureCount , description , userHandle );
211+ return Objects .hash (registrationTimestamp , credentialId , publicKeyCose , userPresent , userVerified ,
212+ attestationFormat , aaguid ,
213+ signatureCount , description , userHandle );
263214 }
264215
265216 public static FidoCredentialInfoBuilder builder ()
@@ -285,12 +236,6 @@ public static final class FidoCredentialInfoBuilder
285236 private String aaguid ;
286237 private String description ;
287238
288- private boolean attestationTrusted ;
289- private String metadataIdentifier ;
290- private Map <String , String > vendorProperties ;
291- private Map <String , String > deviceProperties ;
292- private Set <Transport > transports ;
293-
294239 private String userHandle ;
295240
296241 private FidoCredentialInfoBuilder ()
@@ -308,11 +253,6 @@ private FidoCredentialInfoBuilder(FidoCredentialInfo credentialInfo)
308253 this .attestationFormat = credentialInfo .attestationFormat ;
309254 this .aaguid = credentialInfo .aaguid ;
310255 this .description = credentialInfo .description ;
311- this .attestationTrusted = credentialInfo .attestationTrusted ;
312- this .metadataIdentifier = credentialInfo .metadataIdentifier ;
313- this .vendorProperties = credentialInfo .vendorProperties ;
314- this .deviceProperties = credentialInfo .deviceProperties ;
315- this .transports = credentialInfo .transports ;
316256 this .userHandle = credentialInfo .userHandle ;;
317257 }
318258
@@ -345,53 +285,6 @@ public FidoCredentialInfoBuilder registrationTime(long registrationTime)
345285 return this ;
346286 }
347287
348-
349- public FidoCredentialInfoBuilder attestationTrusted (boolean attestationTrusted )
350- {
351- this .attestationTrusted = attestationTrusted ;
352- return this ;
353- }
354-
355- public FidoCredentialInfoBuilder metadataIdentifier (String metadataIdentifier )
356- {
357- this .metadataIdentifier = metadataIdentifier ;
358- return this ;
359- }
360-
361- public FidoCredentialInfoBuilder vendorProperties (Map <String , String > vendorProperties )
362- {
363- if (nonNull (vendorProperties ) && !vendorProperties .isEmpty ())
364- this .vendorProperties = new HashMap <>(vendorProperties );
365- return this ;
366- }
367-
368- public FidoCredentialInfoBuilder deviceProperties (Map <String , String > deviceProperties )
369- {
370- if (nonNull (deviceProperties ) && !deviceProperties .isEmpty ())
371- this .deviceProperties = new HashMap <>(deviceProperties );
372- return this ;
373- }
374-
375- public FidoCredentialInfoBuilder transports (Set <Transport > transports )
376- {
377- if (nonNull (transports ) && !transports .isEmpty ())
378- this .transports = new HashSet <>(transports );
379- return this ;
380- }
381-
382- public FidoCredentialInfoBuilder attestationMetadata (Attestation attestationMetadata )
383- {
384- if (nonNull (attestationMetadata ))
385- {
386- this .attestationTrusted = attestationMetadata .isTrusted ();
387- this .metadataIdentifier = attestationMetadata .getMetadataIdentifier ().orElse (null );
388- this .vendorProperties = attestationMetadata .getVendorProperties ().orElse (null );
389- this .deviceProperties = attestationMetadata .getDeviceProperties ().orElse (null );
390- this .transports = attestationMetadata .getTransports ().orElse (null );
391- }
392- return this ;
393- }
394-
395288 public FidoCredentialInfoBuilder userPresent (final boolean userPresent )
396289 {
397290 this .userPresent = userPresent ;
@@ -447,12 +340,6 @@ public FidoCredentialInfo build()
447340 info .aaguid = null ; // for NONE attestation aaguid is always reset to 0s
448341 }
449342
450- info .attestationTrusted = this .attestationTrusted ;
451- info .metadataIdentifier = this .metadataIdentifier ;
452- info .vendorProperties = this .vendorProperties ;
453- info .deviceProperties = this .deviceProperties ;
454- info .transports = this .transports ;
455-
456343 info .description = this .description ;
457344
458345 return info ;
0 commit comments