[java-idp-plugin-duo] branch main updated: Fix nimbus client tests and some minor JavaDoc fixes

Phil Smart philip.smart at jisc.ac.uk
Tue Oct 6 14:19:52 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=0b6940ca14493fc6cdf17496eb3e0666165fc396

The following commit(s) were added to refs/heads/main by this push:
       new  0b6940c   Fix nimbus client tests and some minor JavaDoc fixes
0b6940c is described below

commit 0b6940ca14493fc6cdf17496eb3e0666165fc396
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Oct 6 15:19:46 2020 +0100

    Fix nimbus client tests and some minor JavaDoc fixes
---
 .../authn/duo/impl/DefaultDuoOIDCClientRegistry.java     |  4 ++--
 .../plugin/authn/duo/impl/DuoOIDCAuthnController.java    |  3 ---
 .../shibboleth/idp/plugin/authn/duo/impl/DuoSupport.java |  1 -
 .../plugin/authn/duo/impl/ValidateTokenSignature.java    |  4 ++--
 .../idp/plugin/authn/duo/nimbus/NimbusClientTest.java    | 16 ++++++++--------
 5 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DefaultDuoOIDCClientRegistry.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DefaultDuoOIDCClientRegistry.java
index 90aaeae..3d2298b 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DefaultDuoOIDCClientRegistry.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DefaultDuoOIDCClientRegistry.java
@@ -52,10 +52,10 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
  * 
  * <p>The {@link DuoOIDCIntegration} should decide it's own 'business key' using the
  * {@link #equals(Object)} and {@link #hashCode()} method appropriately. The {@link DefaultDuoOIDCIntegration} 
- * uses the clientID as it's key.</p>
+ * uses the clientID as its key.</p>
  * 
  * <p>Supports lazy initialization of clients when they are first requested. A single, configurable, client factory 
- * is called to initilize new clients.</p>
+ * is called to initialize new clients.</p>
  * 
  * <p>Initialization and fetching is thread safe thanks to the use of a {@link ConcurrentMap} and its 
  * {@link ConcurrentMap#computeIfAbsent(Object, Function)} operation. This guarantees that two clients should never
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoOIDCAuthnController.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoOIDCAuthnController.java
index 43ddb1f..c223526 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoOIDCAuthnController.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/DuoOIDCAuthnController.java
@@ -65,9 +65,6 @@ public class DuoOIDCAuthnController extends AbstractInitializableComponent{
     /** The name of the Http parameter that stores the state value.*/
     @Nonnull @NotEmpty public static final String STATE_PARAMETER = "state";
     
-    /** The name of the session attribute that stores the flow execution key.*/ 
-    @Nonnull @NotEmpty public static final String KEY_SESSION_ATTRIBUTE = "key";
-    
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(DuoOIDCAuthnController.class);    
     
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 6377fd5..0229bbd 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
@@ -20,7 +20,6 @@ package net.shibboleth.idp.plugin.authn.duo.impl;
 import java.security.SecureRandom;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 
 import org.apache.commons.codec.DecoderException;
 import org.apache.commons.codec.binary.Hex;
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateTokenSignature.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateTokenSignature.java
index d4f4d6d..b1d3c08 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateTokenSignature.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateTokenSignature.java
@@ -124,7 +124,7 @@ public class ValidateTokenSignature extends AbstractDuoAuthenticationAction {
                         ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
                         return;
                     } else {
-                        log.debug("{} Token signature is valid; using algorithm '{}' for client '{}'",
+                        log.debug("{} Token signature is valid; using algorithm family '{}' for client '{}'",
                                 getLogPrefix(),SUPPORTED_SIGNATURE_FAMILY, integration.getClientId());
                         //is valid
                         return;
@@ -138,7 +138,7 @@ public class ValidateTokenSignature extends AbstractDuoAuthenticationAction {
                     return;
                 }
             } catch (final IllegalStateException | JOSEException e) {
-                log.error("{} Unable to validate token using algorithms '{}' for client '{}'",getLogPrefix(),
+                log.error("{} Unable to validate token using algorithm family '{}' for client '{}'",getLogPrefix(),
                         SUPPORTED_SIGNATURE_FAMILY,integration.getClientId(),e);
                 ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
                 return;
diff --git a/idp-duo-nimbus-client-impl/src/test/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClientTest.java b/idp-duo-nimbus-client-impl/src/test/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClientTest.java
index 46e2cf6..b4f5056 100644
--- a/idp-duo-nimbus-client-impl/src/test/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClientTest.java
+++ b/idp-duo-nimbus-client-impl/src/test/java/net/shibboleth/idp/plugin/authn/duo/nimbus/NimbusClientTest.java
@@ -55,7 +55,7 @@ import org.mockito.Mockito;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.nimbusds.jwt.JWT;
 
 
@@ -180,7 +180,7 @@ public class NimbusClientTest {
                 .thenReturn(httpResponse);
 
         // create new client with mock response
-        client = new NimbusClient(integ, httpClient, null);
+        client = new NimbusClient(integ, httpClient, null, new ObjectMapper());
 
         final JWT jwt = client.exchangeAuthorizationCodeFor2FAResult("code", "jdoe");
         assertNotNull(jwt);
@@ -209,7 +209,7 @@ public class NimbusClientTest {
                 .thenReturn(httpResponse);
 
         // create new client with mock response
-        client = new NimbusClient(integ, httpClient, null);
+        client = new NimbusClient(integ, httpClient, null, new ObjectMapper());
 
         final JWT jwt = client.exchangeAuthorizationCodeFor2FAResult("code", "jdoe");
         
@@ -234,7 +234,7 @@ public class NimbusClientTest {
                 .thenReturn(httpResponse);
         
      // create new client with mock response
-        client = new NimbusClient(integ, httpClient, null);
+        client = new NimbusClient(integ, httpClient, null, new ObjectMapper());
         
         final DuoHealthCheck check = client.healthCheck();
         assertEquals(check.getStatus(), "OK");
@@ -261,7 +261,7 @@ public class NimbusClientTest {
                 .thenReturn(httpResponse);
         
         // create new client with mock response
-        client = new NimbusClient(integ, httpClient, null);
+        client = new NimbusClient(integ, httpClient, null, new ObjectMapper());
         
         final DuoHealthCheck check = client.healthCheck();
         assertEquals(check.getStatus(), "OK");
@@ -288,7 +288,7 @@ public class NimbusClientTest {
                 .thenReturn(httpResponse);
         
         // create new client with mock response
-        client = new NimbusClient(integ, httpClient, null);
+        client = new NimbusClient(integ, httpClient, null, new ObjectMapper());
         
         final DuoHealthCheck check = client.healthCheck();
         assertEquals(check.getStatus(), "FAIL");
@@ -301,7 +301,7 @@ public class NimbusClientTest {
                 (HttpContext) Mockito.any())).thenThrow(IOException.class);
         
         // create new client with mock response
-        client = new NimbusClient(integ, httpClient, null);
+        client = new NimbusClient(integ, httpClient, null, new ObjectMapper());
         
         final DuoHealthCheck check = client.healthCheck();
     }
@@ -314,7 +314,7 @@ public class NimbusClientTest {
     @Test public void testAuthURL() throws DuoClientException {
         final HttpClient httpClient = Mockito.mock(HttpClient.class);
         // create new client with mock response
-        client = new NimbusClient(integ, httpClient, null);
+        client = new NimbusClient(integ, httpClient, null, new ObjectMapper());
         final String authUrl = client.createAuthUrl("jdoe", "RRFSFERGERGSDDSXXXXQWERG");
         assertNotNull(authUrl);
         assertTrue(authUrl.contains("response_type"));

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


More information about the commits mailing list