[java-identity-provider] branch main updated: Add more modules, relax a null assumption on an API.

Scott Cantor cantor.2 at osu.edu
Fri Sep 11 16:18:21 UTC 2020


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

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

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=999aff67f1dbaa2a14dd01f6613ed84bce956a7a

The following commit(s) were added to refs/heads/main by this push:
       new  999aff67f Add more modules, relax a null assumption on an API.
999aff67f is described below

commit 999aff67f1dbaa2a14dd01f6613ed84bce956a7a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Sep 11 12:18:12 2020 -0400

    Add more modules, relax a null assumption on an API.
---
 .../idp/authn/AbstractValidationAction.java        | 29 +++++++++------
 .../net/shibboleth/idp/module/authn/impl/X509.java | 41 ++++++++++++++++++++++
 .../idp/module/authn/impl/X509Internal.java        | 41 ++++++++++++++++++++++
 .../idp/flows/authn/x509-authn-beans.xml           |  6 ++--
 .../idp/flows/authn/x509-internal-authn-beans.xml  |  2 +-
 .../idp/module/authn/impl/module.properties        | 22 +++++++++---
 .../idp/module}/conf/authn/x509-authn-config.xml   |  0
 .../conf/authn/x509-internal-authn-config.xml      |  0
 8 files changed, 122 insertions(+), 19 deletions(-)

diff --git a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
index ba7386439..82a800cd0 100644
--- a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
+++ b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
@@ -163,7 +163,9 @@ public abstract class AbstractValidationAction extends AbstractAuthenticationAct
     }
     
     /**
-     * Get the error messages classified by specific error conditions.
+     * Get the error messages mapped to specific events.
+     * 
+     * <p>The map keys are the events and the values are the message collections.</p>
      * 
      * @return classified error message map
      */
@@ -173,20 +175,25 @@ public abstract class AbstractValidationAction extends AbstractAuthenticationAct
     }
     
     /**
-     * Set the error messages indicating an unknown username.
+     * Set the error messages to map to specific events.
+     * 
+     * <p>The map keys are the events and the values are the message collections.</p>
      * 
-     * @param messages the "unknown username" error messages to set
+     * @param messages the error message / event mappings to set
      */
