[java-identity-provider COMMIT] in /trunk: idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relying...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Oct 19 20:12:05 EDT 2016
Author: putmanb
Date: Wed Oct 19 20:12:05 2016
New Revision: 8520
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8520&view=rev
Log:
IDP-1070: Add config schema and parser for new AbstractDynamicMetadataResolver options
Added:
trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/dynamicPersistentCacheBean.xml (with props)
trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/dynamicPersistentCacheDirectory.xml (with props)
Modified:
trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicMetadataProviderParser.java
trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/DynamicHTTPMetadataProviderParserTest.java
trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/beans.xml
trunk/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
Modified: trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicMetadataProviderParser.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicMetadataProviderParser.java?rev=8520&r1=8519&r2=8520&view=diff
==============================================================================
--- trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicMetadataProviderParser.java (original)
+++ trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicMetadataProviderParser.java Wed Oct 19 20:12:05 2016
@@ -20,6 +20,11 @@
import net.shibboleth.idp.profile.spring.relyingparty.metadata.AbstractMetadataProviderParser;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.persist.FilesystemLoadSaveManager;
+import org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;
@@ -28,9 +33,12 @@
* Parser for {@link org.opensaml.saml.metadata.resolver.impl.AbstractDynamicMetadataResolver}.
*/
public abstract class AbstractDynamicMetadataProviderParser extends AbstractMetadataProviderParser {
-
+
/** The reference to the system parser pool that we set up. */
private static final String DEFAULT_PARSER_POOL_REF = "shibboleth.ParserPool";
+
+ /** Logger. */
+ private Logger log = LoggerFactory.getLogger(AbstractDynamicMetadataProviderParser.class);
/**
*
@@ -81,6 +89,61 @@
}
builder.addPropertyReference("parserPool", getParserPoolRef(element));
+
+ processPersistentCachingProperties(element, parserContext, builder);
+ }
+
+ /**
+ * Process options related to persistent caching support.
+ *
+ * @param element current element
+ * @param parserContext current parser context
+ * @param builder current builder
+ */
+ protected void processPersistentCachingProperties(final Element element, final ParserContext parserContext,
+ final BeanDefinitionBuilder builder) {
+
+ if (element.hasAttributeNS(null, "persistentCacheManagerRef")) {
+ builder.addPropertyReference("persistentCacheManager",
+ StringSupport.trimOrNull(element.getAttributeNS(null, "persistentCacheManagerRef")));
+
+ if (element.hasAttributeNS(null, "persistentCacheManagerDirectory")) {
+ log.warn("{} Element contained both persistentCacheManagerRef and persistentCacheManagerDirectory, "
+ + "persistentCacheManagerDirectory will be ignored",
+ parserContext.getReaderContext().getResource().getDescription());
+ }
+
+ } else if (element.hasAttributeNS(null, "persistentCacheManagerDirectory")) {
+ final String cacheDirectory =
+ StringSupport.trimOrNull(element.getAttributeNS(null, "persistentCacheManagerDirectory"));
+ log.debug("{} Building internally-constructed FilesystemLoadSaveManager with base directory: {}",
+ parserContext.getReaderContext().getResource().getDescription(), cacheDirectory);
+ final BeanDefinitionBuilder cacheManagerBuilder =
+ BeanDefinitionBuilder.genericBeanDefinition(FilesystemLoadSaveManager.class);
+ cacheManagerBuilder.addConstructorArgValue(cacheDirectory);
+ builder.addPropertyValue("persistentCacheManager", cacheManagerBuilder.getBeanDefinition());
+ }
+
+ if (element.hasAttributeNS(null, "persistentCacheKeyGeneratorRef")) {
[... 219 lines stripped ...]
More information about the commits
mailing list