[java-idp-oidc] branch main updated: JCOMOIDC-38 - Move various support classes from the OP plugin

Phil Smart philip.smart at jisc.ac.uk
Fri Mar 18 10:32:06 UTC 2022


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

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

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

The following commit(s) were added to refs/heads/main by this push:
     new d461ed2c JCOMOIDC-38 - Move various support classes from the OP plugin
d461ed2c is described below

commit d461ed2c605fd0bd5225b95fffc88bed243f2a4f
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Mar 18 10:32:00 2022 +0000

    JCOMOIDC-38 - Move various support classes from the OP plugin
    
     - Move OAuth2ClientAuthenticationContext into commons and relink
    
    https://shibboleth.atlassian.net/browse/JCOMOIDC-38
---
 .../context/OAuth2ClientAuthenticationContext.java | 64 ----------------------
 .../ExtractClientAuthenticationFromRequest.java    |  5 +-
 .../oidc/op/authn/impl/JWTCredentialValidator.java |  2 +-
 .../impl/ValidateClientAuthenticationType.java     |  4 +-
 ...ExtractClientAuthenticationFromRequestTest.java |  2 +-
 .../op/authn/impl/JWTCredentialValidatorTest.java  |  5 +-
 .../impl/ValidateClientAuthenticationTypeTest.java |  2 +-
 7 files changed, 11 insertions(+), 73 deletions(-)

diff --git a/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/context/OAuth2ClientAuthenticationContext.java b/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/context/OAuth2ClientAuthenticationContext.java
deleted file mode 100644
index 9c7587d8..00000000
--- a/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/context/OAuth2ClientAuthenticationContext.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.oidc.op.authn.context;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.BaseContext;
-
-import com.nimbusds.oauth2.sdk.auth.ClientAuthentication;
-
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-
-/**
- * A context containing data about OAuth 2.0 client authentication.
- * 
- * <p>Currently implemented using Nimbus APIs.</p> 
- * 
- * @parent {@link AuthenticationContext}
- * @added During an OAuth 2.0 authentication attempt
- */
-public final class OAuth2ClientAuthenticationContext extends BaseContext {
-    
-    /** Client authentication abstraction. */
-    @Nullable private ClientAuthentication clientAuthentication;
-    
-    /**
-     * Get the OAuth 2 client authentication credentials.
-     * 
-     * @return client authentication credentials
-     */
-    @Nullable public ClientAuthentication getClientAuthentication() {
-        return clientAuthentication;
-    }
-
-    /**
-     * Set the OAuth 2 client authentication credentials.
-     * 
-     * @param creds client authentication credentials
-     * 
-     * @return this context
-     */
-    @Nonnull public OAuth2ClientAuthenticationContext setClientAuthentication(
-            @Nullable final ClientAuthentication creds) {
-        clientAuthentication = creds;
-        return this;
-    }
-
-}
\ No newline at end of file
diff --git a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ExtractClientAuthenticationFromRequest.java b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ExtractClientAuthenticationFromRequest.java
index ba846fa5..91b08341 100644
--- a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ExtractClientAuthenticationFromRequest.java
+++ b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ExtractClientAuthenticationFromRequest.java
@@ -38,7 +38,8 @@ import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.authn.context.CertificateContext;
 import net.shibboleth.idp.authn.context.UsernamePasswordContext;
-import net.shibboleth.idp.plugin.oidc.op.authn.context.OAuth2ClientAuthenticationContext;
+import net.shibboleth.oidc.authn.context.OAuth2ClientAuthenticationContext;
+
 
 /**
  * Extracts OAuth 2 client authentication details from a request and stores them in an
@@ -60,7 +61,7 @@ import net.shibboleth.idp.plugin.oidc.op.authn.context.OAuth2ClientAuthenticatio
 public class ExtractClientAuthenticationFromRequest extends AbstractExtractionAction {
 
     /** Class logger. */
-    @Nonnull private Logger log = LoggerFactory.getLogger(ExtractClientAuthenticationFromRequest.class);
+    @Nonnull private final Logger log = LoggerFactory.getLogger(ExtractClientAuthenticationFromRequest.class);
     
     /** Message to extract credentials from. */
     @Nullable private AbstractOptionallyAuthenticatedRequest request;
diff --git a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/JWTCredentialValidator.java b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/JWTCredentialValidator.java
index c8ada4dd..03db10f7 100644
--- a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/JWTCredentialValidator.java
+++ b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/JWTCredentialValidator.java
@@ -29,7 +29,7 @@ import net.shibboleth.idp.authn.AbstractCredentialValidator;
 import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.authn.principal.UsernamePrincipal;
