[java-idp-plugin-duo] branch main updated: JDUO-82 - API to access enrollment information

Phil Smart philip.smart at jisc.ac.uk
Fri Mar 22 09:48:32 UTC 2024


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-idp-plugin-duo.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-duo.git;a=commit;h=feddf8b73486948843c25f453b903d586b5c3bc8

The following commit(s) were added to refs/heads/main by this push:
     new feddf8b7 JDUO-82 - API to access enrollment information
feddf8b7 is described below

commit feddf8b73486948843c25f453b903d586b5c3bc8
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Mar 22 09:48:14 2024 +0000

    JDUO-82 - API to access enrollment information
    
    - Add all WebAuthnCredential information to the corresponding model
      object.
    
    https://shibboleth.atlassian.net/browse/JDUO-82
---
 .../plugin/authn/duo/model/WebAuthnCredential.java | 333 ++++++++++++++++++++-
 1 file changed, 332 insertions(+), 1 deletion(-)

diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/WebAuthnCredential.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/WebAuthnCredential.java
index d33ce6ad..8630f826 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/WebAuthnCredential.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/WebAuthnCredential.java
@@ -14,13 +14,26 @@
 
 package net.shibboleth.idp.plugin.authn.duo.model;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+import javax.annotation.concurrent.Immutable;
