[java-idp-plugin-oidc-rp] branch main updated: Use test credential helper from oidc-common
Phil Smart
philip.smart at jisc.ac.uk
Mon Mar 6 16:44:47 UTC 2023
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-idp-plugin-oidc-rp.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-oidc-rp.git;a=commit;h=b0821e247337b8e49dfa304988589365548dfef9
The following commit(s) were added to refs/heads/main by this push:
new b0821e2 Use test credential helper from oidc-common
b0821e2 is described below
commit b0821e247337b8e49dfa304988589365548dfef9
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Mar 6 16:44:45 2023 +0000
Use test credential helper from oidc-common
---
.../authn/oidc/rp/config/logic/package-info.java | 21 ---
idp-oidc-rp-impl/pom.xml | 8 +-
.../authn/oidc/rp/impl/AbstractOIDCTest.java | 1 +
.../oidc/rp/impl/AuthorizationControllerTest.java | 1 +
.../OIDCRPFlowFromAuthenticationResponseTest.java | 1 +
.../plugin/authn/oidc/rp/impl/OIDCRPFlowTest.java | 1 +
.../authn/oidc/rp/impl/TestCredentialHelper.java | 147 ---------------------
pom.xml | 7 +
8 files changed, 18 insertions(+), 169 deletions(-)
diff --git a/idp-oidc-rp-api/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/logic/package-info.java b/idp-oidc-rp-api/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/logic/package-info.java
deleted file mode 100644
index 9c505b0..0000000
--- a/idp-oidc-rp-api/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/logic/package-info.java
+++ /dev/null
@@ -1,21 +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 that contains predicates related to configuration logic.
- */
-package net.shibboleth.idp.plugin.authn.oidc.rp.config.logic;
\ No newline at end of file
diff --git a/idp-oidc-rp-impl/pom.xml b/idp-oidc-rp-impl/pom.xml
index 08a44a8..fc26154 100644
--- a/idp-oidc-rp-impl/pom.xml
+++ b/idp-oidc-rp-impl/pom.xml
@@ -70,7 +70,7 @@
<groupId>net.shibboleth.oidc</groupId>
<artifactId>oidc-common-crypto-api</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>net.shibboleth.oidc</groupId>
<artifactId>oidc-common-metadata-impl</artifactId>
@@ -142,6 +142,12 @@
<artifactId>idp-attribute-filter-spring</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>net.shibboleth.oidc</groupId>
+ <artifactId>oidc-common-crypto-impl</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>net.shibboleth.idp</groupId>
<artifactId>idp-conf-impl</artifactId>
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCTest.java
index 480222e..e8ce877 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCTest.java
@@ -45,6 +45,7 @@ import net.shibboleth.idp.relyingparty.RelyingPartyConfiguration;
import net.shibboleth.oidc.metadata.context.OIDCProviderMetadataContext;
import net.shibboleth.oidc.profile.config.OIDCAuthorizationConfiguration;
import net.shibboleth.oidc.profile.core.OIDCAuthenticationRequest;
+import net.shibboleth.oidc.security.impl.support.TestCredentialHelper;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
/** Abstract class for tests that require context setup appropriate for an OIDC request/response.*/
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AuthorizationControllerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AuthorizationControllerTest.java
index 6c9677a..d211ae7 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AuthorizationControllerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AuthorizationControllerTest.java
@@ -104,6 +104,7 @@ import net.shibboleth.oidc.profile.decoding.OIDCMessageDecoder;
import net.shibboleth.oidc.profile.encoding.impl.AbstractOIDCMessageEncoder;
import net.shibboleth.oidc.security.impl.EncryptJWTHandler;
import net.shibboleth.oidc.security.impl.SignJWTHandler;
+import net.shibboleth.oidc.security.impl.support.TestCredentialHelper;
import net.shibboleth.oidc.security.jose.SignatureSigningParameters;
import net.shibboleth.oidc.security.jose.context.SecurityParametersContext;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/OIDCRPFlowFromAuthenticationResponseTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/OIDCRPFlowFromAuthenticationResponseTest.java
index 8ac0f58..f00a9a9 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/OIDCRPFlowFromAuthenticationResponseTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/OIDCRPFlowFromAuthenticationResponseTest.java
@@ -38,6 +38,7 @@ import net.shibboleth.oidc.security.credential.impl.BasicJOSEObjectCredentialRes
import net.shibboleth.oidc.security.credential.impl.ChainingJOSEObjectCredentialResolver;
import net.shibboleth.oidc.security.credential.impl.ClientSecretCriterionCredentialResolver;
import net.shibboleth.oidc.security.impl.ExplicitKeySignedJWTTrustEngine;
+import net.shibboleth.oidc.security.impl.support.TestCredentialHelper;
import net.shibboleth.oidc.security.jose.impl.BasicDecryptionConfiguration;
import net.shibboleth.oidc.security.jose.impl.BasicSignatureValidationConfiguration;
import okhttp3.mockwebserver.MockResponse;
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/OIDCRPFlowTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/OIDCRPFlowTest.java
index 16e79ed..586adbc 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/OIDCRPFlowTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/OIDCRPFlowTest.java
@@ -88,6 +88,7 @@ import net.shibboleth.oidc.profile.core.OIDCAuthenticationRequest;
import net.shibboleth.oidc.security.credential.impl.BasicJOSEObjectCredentialResolver;
import net.shibboleth.oidc.security.credential.impl.ClientSecretCriterionCredentialResolver;
import net.shibboleth.oidc.security.impl.ExplicitKeySignedJWTTrustEngine;
+import net.shibboleth.oidc.security.impl.support.TestCredentialHelper;
import net.shibboleth.oidc.security.jose.impl.BasicDecryptionConfiguration;
import net.shibboleth.oidc.security.jose.impl.BasicSignatureValidationConfiguration;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestCredentialHelper.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestCredentialHelper.java
deleted file mode 100644
index a13f237..0000000
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestCredentialHelper.java
+++ /dev/null
@@ -1,147 +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.authn.oidc.rp.impl;
-
-import java.security.KeyException;
-import java.time.Duration;
-
-import org.opensaml.security.credential.UsageType;
-import org.opensaml.security.crypto.KeySupport;
-
-import com.nimbusds.jose.JOSEException;
-import com.nimbusds.jose.JWEAlgorithm;
-import com.nimbusds.jose.jwk.AsymmetricJWK;
-import com.nimbusds.jose.jwk.ECKey;
-import com.nimbusds.jose.jwk.JWK;
-import com.nimbusds.jose.jwk.RSAKey;
-
-import net.shibboleth.oidc.security.credential.BasicExpiringJWKCredential;
-import net.shibboleth.oidc.security.credential.ClientSecretCredential;
-import net.shibboleth.oidc.security.credential.DefaultClientSecretCredential;
-import net.shibboleth.oidc.security.credential.JWKCredential;
-import net.shibboleth.oidc.security.impl.JWSAssemblyUtils;
-
-/** Helper that creates different credentials.*/
-//TODO copy of the sealed one in oidc-crpto-impl
-public final class TestCredentialHelper {
-
- private TestCredentialHelper() {
-
- }
-
-
- /**
- * Create a simple symmetric key client_secret credential from from the given shared secret.
- *
- * @param secret the client_secret
- * @return the credential
- * @throws KeyException on error creating the key
- */
- public static ClientSecretCredential createClientSecretCredential(final String secret)
- throws KeyException {
- return new DefaultClientSecretCredential(secret);
- }
-
- /**
- * Create a direct encryption {@link JWKCredential} from the given shared secret.
- *
- * @param secret the secret to convert to a {@link JWKCredential}.
- *
- * @return the credential
- * @throws KeyException on error creating the key
- */
- public static JWKCredential createDirectEncryptionCredentialFromSharedSecret(final String secret)
- throws KeyException {
- final BasicExpiringJWKCredential jwkCredential = new BasicExpiringJWKCredential();
- jwkCredential.setSecretKey(KeySupport.decodeSecretKey(
- JWSAssemblyUtils.getSecretBytes(secret), "AES"));
- jwkCredential.setCredentialExpiresAt(Duration.ZERO);
- jwkCredential.setUsageType(UsageType.UNSPECIFIED);
-
- jwkCredential.setKid("mockKey");
- jwkCredential.getKeyNames().add("mockKey");
- jwkCredential.setAlgorithm(JWEAlgorithm.DIR);
- return jwkCredential;
- }
-
- /**
- * Create an asymmetric signing credential.
- *
- * @param key the key to convert to a {@link JWKCredential}.
- *
- * @return the credential
- * @throws JOSEException on error
- */
- public static JWKCredential createAsymmetricSigningCredential(final AsymmetricJWK key) throws JOSEException {
- final BasicExpiringJWKCredential jwkCredential = new BasicExpiringJWKCredential();
- jwkCredential.setPrivateKey(key.toPrivateKey());
- jwkCredential.setPublicKey(key.toPublicKey());
- jwkCredential.setCredentialExpiresAt(Duration.ZERO);
- jwkCredential.setUsageType(UsageType.SIGNING);
-
- jwkCredential.setKid(((JWK)key).getKeyID());
- jwkCredential.getKeyNames().add(((JWK)key).getKeyID());
- jwkCredential.setAlgorithm(((JWK)key).getAlgorithm());
- return jwkCredential;
- }
-
-
- /**
- * Create a key encryption {@link JWKCredential} from the given RSA key.
- *
- * @param secret the RSAKey to convert to a {@link JWKCredential}.
- *
- * @return the credential
- * @throws JOSEException on error
- */
- public static JWKCredential createKeyEncryptionCredential(final RSAKey secret) throws JOSEException {
- final BasicExpiringJWKCredential jwkCredential = new BasicExpiringJWKCredential();
- jwkCredential.setPrivateKey(secret.toPrivateKey());
- jwkCredential.setPublicKey(secret.toPublicKey());
- jwkCredential.setCredentialExpiresAt(Duration.ZERO);
- jwkCredential.setUsageType(UsageType.ENCRYPTION);
-
- jwkCredential.setKid(secret.getKeyID());
- jwkCredential.getKeyNames().add(secret.getKeyID());
- jwkCredential.setAlgorithm(secret.getAlgorithm());
- return jwkCredential;
- }
-
- /**
- * Create a key agreement encryption {@link JWKCredential} from the given EC key.
- *
- * @param secret the ECKey to convert to a {@link JWKCredential}.
- *
- * @return the credential
- * @throws JOSEException on error
- */
- public static JWKCredential createKeyAgreementCredential(final ECKey secret) throws JOSEException {
- final BasicExpiringJWKCredential jwkCredential = new BasicExpiringJWKCredential();
- jwkCredential.setPrivateKey(secret.toPrivateKey());
- jwkCredential.setPublicKey(secret.toPublicKey());
- jwkCredential.setCredentialExpiresAt(Duration.ZERO);
- jwkCredential.setUsageType(UsageType.ENCRYPTION);
-
- jwkCredential.setKid(secret.getKeyID());
- jwkCredential.getKeyNames().add(secret.getKeyID());
- jwkCredential.setAlgorithm(secret.getAlgorithm());
- return jwkCredential;
- }
-
-}
diff --git a/pom.xml b/pom.xml
index 0c53877..f74f974 100644
--- a/pom.xml
+++ b/pom.xml
@@ -146,6 +146,13 @@
<version>4.9.3</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>net.shibboleth.oidc</groupId>
+ <artifactId>oidc-common-crypto-impl</artifactId>
+ <version>${oidc.common.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</dependencyManagement>
<build>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list