-import net.shibboleth.idp.plugin.oidc.op.authn.context.OAuth2ClientAuthenticationContext;
+import net.shibboleth.oidc.authn.context.OAuth2ClientAuthenticationContext;
 import net.shibboleth.idp.profile.context.RelyingPartyContext;
 import net.shibboleth.oidc.jwt.claims.ClaimsValidator;
 import net.shibboleth.oidc.jwt.claims.JWTValidationException;
diff --git a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ValidateClientAuthenticationType.java b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ValidateClientAuthenticationType.java
index f508b043..ff7ce5bc 100644
--- a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ValidateClientAuthenticationType.java
+++ b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ValidateClientAuthenticationType.java
@@ -38,7 +38,7 @@ import com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadata;
 
 import net.shibboleth.idp.authn.AbstractAuthenticationAction;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.plugin.oidc.op.authn.context.OAuth2ClientAuthenticationContext;
+import net.shibboleth.oidc.authn.context.OAuth2ClientAuthenticationContext;
 import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCMetadataContext;
 import net.shibboleth.oidc.profile.config.navigate.TokenEndpointAuthMethodLookupFunction;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
@@ -59,7 +59,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
 public class ValidateClientAuthenticationType extends AbstractAuthenticationAction {
 
     /** Class logger. */
-    @Nonnull private Logger log = LoggerFactory.getLogger(ValidateClientAuthenticationType.class);
+    @Nonnull private final Logger log = LoggerFactory.getLogger(ValidateClientAuthenticationType.class);
     
     /** Strategy that will return {@link OIDCMetadataContext}. */
     @Nonnull private Function<ProfileRequestContext,OIDCMetadataContext> oidcMetadataContextLookupStrategy;
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ExtractClientAuthenticationFromRequestTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ExtractClientAuthenticationFromRequestTest.java
index 6c7a9e7e..8f948838 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ExtractClientAuthenticationFromRequestTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ExtractClientAuthenticationFromRequestTest.java
@@ -51,7 +51,7 @@ import com.nimbusds.oauth2.sdk.id.ClientID;
 import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.authn.context.UsernamePasswordContext;
-import net.shibboleth.idp.plugin.oidc.op.authn.context.OAuth2ClientAuthenticationContext;
+import net.shibboleth.oidc.authn.context.OAuth2ClientAuthenticationContext;
 import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
 import net.shibboleth.idp.profile.testing.ActionTestingSupport;
 import net.shibboleth.idp.profile.testing.RequestContextBuilder;
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/JWTCredentialValidatorTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/JWTCredentialValidatorTest.java
index 4aefc003..d9e727b4 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/JWTCredentialValidatorTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/JWTCredentialValidatorTest.java
@@ -68,7 +68,7 @@ import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.authn.impl.ValidateCredentials;
 import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
 import net.shibboleth.idp.authn.principal.UsernamePrincipal;
-import net.shibboleth.idp.plugin.oidc.op.authn.context.OAuth2ClientAuthenticationContext;
+import net.shibboleth.oidc.authn.context.OAuth2ClientAuthenticationContext;
 import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCMetadataContext;
 import net.shibboleth.idp.profile.context.RelyingPartyContext;
 import net.shibboleth.idp.profile.context.navigate.RelyingPartyIdLookupFunction;
@@ -106,13 +106,14 @@ public class JWTCredentialValidatorTest extends BaseAuthenticationContextTest {
     
     @BeforeClass
     public void initKeys() throws NoSuchAlgorithmException {
-        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+        final KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
         keyGen.initialize(2048);
         final KeyPair keyPair = keyGen.genKeyPair();
         rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
         rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
     }
     
+    @Override
     @BeforeMethod
     public void setUp() throws ComponentInitializationException {
         super.setUp();
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ValidateClientAuthenticationTypeTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ValidateClientAuthenticationTypeTest.java
index 44a5d1a0..af94d430 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ValidateClientAuthenticationTypeTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/authn/impl/ValidateClientAuthenticationTypeTest.java
@@ -40,7 +40,7 @@ import com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadata;
 
 import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.plugin.oidc.op.authn.context.OAuth2ClientAuthenticationContext;
+import net.shibboleth.oidc.authn.context.OAuth2ClientAuthenticationContext;
 import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCMetadataContext;
 import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
 import net.shibboleth.idp.profile.testing.ActionTestingSupport;

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


More information about the commits mailing list