[java-identity-provider] branch main updated: IDP-1642 - Migrate configuration into jars where feasible

Scott Cantor cantor.2 at osu.edu
Mon Sep 28 18:40:41 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=96db671341ef0492af6531933a509086383d436d

The following commit(s) were added to refs/heads/main by this push:
       new  96db67134 IDP-1642 - Migrate configuration into jars where feasible
96db67134 is described below

commit 96db671341ef0492af6531933a509086383d436d
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Sep 28 14:40:37 2020 -0400

    IDP-1642 - Migrate configuration into jars where feasible
    
    https://issues.shibboleth.net/jira/browse/IDP-1642
    
    Modularize CAS support.
---
 .../shibboleth/idp/module/profile/impl/CAS.java    | 41 ++++++++++++++++++++++
 .../idp/module/profile/impl/package-info.java      | 22 ++++++++++++
 .../services/net.shibboleth.idp.module.IdPModule   |  2 ++
 .../net/shibboleth/idp/conf/services-system.xml    | 32 +++++++++++------
 .../shibboleth/idp/module}/conf/cas-protocol.xml   |  0
 .../idp/module/profile/impl/module.properties      | 11 ++++++
 idp-conf/src/main/resources/conf/services.xml      |  4 ---
 .../{main => test}/resources/conf/cas-protocol.xml |  0
 8 files changed, 98 insertions(+), 14 deletions(-)

diff --git a/idp-conf-impl/src/main/java/net/shibboleth/idp/module/profile/impl/CAS.java b/idp-conf-impl/src/main/java/net/shibboleth/idp/module/profile/impl/CAS.java
new file mode 100644
index 000000000..9eecff6d4
--- /dev/null
+++ b/idp-conf-impl/src/main/java/net/shibboleth/idp/module/profile/impl/CAS.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.profile.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 CAS extends PropertyDrivenIdPModule {
+
+    /**
+     * Constructor.
+     *  
+     * @throws ModuleException on error
+     * @throws IOException on error
+     */
+    public CAS() throws IOException, ModuleException {
+        super(CAS.class);
+    }
+
+}
\ No newline at end of file
diff --git a/idp-conf-impl/src/main/java/net/shibboleth/idp/module/profile/impl/package-info.java b/idp-conf-impl/src/main/java/net/shibboleth/idp/module/profile/impl/package-info.java
new file mode 100644
index 000000000..759fe133b
--- /dev/null
+++ b/idp-conf-impl/src/main/java/net/shibboleth/idp/module/profile/impl/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+/**
+ * Profile modules.
+ */
+
+package net.shibboleth.idp.module.profile.impl;
\ No newline at end of file
diff --git a/idp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule b/idp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
index 63ae430ca..571260db4 100644
--- a/idp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
+++ b/idp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
@@ -17,3 +17,5 @@ net.shibboleth.idp.module.intercept.impl.ContextCheck
 net.shibboleth.idp.module.intercept.impl.ExpiringPassword
 net.shibboleth.idp.module.intercept.impl.Impersonate
 net.shibboleth.idp.module.intercept.impl.Warning
+
+net.shibboleth.idp.module.profile.impl.CAS
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/services-system.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/services-system.xml
index 14de4d60c..bc66b408b 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/services-system.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/services-system.xml
@@ -166,24 +166,36 @@
 
     <bean id="shibboleth.ReloadableCASServiceRegistry" class="net.shibboleth.ext.spring.service.ReloadableSpringService"
           c:claz="net.shibboleth.idp.cas.service.ServiceRegistry"
-          p:serviceConfigurations-ref="#{
-            getObject('%{idp.service.cas.registry.resources:shibboleth.CASServiceRegistryResources}'.trim()) != null
-                ? '%{idp.service.cas.registry.resources:shibboleth.CASServiceRegistryResources}'.trim()
-                : 'shibboleth.DefaultCASServiceRegistryResources' }"
+          p:serviceConfigurations="#{getObject('%{idp.service.cas.registry.resources:shibboleth.CASServiceRegistryResources}'.trim()) ?:
+                getObject('shibboleth.DefaultCASServiceRegistryResources')}"
           p:failFast="%{idp.service.cas.registry.failFast:%{idp.service.failFast:false}}"
           p:reloadCheckDelay="%{idp.service.cas.registry.checkInterval:PT0S}"
           p:beanPostProcessors-ref="shibboleth.IdentifiableBeanPostProcessor"
           p:beanFactoryPostProcessors-ref="shibboleth.PropertySourcesPlaceholderConfigurer" />