-    public void setClassifiedMessages(@Nonnull @NonnullElements final Map<String,Collection<String>> messages) {
+    public void setClassifiedMessages(@Nullable @NonnullElements final Map<String,Collection<String>> messages) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        Constraint.isNotNull(messages, "Map of classified messages cannot be null");
-        
-        classifiedMessages = new LinkedHashMap<>();
-        for (final Map.Entry<String, Collection<String>> entry : messages.entrySet()) {
-            if (entry.getKey() != null && !entry.getKey().isEmpty()
-                    && entry.getValue() != null && !entry.getValue().isEmpty()) {
-                classifiedMessages.put(entry.getKey(), List.copyOf(entry.getValue()));
+
+        if (messages != null) {
+            classifiedMessages = new LinkedHashMap<>();
+            for (final Map.Entry<String, Collection<String>> entry : messages.entrySet()) {
+                if (entry.getKey() != null && !entry.getKey().isEmpty()
+                        && entry.getValue() != null && !entry.getValue().isEmpty()) {
+                    classifiedMessages.put(entry.getKey(), List.copyOf(entry.getValue()));
+                }
             }
+        } else {
+            classifiedMessages = Collections.emptyMap();
         }
     }
 
diff --git a/idp-conf-impl/src/main/java/net/shibboleth/idp/module/authn/impl/X509.java b/idp-conf-impl/src/main/java/net/shibboleth/idp/module/authn/impl/X509.java
new file mode 100644
index 000000000..db33cf85a
--- /dev/null
+++ b/idp-conf-impl/src/main/java/net/shibboleth/idp/module/authn/impl/X509.java
@@ -0,0 +1,41 @@
+/*
+ * 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.module.authn.impl;
+
+import java.io.IOException;
+
+import net.shibboleth.idp.module.IdPModule;
+import net.shibboleth.idp.module.ModuleException;
+import net.shibboleth.idp.module.PropertyDrivenIdPModule;
+
+/**
+ * {@link IdPModule} implementation.
+ */
+public final class X509 extends PropertyDrivenIdPModule {
+
+    /**
+     * Constructor.
+     *  
+     * @throws ModuleException on error
+     * @throws IOException on error
+     */
+    public X509() throws IOException, ModuleException {
+        super(X509.class);
+    }
+
+}
\ No newline at end of file
diff --git a/idp-conf-impl/src/main/java/net/shibboleth/idp/module/authn/impl/X509Internal.java b/idp-conf-impl/src/main/java/net/shibboleth/idp/module/authn/impl/X509Internal.java
new file mode 100644
index 000000000..d81950962
--- /dev/null
+++ b/idp-conf-impl/src/main/java/net/shibboleth/idp/module/authn/impl/X509Internal.java
@@ -0,0 +1,41 @@
+/*
+ * 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.module.authn.impl;
+
+import java.io.IOException;
+
+import net.shibboleth.idp.module.IdPModule;
+import net.shibboleth.idp.module.ModuleException;
+import net.shibboleth.idp.module.PropertyDrivenIdPModule;
+
+/**
+ * {@link IdPModule} implementation.
+ */
+public final class X509Internal extends PropertyDrivenIdPModule {
+
+    /**
+     * Constructor.
+     *  
+     * @throws ModuleException on error
+     * @throws IOException on error
+     */
+    public X509Internal() throws IOException, ModuleException {
+        super(X509Internal.class);
+    }
+
+}
\ No newline at end of file
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/x509-authn-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/x509-authn-beans.xml
index 690243ab7..4216fad67 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/x509-authn-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/x509-authn-beans.xml
@@ -20,15 +20,15 @@
 
     <!-- Default strategy function to obtain the external path. -->
     <bean id="shibboleth.authn.X509.externalAuthnPathStrategy" parent="shibboleth.Functions.Constant"
-        c:target-ref="shibboleth.authn.X509.externalAuthnPath" />
+        c:target="#{getObject('shibboleth.authn.X509.externalAuthnPath') ?: 'contextRelative:x509-prompt.jsp'}" />
 
-    <import resource="%{idp.home}/conf/authn/x509-authn-config.xml" />
+    <import resource="conditional:%{idp.home}/conf/authn/x509-authn-config.xml" />
 
     <bean id="ValidateExternalAuthentication"
         class="net.shibboleth.idp.authn.impl.ValidateExternalAuthentication" scope="prototype"
         p:metricName="net.shibboleth.idp.authn.x509"
         p:addDefaultPrincipals="#{getObject('shibboleth.authn.X509.addDefaultPrincipals') ?: true}"
-        p:classifiedMessages-ref="shibboleth.authn.X509.ClassifiedMessageMap"
+        p:classifiedMessages="#{getObject('shibboleth.authn.X509.ClassifiedMessageMap')}"
         p:resultCachingPredicate="#{getObject('shibboleth.authn.X509.resultCachingPredicate')}" />
 
     <bean id="PopulateSubjectCanonicalizationContext"
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/x509-internal-authn-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/x509-internal-authn-beans.xml
index 981ea2d88..aa9e15e1a 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/x509-internal-authn-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/x509-internal-authn-beans.xml
@@ -18,7 +18,7 @@
     <bean class="net.shibboleth.ext.spring.config.IdentifiableBeanPostProcessor" />
     <bean class="net.shibboleth.idp.profile.impl.ProfileActionBeanPostProcessor" />
 
-    <import resource="%{idp.home}/conf/authn/x509-internal-authn-config.xml" />
+    <import resource="conditional:%{idp.home}/conf/authn/x509-internal-authn-config.xml" />
     
     <bean id="ExtractX509CertificateFromRequest"
         class="net.shibboleth.idp.authn.impl.ExtractX509CertificateFromRequest" scope="prototype"
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/authn/impl/module.properties b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/authn/impl/module.properties
index 4ea2daf47..9195bd69c 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/authn/impl/module.properties
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/authn/impl/module.properties
@@ -4,21 +4,35 @@
 net.shibboleth.idp.module.authn.impl.Function.id = idp.authn.Function
 net.shibboleth.idp.module.authn.impl.IPAddress.id = idp.authn.IPAddress
 net.shibboleth.idp.module.authn.impl.RemoteUserInternal.id = idp.authn.RemoteUserInternal
+net.shibboleth.idp.module.authn.impl.X509.id = idp.authn.X509
+net.shibboleth.idp.module.authn.impl.X509Internal.id = idp.authn.X509Internal
 
 idp.authn.Function.name = Function Authentication
-idp.authn.Function.desc = Authentication flow that produces a result from a function.
+idp.authn.Function.desc = Login flow that produces a result from a function.
 idp.authn.Function.url = https://wiki.shibboleth.net/confluence/display/IDP4/FunctionAuthnConfiguration
 idp.authn.Function.1.src = /net/shibboleth/idp/module/conf/authn/function-authn-config.xml
 idp.authn.Function.1.dest = conf/authn/function-authn-config.xml
 
 idp.authn.IPAddress.name = IPAddress Authentication
-idp.authn.IPAddress.desc = Authentication flow that maps IP Address ranges to subjects.
+idp.authn.IPAddress.desc = Login flow that maps IP Address ranges to subjects.
 idp.authn.IPAddress.url = https://wiki.shibboleth.net/confluence/display/IDP4/IPAddressAuthnConfiguration
 idp.authn.IPAddress.1.src = /net/shibboleth/idp/module/conf/authn/ipaddress-authn-config.xml
 idp.authn.IPAddress.1.dest = conf/authn/ipaddress-authn-config.xml
 
 idp.authn.RemoteUserInternal.name = RemoteUserInternal Authentication
-idp.authn.RemoteUserInternal.desc = Authentication flow for container-based authentication with no redirects.
-idp.authn.RemoteUserInternal.url = https://wiki.shibboleth.net/confluence/display/IDP4/IPAddressAuthnConfiguration
+idp.authn.RemoteUserInternal.desc = Login flow for container-based authentication with no redirects.
+idp.authn.RemoteUserInternal.url = https://wiki.shibboleth.net/confluence/display/IDP4/RemoteUserInternalAuthnConfiguration
 idp.authn.RemoteUserInternal.1.src = /net/shibboleth/idp/module/conf/authn/remoteuser-internal-authn-config.xml
 idp.authn.RemoteUserInternal.1.dest = conf/authn/remoteuser-internal-authn-config.xml
+
+idp.authn.X509.name = X509 Authentication
+idp.authn.X509.desc = Login flow for X.509 authentication with a dedicated protected path.
+idp.authn.X509.url = https://wiki.shibboleth.net/confluence/display/IDP4/X509AuthnConfiguration
+idp.authn.X509.1.src = /net/shibboleth/idp/module/conf/authn/x509-authn-config.xml
+idp.authn.X509.1.dest = conf/authn/x509-authn-config.xml
+
+idp.authn.X509Internal.name = X509Internal Authentication
+idp.authn.X509Internal.desc = Login flow for X.509 authentication with no redirects.
+idp.authn.X509Internal.url = https://wiki.shibboleth.net/confluence/display/IDP4/X509InternalAuthnConfiguration
+idp.authn.X509Internal.1.src = /net/shibboleth/idp/module/conf/authn/x509-internal-authn-config.xml
+idp.authn.X509Internal.1.dest = conf/authn/x509-internal-authn-config.xml
diff --git a/idp-conf/src/main/resources/conf/authn/x509-authn-config.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/authn/x509-authn-config.xml
similarity index 100%
rename from idp-conf/src/main/resources/conf/authn/x509-authn-config.xml
rename to idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/authn/x509-authn-config.xml
diff --git a/idp-conf/src/main/resources/conf/authn/x509-internal-authn-config.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/authn/x509-internal-authn-config.xml
similarity index 100%
rename from idp-conf/src/main/resources/conf/authn/x509-internal-authn-config.xml
rename to idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/authn/x509-internal-authn-config.xml

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


More information about the commits mailing list