[java-shib-metadata] branch main updated: Move auto-wiring wrapper for Credential into generic package.

Scott Cantor cantor.2 at osu.edu
Mon Feb 6 16:30:42 UTC 2023


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

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

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-metadata.git;a=commit;h=6412b0111ce6983330dfb47a747d617f3e348568

The following commit(s) were added to refs/heads/main by this push:
     new 6412b011 Move auto-wiring wrapper for Credential into generic package.
6412b011 is described below

commit 6412b0111ce6983330dfb47a747d617f3e348568
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Feb 6 11:30:39 2023 -0500

    Move auto-wiring wrapper for Credential into generic package.
---
 .../spring/security/CredentialHolder.java          | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/shib-metadata-spring/src/main/java/net/shibboleth/spring/security/CredentialHolder.java b/shib-metadata-spring/src/main/java/net/shibboleth/spring/security/CredentialHolder.java
new file mode 100644
index 00000000..c4e2c38e
--- /dev/null
+++ b/shib-metadata-spring/src/main/java/net/shibboleth/spring/security/CredentialHolder.java
@@ -0,0 +1,66 @@
+/*
+ * 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.spring.security;
+
+import java.util.Collection;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.security.credential.Credential;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
+/**
+ * This is a utility class used as an auto-wiring source for collections of
+ * signing and encryption {@link Credential} objects so that other layers of the
+ * system can gain access to the complete set of them.
+ * 
+ * @since 5.0.0
+ */
+public class CredentialHolder {
+
+    /** Credentials to expose. */
+    @Nonnull @NonnullElements private final Collection<Credential> credentials;
+    
+    /**
+     * Constructor.
+     *
+     * @param creds credentials to expose to other components
+     */
+    public CredentialHolder(@Nullable @NonnullElements final Collection<Credential> creds) {
+        if (creds != null) {
+            credentials = CollectionSupport.copyToList(creds);
+        } else {
+            credentials = CollectionSupport.emptyList();
+        }
+    }
+    
+    /**
+     * Get the credentials to expose to other components.
+     * 
+     * @return credentials to expose
+     */
+    @Nonnull @NonnullElements @Unmodifiable @NotLive public Collection<Credential> getCredentials() {
+        return credentials;
+    }
+    
+}
\ No newline at end of file

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


More information about the commits mailing list