+    
+    <!-- This default populates the service with an empty CAS registry as a substitute for a real config. -->
     <util:list id="shibboleth.DefaultCASServiceRegistryResources">
-        <value>%{idp.home}/conf/cas-protocol.xml</value>
+        <bean class="net.shibboleth.ext.spring.resource.ConditionalResource" c:wrapped="%{idp.home}/conf/cas-protocol.xml">
+            <property name="defaultContent">
+                <value>
+                <![CDATA[
+                    <beans xmlns="http://www.springframework.org/schema/beans"
+                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
+                           default-init-method="initialize"
+                           default-destroy-method="destroy">
+                        <bean id="reloadableServiceRegistry" class="net.shibboleth.idp.cas.service.PatternServiceRegistry" />
+                    </beans>
+                ]]>
+                </value>
+            </property>
+        </bean>
     </util:list>
 
     <bean id="shibboleth.ManagedBeanService" class="net.shibboleth.ext.spring.service.ReloadableSpringService" 
             c:claz="org.springframework.context.ApplicationContext"
-            p:serviceConfigurations-ref="#{
-                getObject('%{idp.service.managedBean.resources:shibboleth.ManagedBeanResources}'.trim()) != null
-                    ? '%{idp.service.managedBean.resources:shibboleth.ManagedBeanResources}'.trim()
-                    : 'shibboleth.DefaultManagedBeanResources' }"
+            p:serviceConfigurations="#{getObject('%{idp.service.managedBean.resources:shibboleth.ManagedBeanResources}'.trim()) ?:
+                getObject('shibboleth.DefaultManagedBeanResources')}"
             p:failFast="%{idp.service.managedBean.failFast:%{idp.service.failFast:false}}"
             p:reloadCheckDelay="%{idp.service.managedBean.checkInterval:PT0S}"
             p:beanPostProcessors-ref="shibboleth.IdentifiableBeanPostProcessor"
@@ -193,7 +205,7 @@
         </constructor-arg>
     </bean>
     <util:list id="shibboleth.DefaultManagedBeanResources">
-        <value>conditional:%{idp.home}/conf/managed-beans.xml</value>
+        <value>%{idp.home}/conf/managed-beans.xml</value>
     </util:list>
 
     <!--
diff --git a/idp-conf/src/main/resources/conf/cas-protocol.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/cas-protocol.xml
similarity index 100%
copy from idp-conf/src/main/resources/conf/cas-protocol.xml
copy to idp-conf-impl/src/main/resources/net/shibboleth/idp/module/conf/cas-protocol.xml
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/profile/impl/module.properties b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/profile/impl/module.properties
new file mode 100644
index 000000000..8853d3a12
--- /dev/null
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/profile/impl/module.properties
@@ -0,0 +1,11 @@
+# Properties defining profile modules
+
+# Class to Module ID mappings
+net.shibboleth.idp.module.profile.impl.CAS = idp.profile.CAS
+
+
+idp.profile.CAS.name = CAS Protocol Suppport
+idp.profile.CAS.desc = Module that provides CAS protocol support
+idp.profile.CAS.url = https://wiki.shibboleth.net/confluence/display/IDP4/CasProtocolConfiguration
+idp.profile.CAS.1.src = /net/shibboleth/idp/module/conf/cas-protocol.xml
+idp.profile.CAS.1.dest = conf/cas-protocol.xml
diff --git a/idp-conf/src/main/resources/conf/services.xml b/idp-conf/src/main/resources/conf/services.xml
index fae2979af..24e2b1e9f 100644
--- a/idp-conf/src/main/resources/conf/services.xml
+++ b/idp-conf/src/main/resources/conf/services.xml
@@ -46,10 +46,6 @@
         <value>%{idp.home}/conf/access-control.xml</value>
     </util:list>
 
-    <util:list id="shibboleth.CASServiceRegistryResources">
-        <value>%{idp.home}/conf/cas-protocol.xml</value>
-    </util:list>
-
     <!--
     This collection of resources differs slightly in that it should not include the file extension.
     Message sources are internationalized, and Spring will search for a compatible language extension
diff --git a/idp-conf/src/main/resources/conf/cas-protocol.xml b/idp-conf/src/test/resources/conf/cas-protocol.xml
similarity index 100%
rename from idp-conf/src/main/resources/conf/cas-protocol.xml
rename to idp-conf/src/test/resources/conf/cas-protocol.xml

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


More information about the commits mailing list