[java-identity-provider] branch main updated: JSPROF-2 - Move OpenSAML config bean class from IdP into profile library

Scott Cantor cantor.2 at osu.edu
Tue Apr 18 19:20:54 UTC 2023


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=09d5e711dde72283c18e24561788565c2bfaf3a6

The following commit(s) were added to refs/heads/main by this push:
     new 09d5e711d JSPROF-2 - Move OpenSAML config bean class from IdP into profile library
09d5e711d is described below

commit 09d5e711dde72283c18e24561788565c2bfaf3a6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Apr 18 15:20:50 2023 -0400

    JSPROF-2 - Move OpenSAML config bean class from IdP into profile library
    
    https://shibboleth.atlassian.net/browse/JSPROF-2
    
    Rehome the bean class in the IdP.
---
 .../src/test/resources/spring/test-flow-beans.xml  |   2 +-
 .../net/shibboleth/idp/conf/global-system.xml      |   2 +-
 .../shibboleth/idp/spring/OpenSAMLConfigBean.java  | 150 ---------------------
 3 files changed, 2 insertions(+), 152 deletions(-)

diff --git a/idp-cas-impl/src/test/resources/spring/test-flow-beans.xml b/idp-cas-impl/src/test/resources/spring/test-flow-beans.xml
index 23ad1d8b2..bd6aec5ad 100644
--- a/idp-cas-impl/src/test/resources/spring/test-flow-beans.xml
+++ b/idp-cas-impl/src/test/resources/spring/test-flow-beans.xml
@@ -125,7 +125,7 @@
           class="org.opensaml.saml.metadata.resolver.impl.PredicateRoleDescriptorResolver"
           c:mdResolver-ref="shibboleth.MetadataResolver" />
 
-    <bean id="shibboleth.OpenSAMLConfig" class="net.shibboleth.idp.spring.OpenSAMLConfigBean"
+    <bean id="shibboleth.OpenSAMLConfig" class="net.shibboleth.profile.spring.impl.OpenSAMLConfigBean"
           depends-on="shibboleth.ParserPool"
           p:parserPool-ref="shibboleth.ParserPool" />
 
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/global-system.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/global-system.xml
index f9908be10..6e5c56852 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/global-system.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/global-system.xml
@@ -168,7 +168,7 @@
         </property>
     </bean>
 
-    <bean id="shibboleth.OpenSAMLConfig" class="net.shibboleth.idp.spring.OpenSAMLConfigBean"
+    <bean id="shibboleth.OpenSAMLConfig" class="net.shibboleth.profile.spring.impl.OpenSAMLConfigBean"
         depends-on="systemPrereqs,shibboleth.LoggingService"
         p:parserPool-ref="shibboleth.ParserPool"
         p:metricRegistry-ref="shibboleth.metrics.MetricRegistry" />
diff --git a/idp-core/src/main/java/net/shibboleth/idp/spring/OpenSAMLConfigBean.java b/idp-core/src/main/java/net/shibboleth/idp/spring/OpenSAMLConfigBean.java
deleted file mode 100644
index 722910471..000000000
--- a/idp-core/src/main/java/net/shibboleth/idp/spring/OpenSAMLConfigBean.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.spring;
-
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.opensaml.core.config.ConfigurationService;
-import org.opensaml.core.config.InitializationException;
-import org.opensaml.core.config.InitializationService;
-import org.opensaml.core.xml.config.XMLObjectProviderRegistry;
-import org.opensaml.xmlsec.config.DecryptionParserPool;
-import org.slf4j.Logger;
-
-import com.codahale.metrics.MetricRegistry;
-
-import net.shibboleth.shared.component.AbstractInitializableComponent;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.xml.ParserPool;
-
-
-/**
- * A simple bean that may be used with Spring to initialize the OpenSAML library
- * with injected instances of some critical objects.
- */
-public class OpenSAMLConfigBean extends AbstractInitializableComponent {
-
-    /** Class logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(OpenSAMLConfigBean.class);
-    
-    /** Optional {@link ParserPool} to configure. */
-    @Nullable private ParserPool parserPool;
-    
-    /** Optional decryption {@link ParserPool} to configure. */
-    @Nullable private ParserPool decryptionParserPool;
-    
-    /** Optional {@link MetricRegistry} to configure. */
-    @Nullable private MetricRegistry metricRegistry;
-    
-    /**
-     * Get the global {@link ParserPool} to configure.
-     * 
-     * @return the parser pool
-     */
-    @Nullable public ParserPool getParserPool() {
-        return parserPool;
-    }
-
-    /**
-     * Set the global {@link ParserPool} to configure.
-     * 
-     * @param newParserPool the parser pool to set
-     */
-    public void setParserPool(@Nullable final ParserPool newParserPool) {
-        checkSetterPreconditions();
-        parserPool = newParserPool;
-    }
-    
-    /**
-     * Get the global decryption {@link ParserPool} to configure.
-     * 
-     * @return the decryption parser pool
-     */
-    @Nullable public ParserPool getDecryptionParserPool() {
-        return decryptionParserPool;
-    }
-
-    /**
-     * Set the global decryption {@link ParserPool} to configure.
-     * 
-     * @param newParserPool the decryption parser pool to set
-     */
-    public void setDecryptionParserPool(@Nullable final ParserPool newParserPool) {
-        checkSetterPreconditions();
-        decryptionParserPool = newParserPool;
-    }
-    
-    /**
-     * Get the global {@link MetricRegistry} to configure.
-     * 
-     * @return the metric registry to use
-     * 
-     * @since 3.3.0
-     */
-    @Nullable public MetricRegistry getMetricRegistry() {
-        return metricRegistry;
-    }
-    
-    /**
-     * Set the global {@link MetricRegistry} to configure.
-     * 
-     * @param registry the metric registry to use
-     * 
-     * @since 3.3.0
-     */
-    public void setMetricRegistry(@Nullable final MetricRegistry registry) {
-        metricRegistry = registry;
-    }
-    
-    /** {@inheritDoc} */
-    protected void doInitialize() throws ComponentInitializationException {
-
-        // Initialize OpenSAML.
-        try {
-            InitializationService.initialize();
-        } catch (final InitializationException e) {
-            throw new ComponentInitializationException("Exception initializing OpenSAML", e);
-        }
-        
-        XMLObjectProviderRegistry registry = null;
-        synchronized(ConfigurationService.class) {
-            if (metricRegistry != null) {
-                ConfigurationService.register(MetricRegistry.class, metricRegistry);
-            }
-            
-            registry = ConfigurationService.get(XMLObjectProviderRegistry.class);
-            if (registry == null) {
-                log.debug("XMLObjectProviderRegistry did not exist in ConfigurationService, will be created");
-                registry = new XMLObjectProviderRegistry();
-                ConfigurationService.register(XMLObjectProviderRegistry.class, registry);
-            }
-        }
-        
-        if (parserPool != null) {
-            registry.setParserPool(parserPool);
-        }
-        
-        if (decryptionParserPool != null) {
-            ConfigurationService.register(DecryptionParserPool.class, new DecryptionParserPool(decryptionParserPool));
-        }
-    }
-    
-}
\ 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