[java-oidfed-common] branch main updated: Move test federation anchor and intermediate keys into oidfed-common-testing
Codeberg
noreply at shibboleth.net
Thu Sep 17 11:21:57 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-oidfed-common.
View the commit online:
https://codeberg.org/Shibboleth/java-oidfed-common/commit/07b61806ef41cbd4e20055633e9c7af7aa485ef8
The following commit(s) were added to refs/heads/main by this push:
new 07b6180 Move test federation anchor and intermediate keys into oidfed-common-testing
07b6180 is described below
commit 07b61806ef41cbd4e20055633e9c7af7aa485ef8
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Thu Sep 17 14:19:49 2026 +0300
Move test federation anchor and intermediate keys into oidfed-common-testing
- Access provided via TestFederationCredential-class
---
.../oidfed/flow/AbstractFederationFlowTest.java | 13 ++---
oidfed-common-testing/pom.xml | 15 ++++++
.../oidfed/testing/TestFederationCredentials.java | 63 ++++++++++++++++++++++
.../oidfed/testing}/fed-local-anchor.jwk | 0
.../oidfed/testing}/fed-local-intermediate.jwk | 0
5 files changed, 81 insertions(+), 10 deletions(-)
diff --git a/oidfed-common-conf-impl/src/test/java/net/shibboleth/oidfed/flow/AbstractFederationFlowTest.java b/oidfed-common-conf-impl/src/test/java/net/shibboleth/oidfed/flow/AbstractFederationFlowTest.java
index 8bec152..faf6519 100644
--- a/oidfed-common-conf-impl/src/test/java/net/shibboleth/oidfed/flow/AbstractFederationFlowTest.java
+++ b/oidfed-common-conf-impl/src/test/java/net/shibboleth/oidfed/flow/AbstractFederationFlowTest.java
@@ -86,6 +86,7 @@ import net.shibboleth.idp.test.flows.AbstractFlowTest;
import net.shibboleth.oidc.security.credential.BasicJWKCredential;
import net.shibboleth.oidc.security.credential.BasicJWKCredentialFactoryBean;
import net.shibboleth.oidfed.metadata.EntityStatement;
+import net.shibboleth.oidfed.testing.TestFederationCredentials;
import net.shibboleth.oidfed.testing.TrustChainTestUtil;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.servlet.impl.HttpServletRequestResponseContext;
@@ -133,20 +134,12 @@ public class AbstractFederationFlowTest extends AbstractFlowTest {
protected HttpClient federationHttpClient;
static {
+ trustedAnchorKey = TestFederationCredentials.trustAnchorKey();
+ trustedIntermediateKey = TestFederationCredentials.intermediateKey();
try {
rpKey = initializeNewJwk("RSA", 2048, "mockRpKey");
leafKey = initializeNewJwk("RSA", 2048, "mockLeafKey");
anchorKey = initializeNewJwk("RSA", 2048, "mockAnchorKey");
- final BasicJWKCredential localAnchor = loadCredential("/credentials/fed-local-anchor.jwk");
- trustedAnchorKey = new RSAKey.Builder((RSAPublicKey) localAnchor.getPublicKey())
- .privateKey(localAnchor.getPrivateKey())
- .keyID("locallyTrustedAnchorKey")
- .build();
- final BasicJWKCredential localIntermediate = loadCredential("/credentials/fed-local-intermediate.jwk");
- trustedIntermediateKey = new RSAKey.Builder((RSAPublicKey) localIntermediate.getPublicKey())
- .privateKey(localIntermediate.getPrivateKey())
- .keyID("locallyTrustedIntermediateKey")
- .build();
intermediateKey = initializeNewJwk("RSA", 2048, "mockIntermediateKey");
trustMarkIssuerKey = initializeNewJwk("RSA", 2048, "mockTrustMarkIssuerKey");
} catch (final NoSuchAlgorithmException e) {
diff --git a/oidfed-common-testing/pom.xml b/oidfed-common-testing/pom.xml
index 72f8c5c..7153e1c 100644
--- a/oidfed-common-testing/pom.xml
+++ b/oidfed-common-testing/pom.xml
@@ -26,6 +26,11 @@
<artifactId>testng</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>${spring.groupId}</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>compile</scope>
+ </dependency>
<!-- Provided dependencies -->
<dependency>
@@ -62,6 +67,16 @@
<groupId>${shib-shared.groupId}</groupId>
<artifactId>shib-support</artifactId>
<scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>${opensaml.groupId}</groupId>
+ <artifactId>opensaml-security-api</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>${opensaml.groupId}</groupId>
+ <artifactId>opensaml-spring</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
diff --git a/oidfed-common-testing/src/main/java/net/shibboleth/oidfed/testing/TestFederationCredentials.java b/oidfed-common-testing/src/main/java/net/shibboleth/oidfed/testing/TestFederationCredentials.java
new file mode 100644
index 0000000..0ac6a75
--- /dev/null
+++ b/oidfed-common-testing/src/main/java/net/shibboleth/oidfed/testing/TestFederationCredentials.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed 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.oidfed.testing;
+
+import java.security.interfaces.RSAPublicKey;
+
+import org.springframework.core.io.ClassPathResource;
+import org.testng.Assert;
+
+import com.nimbusds.jose.jwk.JWK;
+import com.nimbusds.jose.jwk.RSAKey;
+
+import net.shibboleth.oidc.security.credential.BasicJWKCredential;
+import net.shibboleth.oidc.security.credential.BasicJWKCredentialFactoryBean;
+
+/**
+ * Static utility methods to access test credentials.
+ */
+public class TestFederationCredentials {
+
+ public static JWK trustAnchorKey() {
+ final BasicJWKCredential localAnchor =
+ loadJWKCredential("/net/shibboleth/oidfed/testing/fed-local-anchor.jwk");
+ return new RSAKey.Builder((RSAPublicKey) localAnchor.getPublicKey())
+ .privateKey(localAnchor.getPrivateKey())
+ .keyID("locallyTrustedAnchorKey")
+ .build();
+ }
+
+ public static JWK intermediateKey() {
+ final BasicJWKCredential localIntermediate =
+ loadJWKCredential("/net/shibboleth/oidfed/testing/fed-local-intermediate.jwk");
+ return new RSAKey.Builder((RSAPublicKey) localIntermediate.getPublicKey())
+ .privateKey(localIntermediate.getPrivateKey())
+ .keyID("locallyTrustedIntermediateKey")
+ .build();
+ }
+
+ public static BasicJWKCredential loadJWKCredential(final String classPathLocation) {
+ final BasicJWKCredentialFactoryBean factory = new BasicJWKCredentialFactoryBean();
+ factory.setResource(new ClassPathResource(classPathLocation));
+ try {
+ factory.afterPropertiesSet();
+ return factory.getObject();
+ } catch (final Exception e) {
+ Assert.fail();
+ return null;
+ }
+ }
+
+}
diff --git a/oidfed-common-conf-impl/src/test/resources/credentials/fed-local-anchor.jwk b/oidfed-common-testing/src/main/resources/net/shibboleth/oidfed/testing/fed-local-anchor.jwk
similarity index 100%
rename from oidfed-common-conf-impl/src/test/resources/credentials/fed-local-anchor.jwk
rename to oidfed-common-testing/src/main/resources/net/shibboleth/oidfed/testing/fed-local-anchor.jwk
diff --git a/oidfed-common-conf-impl/src/test/resources/credentials/fed-local-intermediate.jwk b/oidfed-common-testing/src/main/resources/net/shibboleth/oidfed/testing/fed-local-intermediate.jwk
similarity index 100%
rename from oidfed-common-conf-impl/src/test/resources/credentials/fed-local-intermediate.jwk
rename to oidfed-common-testing/src/main/resources/net/shibboleth/oidfed/testing/fed-local-intermediate.jwk
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list