[java-idp-plugin-duo] branch main updated: Improve annotations, JavaDoc, and some syntax

Phil Smart philip.smart at jisc.ac.uk
Mon Oct 5 12:58:28 UTC 2020


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=3db5cf50766146be89b882d52b74773811b090f8

The following commit(s) were added to refs/heads/main by this push:
       new  3db5cf5   Improve annotations, JavaDoc, and some syntax
3db5cf5 is described below

commit 3db5cf50766146be89b882d52b74773811b090f8
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Oct 5 13:58:20 2020 +0100

    Improve annotations, JavaDoc, and some syntax
---
 .../authn/duo/DefaultDuoOIDCIntegration.java       |  2 +-
 .../plugin/authn/duo/DuoOIDCClientRegistry.java    |  1 -
 .../duo/context/DuoOIDCAuthenticationContext.java  |  2 +-
 .../authn/duo/model/DuoHealthCheckResponse.java    |  2 +
 .../idp/plugin/authn/duo/impl/DuoSupport.java      |  8 +--
 .../authn/duo/sdk/impl/DuoSDKClientAdaptor.java    | 57 +++++++++++++++-------
 .../authn/duo/sdk/impl/DuoSDKClientFactory.java    | 26 +++++++++-
 idp-duo-nimbus-client-impl/pom.xml                 | 18 ++++---
 .../authn/duo/nimbus/DuoHttpClientFactoryBean.java | 18 +++++++
 .../idp/plugin/authn/duo/nimbus/NimbusClient.java  | 28 +++--------
 .../authn/duo/nimbus/NimbusClientFactory.java      | 20 +++++++-
 .../idp/plugin/authn/duo/nimbus/NimbusUtils.java   | 24 +++++++--
 .../idp/plugin/authn/duo/nimbus/TokenResponse.java | 34 +++++++++++++
 13 files changed, 179 insertions(+), 61 deletions(-)

diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DefaultDuoOIDCIntegration.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DefaultDuoOIDCIntegration.java
index 6b22ba5..fa70b88 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DefaultDuoOIDCIntegration.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DefaultDuoOIDCIntegration.java
@@ -37,7 +37,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 /**
- * Mutable wrapper for use with Duo OIDC integrations.
+ * Wrapper for use with Duo OIDC integrations. Class is made effectively immutable once initialized.
  */
 public class DefaultDuoOIDCIntegration extends AbstractInitializableComponent implements DuoOIDCIntegration{
     
diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DuoOIDCClientRegistry.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DuoOIDCClientRegistry.java
index 13cc91c..f2b21ff 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DuoOIDCClientRegistry.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/DuoOIDCClientRegistry.java
@@ -21,7 +21,6 @@ import javax.annotation.Nonnull;
 
 /**
  * A registry of {@link DuoOIDCClient}s for {@link DuoOIDCIntegration}s.
- * TODO check this still makes sense
  */
 public interface DuoOIDCClientRegistry {
     
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 001cfe4..7e23de3 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
@@ -29,7 +29,7 @@ import net.shibboleth.idp.plugin.authn.duo.DuoOIDCClient;
 import net.shibboleth.idp.plugin.authn.duo.DuoOIDCIntegration;
 
 /**
- * <p>Context that carries the Duo integration, request-response state, authorization code,
+ * <p>Mutable Context that carries the Duo integration, request-response state, authorization code,
  *  and Duo authentication result token.</p>
  * 
  * @parent {@link AuthenticationContext}
diff --git a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/DuoHealthCheckResponse.java b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/DuoHealthCheckResponse.java
index 2e46d7c..ea8a338 100644
--- a/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/DuoHealthCheckResponse.java
+++ b/idp-duo-api/src/main/java/net/shibboleth/idp/plugin/authn/duo/model/DuoHealthCheckResponse.java
@@ -3,9 +3,11 @@ package net.shibboleth.idp.plugin.authn.duo.model;
 import javax.annotation.Nonnull;
 import javax.annotation.concurrent.Immutable;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 @Immutable
+ at JsonIgnoreProperties(ignoreUnknown = true)
 public final class DuoHealthCheckResponse {
     
     /** The response timestamp in seconds since Unix EPOCH.*/
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoSupport.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoSupport.java
index 86ac5da..6377fd5 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoSupport.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoSupport.java
@@ -46,7 +46,7 @@ public final class DuoSupport {
      * 
      * @return the randomly generated nonce value.
      */
-    @Nonnull public static String generateNonce(@Nonnull final Integer length) {
+    @Nonnull static String generateNonce(@Nonnull final Integer length) {
         Constraint.isGreaterThan(22, length, "State must be at least 22 characters");
         final SecureRandom secureRandom = new SecureRandom();
         final StringBuilder sb = new StringBuilder();
@@ -70,7 +70,7 @@ public final class DuoSupport {
      * 
      * @return the combined state component.
      */
-    @Nonnull public static String generateState(@Nonnull final String nonce, @Nonnull final String key) {
+    @Nonnull static String generateState(@Nonnull final String nonce, @Nonnull final String key) {
         Constraint.isNotNull(nonce, "NonceHex key can not be null");
         Constraint.isNotNull(key, "Webflow execution key can not be null");
         
@@ -88,7 +88,7 @@ public final class DuoSupport {
      * 
      * @throws DuoException if the key component can not be found, or hex decoding fails.
      */
-    @Nonnull public static String extractKeyFromState(@Nonnull final String state) throws DuoException{
+    @Nonnull static String extractKeyFromState(@Nonnull final String state) throws DuoException{
         Constraint.isNotNull(state, "State can not be null");
         
         final String[] stateSplit = state.split("\\.");
@@ -115,7 +115,7 @@ public final class DuoSupport {
      * 
      * @throws DuoException if the nonce component can not be found.
      */
-    @Nonnull public static String extractNonceFromState(@Nonnull final String state) throws DuoException{
+    @Nonnull static String extractNonceFromState(@Nonnull final String state) throws DuoException{
         Constraint.isNotNull(state, "State can not be null");
 
         final String[] stateSplit = state.split("\\.");
diff --git a/idp-duo-native-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/sdk/impl/DuoSDKClientAdaptor.java b/idp-duo-native-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/sdk/impl/DuoSDKClientAdaptor.java
index 1de0845..ceebaba 100644
--- a/idp-duo-native-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/sdk/impl/DuoSDKClientAdaptor.java
+++ b/idp-duo-native-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/sdk/impl/DuoSDKClientAdaptor.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
 package net.shibboleth.idp.plugin.authn.duo.sdk.impl;
 
 import java.text.ParseException;
@@ -45,7 +63,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
  * <p>An Object Adaptor class for bridging between the Duo SDK implementation 
  * and the internal {@link DuoOIDCClient} interface.</p>
  * 
- * <p>This is package private, and can only be instantiated by the {@link DuoSDKClientFactory}.</p>
+ * <p>This is package private, and can/should only be instantiated by the {@link DuoSDKClientFactory}.</p>
  */
 final class DuoSDKClientAdaptor implements DuoOIDCClient{
     
@@ -53,19 +71,22 @@ final class DuoSDKClientAdaptor implements DuoOIDCClient{
     @Nonnull private Logger log = LoggerFactory.getLogger(DuoSDKClientAdaptor.class);
     
     /** The wrapped Duo native client.*/
-    @Nonnull private Client client;
+    @Nonnull private final Client client;
     
-    /** Function to map the native Duo {@link HealthCheckResponse} object to the interface {@link DuoHealthCheck} object.*/
+    /** 
+     * Function to map the native Duo {@link HealthCheckResponse} object to the 
+     * interface {@link DuoHealthCheck} object.
+     */
     @Nonnull private Function<HealthCheckResponse,DuoHealthCheck> healthCheckResponseConverter;
     
     /** Function to map the native Duo {@link Token} object to the interface {@link JWT} object.*/
     @Nonnull private BiFunction<Token, DuoOIDCIntegration, JWT> tokenResponseConverter;  
     
     /** Save off the integration to help generate the JWT.*/
-    @Nonnull private DuoOIDCIntegration duoIntegration;
+    @Nonnull private final DuoOIDCIntegration duoIntegration;
     
-    /** The client instance UUID.*/
-    @Nonnull private String clientId;
+    /** The client instance UUID for identification.*/
+    @Nonnull private final String clientId;
 
     
     /**
@@ -77,8 +98,9 @@ final class DuoSDKClientAdaptor implements DuoOIDCClient{
      * 
      * @throws DuoClientException if there is an error instantiating the client
      */
-    protected DuoSDKClientAdaptor(@Nonnull final DuoOIDCIntegration integration, @Nullable List<String> caCerts) 
-            throws DuoClientException {  
+    protected DuoSDKClientAdaptor(@Nonnull final DuoOIDCIntegration integration, 
+            @Nullable final List<String> caCerts) throws DuoClientException {
+        
         duoIntegration = Constraint.isNotNull(integration,"Duo SDK Client requires a non-null Duo Integration");
         healthCheckResponseConverter = new DefaultHealthCheckResponseConverter();
         tokenResponseConverter = new DefaultTokenResponseConverter();
@@ -88,8 +110,7 @@ final class DuoSDKClientAdaptor implements DuoOIDCClient{
             if (caCerts == null) {
                 client = new Client(integration.getClientId(), integration.getSecretKey(),
                     integration.getAPIHost(), integration.getRedirectURI());
-            }
-            else {
+            } else {
                 client = new Client(integration.getClientId(), integration.getSecretKey(),
                         integration.getAPIHost(), integration.getRedirectURI(), 
                         caCerts.toArray(new String[caCerts.size()]));
@@ -109,7 +130,8 @@ final class DuoSDKClientAdaptor implements DuoOIDCClient{
      */
     public void setHealthCheckResponseConverter(@Nonnull final 
             Function<HealthCheckResponse,DuoHealthCheck> converter) {        
-        healthCheckResponseConverter = Constraint.isNotNull(converter, "Health Check response converter can not be null");
+        healthCheckResponseConverter = Constraint.isNotNull(converter, 
+                "Health Check response converter can not be null");
     }
 
     /** {@inheritDoc} */
@@ -154,7 +176,7 @@ final class DuoSDKClientAdaptor implements DuoOIDCClient{
             }
             final JWT tokenAsJWT = tokenResponseConverter.apply(token,duoIntegration);
             if (tokenAsJWT == null) {
-                throw new DuoClientException("Duo token could not be converted to a JWT token");
+                throw new DuoClientException("Duo token could not be converted to a JWT");
             }
             return tokenAsJWT;
          } catch (final DuoException e) {
@@ -165,11 +187,10 @@ final class DuoSDKClientAdaptor implements DuoOIDCClient{
 
 
     /** Default health check response converter. */
-    //TODO do we need this extensible in an adaptor?
     private class DefaultHealthCheckResponseConverter implements Function<HealthCheckResponse,DuoHealthCheck>{
 
         @Override
-        public DuoHealthCheck apply(HealthCheckResponse response) {
+        public DuoHealthCheck apply(@Nonnull final HealthCheckResponse response) {
             
             Integer responseTimestamp = null;
             if (response.getResponse()!=null) {
@@ -185,10 +206,10 @@ final class DuoSDKClientAdaptor implements DuoOIDCClient{
 
     /**
      * Default Duo token converter. Creates a JWT by converting the Duo token (back) to a JSON String which it uses to
-     * create a **signed** JWT. As the signature is not returned from the Duo SDK, a new HMAC signature is computed
-     * using the integrations secret key - the flow requires a signed JWT.
+     * create a **signed** JWT. As the signature is not returned from the Duo SDK and the flow requires a signed JWT, 
+     * a new HMAC signature is computed using the integrations secret key.
      */
-    private class DefaultTokenResponseConverter implements BiFunction<Token, DuoOIDCIntegration, JWT>{
+    private final class DefaultTokenResponseConverter implements BiFunction<Token, DuoOIDCIntegration, JWT>{
         
         /** JSON object mapper. */
         @Nonnull private ObjectMapper objectMapper;
@@ -199,7 +220,7 @@ final class DuoSDKClientAdaptor implements DuoOIDCClient{
         }
     
         @Override
-        @Nullable public JWT apply(final Token t, final DuoOIDCIntegration integ) {                 
+        @Nullable public JWT apply(@Nonnull final Token t, @Nonnull final DuoOIDCIntegration integ) {                 
             try {               
                 final String duoTokenAsJson = objectMapper.writeValueAsString(t);
                 //re-sign the token using the client secret
diff --git a/idp-duo-native-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/sdk/impl/DuoSDKClientFactory.java b/idp-duo-native-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/sdk/impl/DuoSDKClientFactory.java
index 3e3cae5..2304121 100644
--- a/idp-duo-native-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/sdk/impl/DuoSDKClientFactory.java
+++ b/idp-duo-native-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/sdk/impl/DuoSDKClientFactory.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
 package net.shibboleth.idp.plugin.authn.duo.sdk.impl;
 
 import java.util.List;
@@ -12,6 +31,8 @@ import net.shibboleth.idp.plugin.authn.duo.DuoClientException;
 import net.shibboleth.idp.plugin.authn.duo.DuoOIDCClient;
 import net.shibboleth.idp.plugin.authn.duo.DuoOIDCClientFactory;
 import net.shibboleth.idp.plugin.authn.duo.DuoOIDCIntegration;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 
@@ -22,7 +43,7 @@ public class DuoSDKClientFactory implements DuoOIDCClientFactory{
     @Nonnull private final Logger log = LoggerFactory.getLogger(DuoSDKClientFactory.class);     
     
     /** List of CA Certificate pins. If null, the client's default set are used.*/
-    @Nullable private List<String> caCerts;
+    @Nullable @NonnullElements @Unmodifiable private List<String> caCerts;
     
     
     /**
@@ -43,7 +64,8 @@ public class DuoSDKClientFactory implements DuoOIDCClientFactory{
     }
 
     @Override
-    @Nonnull public DuoOIDCClient createInstance(@Nonnull final DuoOIDCIntegration integration) throws DuoClientException {
+    @Nonnull public DuoOIDCClient createInstance(@Nonnull final DuoOIDCIntegration integration) 
+            throws DuoClientException {
         //every integration shares the same list of caCert pins.
         return new DuoSDKClientAdaptor(integration, caCerts);
     }
diff --git a/idp-duo-nimbus-client-impl/pom.xml b/idp-duo-nimbus-client-impl/pom.xml
index fb416d6..7967987 100644
--- a/idp-duo-nimbus-client-impl/pom.xml
+++ b/idp-duo-nimbus-client-impl/pom.xml
@@ -27,7 +27,16 @@
             <groupId>com.nimbusds</groupId>
             <artifactId>nimbus-jose-jwt</artifactId>
             <version>9.0</version>
-        </dependency>        
+        </dependency>    
+        
+        <!-- REMOVE THIS FOR NIMBUS, USED TO GET SIGNATURES WORKING -->
+         <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>3.10.3</version>
+        </dependency>
+        <!--  DONE -->
+            
         <!-- provided dependencies -->
         <dependency>
             <groupId>com.google.code.findbugs</groupId>
@@ -61,13 +70,6 @@
         </dependency>
         <!-- Test dependencies -->
         
-        <!-- REMOVE THESE FOR NIMBUS, JUST TO GET IT WORKING -->
-         <dependency>
-            <groupId>com.auth0</groupId>
-            <artifactId>java-jwt</artifactId>
-            <version>3.10.3</version>
-             <scope>provided</scope>
-        </dependency>
        
 
     </dependencies>
diff --git a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/DuoHttpClientFactoryBean.java b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/DuoHttpClientFactoryBean.java
index d2e98fd..44b5149 100644
--- a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/DuoHttpClientFactoryBean.java
+++ b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/DuoHttpClientFactoryBean.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
 package net.shibboleth.idp.plugin.authn.duo.nimbus;
 
 import net.shibboleth.idp.plugin.authn.duo.Version;
diff --git a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClient.java b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClient.java
index c90522d..a9f9666 100644
--- a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClient.java
+++ b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClient.java
@@ -15,23 +15,6 @@
  * limitations under the License.
  */
 
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements.  See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
 package net.shibboleth.idp.plugin.authn.duo.nimbus;
 
 import java.io.IOException;
@@ -86,19 +69,19 @@ final class NimbusClient implements DuoOIDCClient{
     @Nonnull private Logger log = LoggerFactory.getLogger(NimbusClient.class);
     
     /** The integration to help generate the JWT.*/
-    @Nonnull private DuoOIDCIntegration duoIntegration;
+    @Nonnull private final DuoOIDCIntegration duoIntegration;
     
     /** HttpClient for contacting Duo. */
-    @Nonnull private HttpClient httpClient;
+    @Nonnull private final HttpClient httpClient;
 
     /** HTTP client security parameters. */
-    @Nullable private HttpClientSecurityParameters httpClientSecurityParameters;
+    @Nullable private final HttpClientSecurityParameters httpClientSecurityParameters;
     
     /** JSON object mapper. */
     @Nonnull private ObjectMapper objectMapper;
     
     /** The client instance UUID.*/
-    @Nonnull private String clientId;
+    @Nonnull private final String clientId;
 
     /**
      * Constructor.
@@ -107,7 +90,7 @@ final class NimbusClient implements DuoOIDCClient{
      * @param client the Http client to use to execute HTTP requests, never {@code null}
      * @param params any security parameters to use for the Http client, can be {@code null}.
      */
-    public NimbusClient(@Nonnull final DuoOIDCIntegration integration, @Nonnull final HttpClient client,
+    protected NimbusClient(@Nonnull final DuoOIDCIntegration integration, @Nonnull final HttpClient client,
             @Nullable final HttpClientSecurityParameters params) {
         duoIntegration = Constraint.isNotNull(integration,"Nimbus Client requires a non-null Duo Integration");
         httpClient =  Constraint.isNotNull(client,"Nimbus Client requires a non-null http client");
@@ -122,6 +105,7 @@ final class NimbusClient implements DuoOIDCClient{
      * 
      * @param mapper object mapper
      */
+    //TODO: should be set once before init and not after?
     public void setObjectMapper(@Nonnull final ObjectMapper mapper) {
         objectMapper = Constraint.isNotNull(mapper, "Object mapper cannot be null");
     }
diff --git a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClientFactory.java b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClientFactory.java
index dd93d91..c4bee67 100644
--- a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClientFactory.java
+++ b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClientFactory.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
 package net.shibboleth.idp.plugin.authn.duo.nimbus;
 
 import javax.annotation.Nonnull;
@@ -20,7 +38,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
 
 
 /** 
- * <p>Abstract factory implementation for the {@link NimbusClient}.</p>
+ * <p>Abstract factory implementation for creating new {@link NimbusClient}s.</p>
  * 
  * <p>Each client instance shares the same, thread-safe, http client and object mapper.</p>
  */
diff --git a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusUtils.java b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusUtils.java
index fc90ff3..119ad93 100644
--- a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusUtils.java
+++ b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusUtils.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
 package net.shibboleth.idp.plugin.authn.duo.nimbus;
 
 import java.security.SecureRandom;
@@ -30,7 +48,7 @@ public final class NimbusUtils {
      * 
      * @return a cryptographically strong random JWT identifier.
      */
-    static String generateJWTId(@Nonnull final Integer length){
+    @Nonnull static String generateJWTId(@Nonnull final Integer length){
         Constraint.isNotNull(length, "JWT length can not be null");
         final SecureRandom secureRandom = new SecureRandom();
         final StringBuilder sb = new StringBuilder();
@@ -50,7 +68,7 @@ public final class NimbusUtils {
      * @return a signed JWT
      */
     //TODO this method and the below should be nimbus, inside oidc-commons, and merged into a single API
-    static String createJWSRequestObject(@Nonnull final DuoOIDCIntegration duoIntegration, 
+    @Nonnull static String createJWSRequestObject(@Nonnull final DuoOIDCIntegration duoIntegration, 
             @Nonnull final String state, @Nonnull final String username) {
         final Date expiration = new Date();
         expiration.setTime(expiration.getTime() + Duration.ofHours(1).toMillis());
@@ -78,7 +96,7 @@ public final class NimbusUtils {
      * 
      */
     //TODO: replace with nimbus method inside of commons 
-    static String createJWS(@Nonnull final String aud, 
+    @Nonnull static String createJWS(@Nonnull final String aud, 
             @Nonnull final DuoOIDCIntegration duoIntegration) {
         
         final Date expiration = new Date();
diff --git a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/TokenResponse.java b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/TokenResponse.java
index c14199a..2476dc8 100644
--- a/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/TokenResponse.java
+++ b/idp-duo-nimbus-client-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/nimbus/TokenResponse.java
@@ -1,3 +1,37 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package net.shibboleth.idp.plugin.authn.duo.nimbus;
 
 import javax.annotation.Nonnull;

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


More information about the commits mailing list