+import javax.annotation.concurrent.ThreadSafe;
 
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
 
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
 /**
  * A WebAuthn credential registered to a User.
  * 
@@ -28,6 +41,8 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
  */
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @JsonDeserialize(builder = WebAuthnCredential.Builder.class)
+ at ThreadSafe
+ at Immutable
 public final class WebAuthnCredential {
 
     /** Free-form label for the WebAuthn credential.*/
@@ -38,6 +53,10 @@ public final class WebAuthnCredential {
     @JsonProperty("date_added")
     @Nullable private final Integer dateAdded;
     
+    /** The date the WebAuthn credential was last used.*/
+    @JsonProperty("date_last_used")
+    @Nullable private final Integer dateLastUsed;
+    
     /** Indicates the type of WebAuthn credential.*/
     @JsonProperty("label")
     @Nullable private final String label;
@@ -45,6 +64,59 @@ public final class WebAuthnCredential {
     /** The WebAuthn credential's registration identifier.*/
     @JsonProperty("webauthnkey")
     @Nullable private final String webauthnkey;
+    
+    /**
+     * If true, this credential can be used for both MFA and Passwordless authentication. If false, this credential 
+     * can only be used for MFA authentication.
+     */
+    @JsonProperty("passwordless_authorized")
+    @Nullable private final Boolean passwordlessAuthorized;
+    
+    /**
+     * If true, this credential can be used from multiple devices. If false, this credential can 
+     * only be used on one device.
+     */
+    @JsonProperty("backup_eligible")
+    @Nullable private final Boolean backupEligible;
+    
+    /**
+     * If true, this credential has been backed up and can be used from multiple devices. If false, this 
+     * credential has not been backed up.
+     */
+    @JsonProperty("backup_status")
+    @Nullable private final Boolean backupStatus;
+    
+    /**
+     * A unique identifier that conveys the authenticator's make and model, or the passkey's provider identity. 
+     * This value cannot be verified as accurate by Duo.
+     */
+    @JsonProperty("aaguid")
+    @Nullable private final String aaguid;
+    
+    /**
+     * The registration flow that was used to register this WebAuthn credential. 
+     * One of platform, cross-platform, or unknown.
+     */
+    @JsonProperty("registered_as")
+    @Nullable private final String registeredAs;
+    
+    /**
+     * The transports the authenticator can use to communicate with a client. 
+     */
+    @JsonProperty("transports")
+    @Nullable private final List<String> transports;  
+    
+    /** 
+     * Is the WebAuthn authenticator associated with this credential capable of identifying a user via a suitable 
+     * authorization gesture (User Verification).
+     */
+    @JsonProperty("uv_capable")
+    @Nullable private final Boolean uvCapable;
+    
+    /** Any additional properties not explicitly captured by this class are added to this map.*/
+    @JsonIgnore
+    @Nonnull @NotLive @Unmodifiable private final Map<String, Object> additionalProperties;
+
 
     /**
      * 
@@ -57,6 +129,15 @@ public final class WebAuthnCredential {
         this.dateAdded = builder.dateAdded;
         this.label = builder.label;
         this.webauthnkey = builder.webauthnkey;
+        this.uvCapable = builder.uvCapable;
+        this.dateLastUsed = builder.dateLastUsed;
+        this.passwordlessAuthorized = builder.passwordlessAuthorized;
+        this.backupEligible = builder.backupEligible;
+        this.backupStatus = builder.backupStatus;
+        this.aaguid = builder.aaguid;
+        this.registeredAs = builder.registeredAs;
+        this.transports = builder.transports;
+        this.additionalProperties = CollectionSupport.copyToMap(builder.additionalProperties);
     }
 
     /**
@@ -95,9 +176,105 @@ public final class WebAuthnCredential {
      * @return the credentials registration identifier
      */
     @JsonProperty("webauthnkey")
-    public String getWebauthnkey() {
+    @Nullable public String getWebauthnkey() {
         return webauthnkey;
     }
+    
+    /**
+     * Is the WebAuthn authenticator associated with this credential capable of identifying a user via a suitable 
+     * authorization gesture.
+     * 
+     * @return if the authenticator is uv capable, <code>null</code> if not defined.
+     */
+    @JsonProperty("uv_capable")
+    @Nullable public Boolean isUvCapable() {
+        return uvCapable;
+    }
+    
+    /**
+     * Get the date the WebAuthn credential was last used
+     * 
+     * @return the date.
+     */
+    @JsonProperty("date_last_used")
+    @Nullable public Integer getDateLastUsed() {
+        return dateLastUsed;
+    }
+    
+    /**
+     * Get the unique identifier that conveys the authenticator's make and model, or the passkey's provider identity. 
+     * This value cannot be verified as accurate by Duo.
+     * 
+     * @return the aaguid
+     */
+    @JsonProperty("aaguid")
+    public String getAaguid() {
+        return aaguid;
+    }
+    
+    /**
+     * If true, this credential can be used from multiple devices. If false, this credential can 
+     * only be used on one device.
+     * 
+     * @return if the credential is backup eligible, <code>null</code> if not defined.
+     */
+    @JsonProperty("backup_eligible")
+    public Boolean isBackupEligible() {
+        return backupEligible;
+    }
+    
+    /**
+     * If true, this credential has been backed up and can be used from multiple devices. If false, this 
+     * credential has not been backed up, <code>null</code> if not defined.
+     * 
+     * @return the backup status
+     */
+    @JsonProperty("backup_status")
+    public Boolean isBackupStatus() {
+        return backupStatus;
+    }
+    
+    /**
+     * If true, this credential can be used for both MFA and Passwordless authentication. If false, this 
+     * credential can only be used for MFA authentication.
+     * 
+     * @return if passwordless is authorized.
+     */
+    @JsonProperty("passwordless_authorized")
+    public Boolean isPasswordlessAuthorized() {
+        return passwordlessAuthorized;
+    }
+    
+    /**
+     * The registration flow that was used to register this WebAuthn credential. 
+     * One of platform, cross-platform, or unknown.
+     * 
+     * @return what the credential was registered as
+     */
+    @JsonProperty("registered_as")
+    public String getRegisteredAs() {
+        return registeredAs;
+    }
+    
+    /**
+     * Get the transports the authenticator can use to communicate with a client.
+     * 
+     *  @return the transports
+     */
+    @JsonProperty("transports")
+    public List<String> getTransports() {
+        return transports;
+    }
+    
+    /**
+     * Get any additional properties not explicitly captured by this class.
+     * 
+     * @return the map of any additional properties not directly captured by this class.
+     */
+    @JsonIgnore
+    public Map<String, Object> getAdditionalProperties() {
+        return additionalProperties;
+    }
 
     /**
      * Get the builder for this class.
@@ -113,37 +290,191 @@ public final class WebAuthnCredential {
     public static final class Builder {
         private String credentialName;
         private Integer dateAdded;
+        private Integer dateLastUsed;
         private String label;
         private String webauthnkey;
+        private Boolean uvCapable;
+        private Boolean passwordlessAuthorized;
+        private Boolean backupEligible;
+        private Boolean backupStatus;
+        private String aaguid;
+        private String registeredAs;
+        private List<String> transports;
+        
+        @Nonnull private final Map<String, Object> additionalProperties;
 
         /** Constructor.*/
         private Builder() {
+            additionalProperties = new HashMap<>();
         }
 
+        /**
+         * Build the credential name
+         * 
+         * @param name the credential name
+         * 
+         * @return this
+         */
         @JsonProperty("credential_name")
         public Builder withCredentialName(@Nullable final String name) {
             credentialName = name;
             return this;
         }
 
+        /**
+         * Build the date the WebAuthn credential was last used
+         * 
+         * @param date the date added
+         * 
+         * @return this
+         */
         @JsonProperty("date_added")
         public Builder withDateAdded(@Nullable final Integer date) {
             dateAdded = date;
             return this;
         }
 
+        /**
+         * Build the type of WebAuthn credential.
+         * 
+         * @param labelIn the label
+         * 
+         * @return this
+         */
         @JsonProperty("label")
         public Builder withLabel(@Nullable final String labelIn) {
             label = labelIn;
             return this;
         }
 
+        /**
+         * Build the WebAuthn credential's registration identifier.
+         * 
+         * @param key the webauthnkey
+         * 
+         * @return this
+         */
         @JsonProperty("webauthnkey")
         public Builder withWebauthnkey(@Nullable final String key) {
             webauthnkey = key;
             return this;
         }
+        
+        /**
+         * Build if the WebAuthn authenticator associated with this credential is capable of identifying a user via a 
+         * suitable authorization gesture.
+         * 
+         * @param flag the uv_capable flag
+         * 
+         * @return this
+         */
+        @JsonProperty("uv_capable")
+        public Builder withUvCapable(@Nullable final Boolean flag) {
+            uvCapable = flag;
+            return this;
+        }
+        
+        /**
+         * Build if this credential can be used for both MFA and Passwordless authentication.
+         * 
+         * @param flag the passwordless_authorized flag
+         * 
+         * @return this
+         */
+        @JsonProperty("passwordless_authorized")
+        public Builder withPasswordlessAuthorized(@Nullable final Boolean flag) {
+            passwordlessAuthorized = flag;
+            return this;
+        }
+        
+        /**
+         * Build if this credential can be used from multiple devices.
+         * 
+         * @param flag the backup_eligible flag
+         * 
+         * @return this
+         */
+        @JsonProperty("backup_eligible")
+        public Builder withBackupEligible(@Nullable final Boolean flag) {
+            backupEligible = flag;
+            return this;
+        }
+        
+        /**
+         * Build if this credential has been backed up and can be used from multiple devices.
+         * 
+         * @param flag the backup_status flag
+         * 
+         * @return this
+         */
+        @JsonProperty("backup_status")
+        public Builder withBackupStatus(@Nullable final Boolean flag) {
+            backupStatus = flag;
+            return this;
+        }
+        
+        /**
+         * Build a unique identifier that conveys the authenticator's make and model, or the passkey's provider 
+         * identity.
+         * 
+         * @param guid the aaguid value
+         * 
+         * @return this
+         */
+        @JsonProperty("aaguid")
+        public Builder withAaguid(@Nullable final String guid) {
+            aaguid = guid;
+            return this;
+        }
+        
+        /**
+         * Build the registration flow that was used to register this WebAuthn credential.
+         * 
+         * @param regAs the registered_as value
+         * 
+         * @return this
+         */
+        @JsonProperty("registered_as")
+        public Builder withRegisteredAs(@Nullable final String regAs) {
+            registeredAs = regAs;
+            return this;
+        }
+        
+        /**
+         * Build the transports the authenticator can use to communicate with a client.
+         * 
+         * @param trans the transports
+         * 
+         * @return this
+         */
+        @JsonProperty("transports")
+        public Builder withTransports(@Nullable final List<String> trans) {
+            transports = trans;
+            return this;
+        }
+        
+        /**
+         * Build any additional property not explicitly listed.
+         * 
+         * @param name the property name
+         * @param value the property value
+         * 
+         * @return this
+         */
+        @JsonAnySetter
+        public Builder withAdditionalProperty(@Nonnull final String name, @Nullable final Object value) {
+            // Only add properties with non-null values.
+            if (value != null) {
+                additionalProperties.put(name, value);
+            }
+            return this;
+        }
 
+        /**
+         * Build a {@link WebAuthnCredential}.
+         * 
+         * @return an initialised, immutable, and safely published {@link WebAuthnCredential} instance.
+         */
         public WebAuthnCredential build() {
             return new WebAuthnCredential(this);
         }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list