[java-idp-plugin-duo] branch main updated: Javadoc and null issues.

Codeberg noreply at shibboleth.net
Mon Sep 14 13:07:38 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-duo/commit/155a0c2c0c27619dc4ce656a745f31a156d4a6f5

The following commit(s) were added to refs/heads/main by this push:
     new 155a0c2c Javadoc and null issues.
155a0c2c is described below

commit 155a0c2c0c27619dc4ce656a745f31a156d4a6f5
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Mon Sep 14 08:55:58 2026 -0400

    Javadoc and null issues.
---
 .../idp/plugin/authn/duo/DuoOIDCClient.java        |  10 +-
 .../duo/context/DuoOIDCAuthenticationContext.java  |   6 +-
 .../idp/plugin/authn/duo/model/U2ftoken.java       |  27 +++-
 .../idp/plugin/authn/duo/model/User.java           | 149 +++++++++++++++++++++
 .../authn/duo/admin/impl/AdminFlowDescriptor.java  |   2 +-
 .../duo/impl/PopulateDuoAuthenticationContext.java |   3 +-
 .../impl/PostValidatePasswordlessEvaluation.java   |   2 +-
 .../impl/ValidateDuoTokenAuthenticationResult.java |   4 +-
 8 files changed, 189 insertions(+), 14 deletions(-)

diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DuoOIDCClient.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DuoOIDCClient.java
index b86de82b..e1b5319a 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DuoOIDCClient.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DuoOIDCClient.java
@@ -76,7 +76,7 @@ public interface DuoOIDCClient extends DuoOIDCClientCapabilities{
      * Constructs an authorization redirection URL string with the query parameters required to initiate 
      * a Duo 2FA request.
      * 
-     * @param authOptions the set of authentication options to use for authentication request construction.
+     * @param options the set of authentication options to use for authentication request construction.
      * 
      * @return the authorization redirect URL as a string, never {@code null}.
      * 
@@ -87,8 +87,12 @@ public interface DuoOIDCClient extends DuoOIDCClientCapabilities{
     //TODO reverse the defaulted call to the old method in 3.0.0
     @Nonnull @NotEmpty default String createAuthUrl(@Nonnull final AuthenticationRequestOptions options) 
     			throws DuoClientException {
-    	return createAuthUrl(options.getUsername(), options.getState(), 
-    			options.getNonce(), options.getRedirectURIOverride());
+        final String username = options.getUsername();
+        final String state = options.getState();
+        if (username == null || state == null) {
+            throw new DuoClientException("Duo Client options contained a null username or state field");
+        }
+    	return createAuthUrl(username, state, options.getNonce(), options.getRedirectURIOverride());
     }
    
     
diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/context/DuoOIDCAuthenticationContext.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/context/DuoOIDCAuthenticationContext.java
index 74783b0a..4cf48503 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/context/DuoOIDCAuthenticationContext.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/context/DuoOIDCAuthenticationContext.java
@@ -90,9 +90,7 @@ public final class DuoOIDCAuthenticationContext extends BaseContext {
      */
     @Nullable private Duration maxAge;
     
-    /** 
-     * The prompt request parameter. 
-     */
+    /**  The prompt request parameter. */
     @Nullable private String prompt;
 
     /** Public no-arg constructor to allow auto-creation. */
@@ -345,6 +343,8 @@ public final class DuoOIDCAuthenticationContext extends BaseContext {
      * 
      * @param time the time the request was made
      * 
+     * @return this context
+     * 
      * @since 2.4.0
      */
     @Nonnull public DuoOIDCAuthenticationContext setAuthnRequestTime(@Nullable final Instant time) {
diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/U2ftoken.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/U2ftoken.java
index 588fa041..5ed9d7f3 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/U2ftoken.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/U2ftoken.java
@@ -81,32 +81,51 @@ public class U2ftoken {
     /** Builder used to build an instance of this class.*/
     @JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with")
     public static final class Builder {
+        
+        /** Data token was registered. */
         private Integer dateAdded;
+        
+        /** Registraton ID */
         private String registrationId;
 
         /** Constructor.*/
         private Builder() {
         }
 
+        /**
+         * Adds the registration date to the builder.
+         * 
+         * @param dateAdded token registration date
+         * 
+         * @return this builder
+         */
         @JsonProperty("date_added")
         public Builder withDateAdded(final Integer dateAdded) {
             this.dateAdded = dateAdded;
             return this;
         }
 
+        /**
+         * Adds registration ID to the builder
+         * 
+         * @param registrationId registration ID
+         * 
+         * @return this builder
+         */
         @JsonProperty("registration_id")
         public Builder withRegistrationId(final String registrationId) {
             this.registrationId = registrationId;
             return this;
         }
 
+        /**
+         * Builds the object.
+         * 
+         * @return the built object
+         */
         public U2ftoken build() {
             return new U2ftoken(this);
         }
     }
 
-
-    
-    
-
 }
diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/User.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/User.java
index be6b357e..29cd6e6f 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/User.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/User.java
@@ -326,21 +326,52 @@ public final class User {
     @JsonIgnoreProperties(ignoreUnknown = true) 
     public static final class Builder {
         
+        /** Creation time. */
         @Nullable private Integer created;
+        
+        /** Email address. */
         @Nullable private String email;
+        
+        /** First name. */
         @Nullable private String firstname;
+
+        /** Enrollment flag.. */
         @Nullable private Boolean enrolled;
+        
+        /** Last directory sync time. */
         @Nullable private Object lastDirectorySync;
+        
+        /** Last login time. */
         @Nullable private Integer lastLogin;
+        
+        /** Last name. */
         @Nullable private String lastname;
+        
+        /** Lockout reason.. */
         @Nullable private String lockoutReason;
+        
+        /** Notes. */
         @Nullable private String notes;
+        
+        /** Real name. */
         @Nullable private String realname;
+        
+        /** Status. */
         @Nullable private String status;
+        
+        /** Registrered U2F tokens.. */
         @Nonnull private List<U2ftoken> u2ftokens;
+        
+        /** User ID. */
         @Nullable private String userId;
+        
+        /** Username. */
         @Nullable private String username;
+        
+        /** WebAuthn tokens. */
         @Nonnull private List<WebAuthnCredential> webAuthnCredentials;
+        
+        /** Additional properties. */
         @Nonnull private final Map<String, Object> additionalProperties;
 
         /** Constructor.*/
@@ -350,72 +381,156 @@ public final class User {
             u2ftokens = CollectionSupport.emptyList();
         }
 
+        /**
+         * Adds user creation time.
+         * 
+         * @param createdAt creation time
+         * 
+         * @return this builder
+         */
         @JsonProperty("created")
         public Builder withCreated(@Nullable final Integer createdAt) {
             created = createdAt;
             return this;
         }
 
+        /**
+         * Adds email address.
+         * 
+         * @param emailIn email address
+         * 
+         * @return this builder
+         */
         @JsonProperty("email")
         public Builder withEmail(@Nullable final String emailIn) {
             email = emailIn;
             return this;
         }
 
+        /**
+         * Adds first name.
+         * 
+         * @param firstnameIn first name
+         * 
+         * @return this builder
+         */
         @JsonProperty("firstname")
         public Builder withFirstname(@Nullable final String firstnameIn) {
             firstname = firstnameIn;
             return this;
         }
 
+        /**
+         * Adds enrollment flag.
+         * 
+         * @param isEnrolled enrollment flag
+         * 
+         * @return this builder
+         */
         @JsonProperty("is_enrolled")
         public Builder withIsEnrolled(@Nullable final Boolean isEnrolled) {
             enrolled = isEnrolled;
             return this;
         }
 
+        /**
+         * Adds last directory sync time.
+         * 
+         * @param dirSync sync time
+         * 
+         * @return this builder
+         */
         @JsonProperty("last_directory_sync")
         public Builder withLastDirectorySync(@Nullable final Object dirSync) {
             lastDirectorySync = dirSync;
             return this;
         }
 
+        /**
+         * Adds last login time.
+         * 
+         * @param lastLoginAt last login time
+         * 
+         * @return this builder
+         */
         @JsonProperty("last_login")
         public Builder withLastLogin(@Nullable final Integer lastLoginAt) {
             lastLogin = lastLoginAt;
             return this;
         }
 
+        /**
+         * Adds last name.
+         * 
+         * @param lastnameIn last name
+         * 
+         * @return this builder
+         */
         @JsonProperty("lastname")
         public Builder withLastname(@Nullable final String lastnameIn) {
             lastname = lastnameIn;
             return this;
         }
 
+        /**
+         * Adds account lockout reason.
+         * 
+         * @param lockoutReasonIn lockout reason
+         * 
+         * @return this builder
+         */
         @JsonProperty("lockout_reason")
         public Builder withLockoutReason(@Nullable final String lockoutReasonIn) {
             lockoutReason = lockoutReasonIn;
             return this;
         }
 
+        /**
+         * Adds notes.
+         * 
+         * @param notesIn notes
+         * 
+         * @return this builder
+         */
         @JsonProperty("notes")
         public Builder withNotes(@Nullable final String notesIn) {
             notes = notesIn;
             return this;
         }
 
+        /**
+         * Adds real name.
+         * 
+         * @param realnameIn real name
+         * 
+         * @return this builder
+         */
         @JsonProperty("realname")
         public Builder withRealname(@Nullable final String realnameIn) {
             realname = realnameIn;
             return this;
         }
 
+        /**
+         * Adds status.
+         * 
+         * @param statusIn status
+         * 
+         * @return this builder
+         */
         @JsonProperty("status")
         public Builder withStatus(@Nullable final String statusIn) {
             status = statusIn;
             return this;
         }
 
+        /**
+         * Adds list of U2F tokens
+         * 
+         * @param tokens U2F tokens
+         * 
+         * @return this builder
+         */
         @JsonProperty("u2ftokens")
         public Builder withU2ftokens(@Nullable final List<U2ftoken> tokens) {
             if (tokens != null) {
@@ -424,18 +539,39 @@ public final class User {
             return this;
         }
 
+        /**
+         * Adds user ID.
+         * 
+         * @param id user ID
+         * 
+         * @return this builder
+         */
         @JsonProperty("user_id")
         public Builder withUserId(@Nullable final String id) {
             userId = id;
             return this;
         }
 
+        /**
+         * Adds username.
+         * 
+         * @param uname username
+         * 
+         * @return this builder
+         */
         @JsonProperty("username")
         public Builder withUsername(@Nullable final String uname) {
             username = uname;
             return this;
         }
 
+        /**
+         * Adds list of WebAuthn credentials.
+         * 
+         * @param credentials WebAuthn credentials
+         * 
+         * @return this builder
+         */
         @JsonProperty("webauthncredentials")
         public Builder withWebAuthnCredentials(@Nullable final List<WebAuthnCredential> credentials) {
             if (credentials != null) {
@@ -444,6 +580,14 @@ public final class User {
             return this;
         }
         
+        /**
+         * Adds an additional propery
+         * 
+         * @param name property name
+         * @param value property value
+         * 
+         * @return this builder
+         */
         @JsonAnySetter
         public Builder withAdditionalProperty(@Nonnull final String name, @Nullable final Object value) {
             // Only add properties with non-null values.
@@ -453,6 +597,11 @@ public final class User {
             return this;
         }
 
+        /**
+         * Build the object.
+         * 
+         * @return built object
+         */
         public User build() {
             return new User(this);
         }
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/admin/impl/AdminFlowDescriptor.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/admin/impl/AdminFlowDescriptor.java
index 02272b70..451d9efa 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/admin/impl/AdminFlowDescriptor.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/admin/impl/AdminFlowDescriptor.java
@@ -41,7 +41,7 @@ public class AdminFlowDescriptor extends BasicAdministrativeFlowDescriptor {
     /**
      * Constructor.
      *
-     * @param id
+     * @param id unique ID
      */
     public AdminFlowDescriptor(@Nonnull @NotEmpty final String id) {
         super(id);
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/PopulateDuoAuthenticationContext.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/PopulateDuoAuthenticationContext.java
index 176c98ac..0276cf89 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/PopulateDuoAuthenticationContext.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/PopulateDuoAuthenticationContext.java
@@ -318,7 +318,8 @@ public class PopulateDuoAuthenticationContext extends AbstractAuthenticationActi
      */
     private void determinePromptRequirement(@Nonnull final DuoOIDCAuthenticationContext duoContext) {
     	
-    	if (duoContext.getMaxAge() != null && duoContext.getMaxAge().isZero()) {
+        final Duration maxAge = duoContext.getMaxAge();
+    	if (maxAge != null && maxAge.isZero()) {
     		log.trace("{} Maximum authentication age is 0, setting prompt to 'login'");
     		duoContext.setPrompt("login");
     	}
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/PostValidatePasswordlessEvaluation.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/PostValidatePasswordlessEvaluation.java
index 8ffb356c..35e15ba2 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/PostValidatePasswordlessEvaluation.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/PostValidatePasswordlessEvaluation.java
@@ -113,7 +113,7 @@ public class PostValidatePasswordlessEvaluation extends AbstractAuthenticationAc
     /**
      * Set condition governing eligibility for passwordless opt-in.
      * 
-     * @param condition
+     * @param condition condition to set
      */
     public void setPasswordlessCondition(@Nonnull final Predicate<ProfileRequestContext> condition) {
         checkSetterPreconditions();
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateDuoTokenAuthenticationResult.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateDuoTokenAuthenticationResult.java
index 91ba244a..54a481ee 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateDuoTokenAuthenticationResult.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateDuoTokenAuthenticationResult.java
@@ -237,7 +237,9 @@ public class ValidateDuoTokenAuthenticationResult extends AbstractAuditingValida
                 if (authTime != null) {
                 	log.trace("{} Resetting authentication time to Duo value: {}", getLogPrefix(), authTime);
                 	final AuthenticationResult ar = authenticationContext.getAuthenticationResult();
-                	ar.setAuthenticationInstant(authTime);
+                	if (ar != null) {
+                	    ar.setAuthenticationInstant(authTime);
+                	}
                 }
                 
                 recordSuccess(profileRequestContext);

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


More information about the commits mailing list