[java-opensaml] branch main updated: Add non-null algorithm registry and key agreement config APIs.

Scott Cantor cantor.2 at osu.edu
Fri Mar 31 15:56:30 UTC 2023


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

scantor pushed a commit to branch main
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=6b30ab03038efb1040464bbd3344d93c9f06a2a3

The following commit(s) were added to refs/heads/main by this push:
     new 6b30ab030 Add non-null algorithm registry and key agreement config APIs.
6b30ab030 is described below

commit 6b30ab03038efb1040464bbd3344d93c9f06a2a3
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Mar 31 11:56:27 2023 -0400

    Add non-null algorithm registry and key agreement config APIs.
---
 .../xmlsec/agreement/KeyAgreementParameters.java         |  1 -
 .../opensaml/xmlsec/agreement/KeyAgreementSupport.java   | 13 ++++++++++++-
 .../org/opensaml/xmlsec/algorithm/AlgorithmSupport.java  | 16 ++++++++++++++--
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementParameters.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementParameters.java
index 8e488d695..afcef4c17 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementParameters.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementParameters.java
@@ -55,7 +55,6 @@ public class KeyAgreementParameters extends ClassIndexedSet<KeyAgreementParamete
      *              will be cloned before being added
      */
     public KeyAgreementParameters(@Nonnull final Collection<KeyAgreementParameter> source, final boolean clone) {
-        this();
         for (final KeyAgreementParameter param : source) {
             if (clone && CloneableKeyAgreementParameter.class.isInstance(param)) {
                 add(CloneableKeyAgreementParameter.class.cast(param).clone());
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementSupport.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementSupport.java
index bf7764ebf..19a9ccc00 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementSupport.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementSupport.java
@@ -47,7 +47,6 @@ public final class KeyAgreementSupport {
     
     /** Constructor. */
     private KeyAgreementSupport() {}
-
     
     /**
      * Get the global {@link KeyAgreementProcessorRegistry} instance.
@@ -58,6 +57,18 @@ public final class KeyAgreementSupport {
         return ConfigurationService.get(KeyAgreementProcessorRegistry.class);
     }
     
+    /**
+     * Get the global {@link KeyAgreementProcessorRegistry} instance, raising an exception
+     * if unavailable.
+     * 
+     * @return the global processor registry
+     * 
+     * @since 5.0.0
+     */
+    @Nonnull public static KeyAgreementProcessorRegistry ensureGlobalProcessorRegistry() {
+        return ConfigurationService.ensure(KeyAgreementProcessorRegistry.class);
+    }
+    
     /**
      * Lookup and return the {@link KeyAgreementProcessor} to use for the specified key
      * agreement algorithm.
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java
index dd8b450dc..333ef4fed 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java
@@ -40,17 +40,18 @@ import org.opensaml.security.credential.CredentialSupport;
 import org.opensaml.security.crypto.KeySupport;
 import org.opensaml.xmlsec.encryption.support.EncryptionConstants;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Strings;
 
+import net.shibboleth.shared.primitive.LoggerFactory;
+
 /**
  * Helper methods for working with XML security algorithm URI's.
  */
 public final class AlgorithmSupport {
     
     /** Logger. */
-    private static final Logger LOG = LoggerFactory.getLogger(AlgorithmSupport.class);
+    @Nonnull private static final Logger LOG = LoggerFactory.getLogger(AlgorithmSupport.class);
     
     /** Constructor. */
     private AlgorithmSupport() {
@@ -66,6 +67,17 @@ public final class AlgorithmSupport {
         return ConfigurationService.get(AlgorithmRegistry.class);
     }
     
+    /**
+     * Get the global {@link AlgorithmRegistry} instance, raising an exception if absent.
+     * 
+     * @return the global algorithm registry
+     * 
+     * @since 5.0.0
+     */
+    @Nonnull public static AlgorithmRegistry ensureGlobalAlgorithmRegistry() {
+        return ConfigurationService.ensure(AlgorithmRegistry.class);
+    }
+    
     /**
      * Check whether the supplied descriptor represents an algorithm that my be used for
      * key encryption, i.e. a key transport or symmetric key wrap algorithm.

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


More information about the commits mailing list