[java-shib-attribute] 05/05: JSATTR-41 Look to make the ScriptedDataConnector Cached
Rod Widdowson
rdw at steadingsoftware.com
Mon Jan 20 11:45:48 UTC 2025
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-shib-attribute.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=191788aa58507d5c3b30d2a5323c5e7d77f94582
commit 191788aa58507d5c3b30d2a5323c5e7d77f94582
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jan 20 11:44:39 2025 +0000
JSATTR-41 Look to make the ScriptedDataConnector Cached
https://shibboleth.atlassian.net/browse/JSATTR-41
Add parser for the caching. And tests
---
.../dc/impl/ScriptedDataConnectorParser.java | 62 ++++++++++++++++------
.../schema/shibboleth-attribute-resolver.xsd | 16 ++++++
.../dc/impl/ScriptedDataConnectorParserTest.java | 11 ++++
.../spring/dc/resolver/scriptedAttributeBoth.xml | 25 ++++++++-
.../spring/dc/resolver/scriptedAttributeNone.xml | 23 ++++++++
.../dc/resolver/scriptedAttributeTooManyFiles.xml | 23 ++++++++
.../resolver/scriptedAttributeTooManyScripts.xml | 23 ++++++++
.../dc/resolver/scriptedAttributeWithCache.xml | 37 +++++++++++++
.../spring/dc/resolver/scriptedAttributes.xml | 23 ++++++++
9 files changed, 226 insertions(+), 17 deletions(-)
diff --git a/shib-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ScriptedDataConnectorParser.java b/shib-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ScriptedDataConnectorParser.java
index 52c4c9524..878218ddb 100644
--- a/shib-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ScriptedDataConnectorParser.java
+++ b/shib-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ScriptedDataConnectorParser.java
@@ -40,15 +40,15 @@ public class ScriptedDataConnectorParser extends AbstractDataConnectorParser {
/** Schema type - resolver. */
@Nonnull public static final QName TYPE_NAME =
- new QName(AttributeResolverNamespaceHandler.NAMESPACE, "ScriptedDataConnector");
+ new QName(AttributeResolverNamespaceHandler.NAMESPACE, "ScriptedDataConnector");
/** Script file element name. */
- @Nonnull public static final QName SCRIPT_FILE_ELEMENT_NAME =
- new QName(AttributeResolverNamespaceHandler.NAMESPACE, "ScriptFile");
+ @Nonnull public static final QName SCRIPT_FILE_ELEMENT_NAME =
+ new QName(AttributeResolverNamespaceHandler.NAMESPACE, "ScriptFile");
/** Inline Script element name. */
- @Nonnull public static final QName SCRIPT_ELEMENT_NAME =
- new QName(AttributeResolverNamespaceHandler.NAMESPACE, "Script");
+ @Nonnull public static final QName SCRIPT_ELEMENT_NAME =
+ new QName(AttributeResolverNamespaceHandler.NAMESPACE, "Script");
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(ScriptedDataConnectorParser.class);
@@ -58,16 +58,16 @@ public class ScriptedDataConnectorParser extends AbstractDataConnectorParser {
@Nullable protected Class<ScriptedDataConnector> getBeanClass(@Nonnull final Element element) {
return ScriptedDataConnector.class;
}
-
+
/** {@inheritDoc} */
// Checkstyle: CyclomaticComplexity OFF
@Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
- @Nonnull final BeanDefinitionBuilder builder) {
+ @Nonnull final BeanDefinitionBuilder builder) {
super.doParse(config, parserContext, builder);
- builder.addAutowiredProperty("scriptContextExtenders");
+ builder.addAutowiredProperty("scriptContextExtenders");
final BeanDefinitionBuilder scriptBuilder =
- BeanDefinitionBuilder.genericBeanDefinition(EvaluableScriptFactoryBean.class);
+ BeanDefinitionBuilder.genericBeanDefinition(EvaluableScriptFactoryBean.class);
scriptBuilder.addPropertyValue("sourceId", getLogPrefix());
if (config.hasAttributeNS(null, "language")) {
final String scriptLanguage = StringSupport.trimOrNull(config.getAttributeNS(null, "language"));
@@ -80,12 +80,12 @@ public class ScriptedDataConnectorParser extends AbstractDataConnectorParser {
if (scriptElem != null && scriptElem.size() > 0) {
if (scriptElem.size() > 1) {
log.warn("{} Data connector {}: definition contains more than one "
- + " <Script> elements, only the first will be used", getLogPrefix(), getDefinitionId());
+ + " <Script> elements, only the first will be used", getLogPrefix(), getDefinitionId());
}
-
+
if (scriptFileElem != null && scriptFileElem.size() > 0) {
log.warn("{} Data connector {}: definition contains both <Script> "
- + "and <ScriptFile> elements, taking the <Script> element", getLogPrefix(), getDefinitionId());
+ + "and <ScriptFile> elements, taking the <Script> element", getLogPrefix(), getDefinitionId());
}
final String script = scriptElem.get(0).getTextContent();
log.debug("{} Script: {}", getLogPrefix(), script);
@@ -93,9 +93,9 @@ public class ScriptedDataConnectorParser extends AbstractDataConnectorParser {
} else if (scriptFileElem != null && scriptFileElem.size() > 0) {
if (scriptFileElem.size() > 1) {
log.warn("{} Data connector {}: definition contains more than one "
- + " <ScriptFile> elements, only the first will be used", getLogPrefix(), getDefinitionId());
+ + " <ScriptFile> elements, only the first will be used", getLogPrefix(), getDefinitionId());
}
-
+
final String scriptFile = scriptFileElem.get(0).getTextContent();
log.debug("{} Script file: {}", getLogPrefix(), scriptFile);
scriptBuilder.addPropertyValue("resource", scriptFile);
@@ -110,9 +110,39 @@ public class ScriptedDataConnectorParser extends AbstractDataConnectorParser {
}
builder.addPropertyValue("script", scriptBuilder.getBeanDefinition());
+
+ //
+ // Now the Search Builder. This needs the engine and the template text
+ //
final BeanDefinitionBuilder searchBuilder =
- BeanDefinitionBuilder.genericBeanDefinition(ScriptedSearchBuilder.class);
+ BeanDefinitionBuilder.genericBeanDefinition(ScriptedSearchBuilder.class);
+ String velocityEngineRef = StringSupport.trimOrNull(config.getAttributeNS(null, "templateEngine"));
+ if (null == velocityEngineRef) {
+ velocityEngineRef = "shibboleth.VelocityEngine";
+ }
+ searchBuilder.addPropertyReference("velocityEngine", velocityEngineRef);
+
+ final List<Element> cacheKeyTemplates = ElementSupport.getChildElements(config,
+ new QName(AttributeResolverNamespaceHandler.NAMESPACE, "CacheKeyTemplate"));
+ if (cacheKeyTemplates.size() > 1) {
+ log.warn("{} A maximum of 1 <CacheKeyTemplate> should be specified; the first one has been used",
+ getLogPrefix());
+ }
+ if (cacheKeyTemplates.size() > 0) {
+ searchBuilder.addPropertyValue("cacheKeyTemplateText", cacheKeyTemplates.get(0).getTextContent());
+ }
builder.addPropertyValue("executableSearchBuilder", searchBuilder.getBeanDefinition());
+
+ //
+ // And finally the cache
+ //
+ final String resultCacheBeanID = CacheConfigParser.getBeanResultCacheID(config);
+
+ if (null != resultCacheBeanID) {
+ builder.addPropertyReference("resultsCache", resultCacheBeanID);
+ } else {
+ builder.addPropertyValue("resultsCache", new CacheConfigParser(config).createCache());
+ }
}
// Checkstyle: CyclomaticComplexity ON
-}
\ No newline at end of file
+}
diff --git a/shib-attribute-resolver-spring/src/main/resources/schema/shibboleth-attribute-resolver.xsd b/shib-attribute-resolver-spring/src/main/resources/schema/shibboleth-attribute-resolver.xsd
index 23835c932..82b212670 100644
--- a/shib-attribute-resolver-spring/src/main/resources/schema/shibboleth-attribute-resolver.xsd
+++ b/shib-attribute-resolver-spring/src/main/resources/schema/shibboleth-attribute-resolver.xsd
@@ -1444,6 +1444,15 @@
</documentation>
</annotation>
</element>
+ <element name="CacheKeyTemplate" type="resolver:string">
+ <annotation>
+ <documentation>
+ A template that will be used to create a key to the caching of the results.
+ </documentation>
+ </annotation>
+ </element>
+ <element name="ResultCache" type="resolver:CacheConfigType"/>
+ <element name="ResultCacheBean" type="resolver:string"/>
</choice>
<attribute name="language" type="resolver:string">
<annotation>
@@ -1461,6 +1470,13 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="templateEngine" type="resolver:string">
+ <annotation>
+ <documentation>
+ Name of the template engine defined within the application.
+ </documentation>
+ </annotation>
+ </attribute>
</extension>
</complexContent>
</complexType>
diff --git a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ScriptedDataConnectorParserTest.java b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ScriptedDataConnectorParserTest.java
index 2abf33ef3..5083a2521 100644
--- a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ScriptedDataConnectorParserTest.java
+++ b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ScriptedDataConnectorParserTest.java
@@ -15,6 +15,7 @@
package net.shibboleth.idp.attribute.resolver.spring.dc.impl;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.util.List;
@@ -29,6 +30,7 @@ import net.shibboleth.idp.attribute.StringAttributeValue;
import net.shibboleth.idp.attribute.resolver.ResolutionException;
import net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext;
import net.shibboleth.idp.attribute.resolver.dc.scripted.impl.ScriptedDataConnector;
+import net.shibboleth.idp.attribute.resolver.dc.scripted.impl.ScriptedSearchBuilder;
import net.shibboleth.idp.attribute.resolver.spring.testing.BaseAttributeDefinitionParserTest;
import net.shibboleth.idp.attribute.resolver.testing.TestSources;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -76,6 +78,15 @@ public class ScriptedDataConnectorParserTest extends BaseAttributeDefinitionPars
assertEquals(values.size(), 1);
assertTrue(values.contains(new StringAttributeValue("frobnitz")));
}
+
+ @Test public void cache() throws ComponentInitializationException, ResolutionException {
+
+ final ScriptedDataConnector conn = getDataConnector("resolver/scriptedAttributeWithCache.xml", ScriptedDataConnector.class);
+ final ScriptedSearchBuilder sb = (ScriptedSearchBuilder) conn.getExecutableSearchBuilder();
+ assertNotNull(sb);
+ assertEquals(sb.getCacheKeyTemplateText(), "99");
+ assertNotNull(conn.getResultsCache());
+ }
@Test public void tooManyFiles() throws ComponentInitializationException, ResolutionException {
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeBoth.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeBoth.xml
index 9650742e6..258cb63c4 100644
--- a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeBoth.xml
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeBoth.xml
@@ -1,4 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+ default-init-method="initialize">
+
+ <util:map id="shibboleth.DefaultVelocityEngineProperties">
+ <entry key="parser.space_gobbling" value="%{idp.velocity.space.gobbling:bc}" />
+ <entry key="resource.loaders" value="file, classpath, string" />
+ <entry key="resource.loader.classpath.class" value="org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" />
+ <entry key="resource.loader.string.class" value="org.apache.velocity.runtime.resource.loader.StringResourceLoader" />
+ <entry key="resource.loader.file.class" value="org.apache.velocity.runtime.resource.loader.FileResourceLoader" />
+ <entry key="resource.loader.file.path" value="\" />
+ <entry key="resource.loader.file.cache" value="false" />
+ <entry key="runtime.strict_mode.enable" value="false" />
+ </util:map>
+
+ <bean id="shibboleth.VelocityEngine" class="net.shibboleth.shared.spring.velocity.VelocityEngineFactoryBean"
+ p:velocityPropertiesMap-ref="shibboleth.DefaultVelocityEngineProperties"/>
+
<DataConnector id="staticAttributes"
xsi:type="ScriptedDataConnector"
xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -9,4 +31,5 @@
]]></Script>
<ScriptFile>classpath:/net/shibboleth/idp/attribute/resolver/spring/dc/scriptedConnector.8.js</ScriptFile>
<FailoverDataConnector ref="w"/>
-</DataConnector>
\ No newline at end of file
+</DataConnector>
+</beans>
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeNone.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeNone.xml
index ba872e302..6d0eabea6 100644
--- a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeNone.xml
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeNone.xml
@@ -1,7 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+ default-init-method="initialize">
+
+ <util:map id="shibboleth.DefaultVelocityEngineProperties">
+ <entry key="parser.space_gobbling" value="%{idp.velocity.space.gobbling:bc}" />
+ <entry key="resource.loaders" value="file, classpath, string" />
+ <entry key="resource.loader.classpath.class" value="org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" />
+ <entry key="resource.loader.string.class" value="org.apache.velocity.runtime.resource.loader.StringResourceLoader" />
+ <entry key="resource.loader.file.class" value="org.apache.velocity.runtime.resource.loader.FileResourceLoader" />
+ <entry key="resource.loader.file.path" value="\" />
+ <entry key="resource.loader.file.cache" value="false" />
+ <entry key="runtime.strict_mode.enable" value="false" />
+ </util:map>
+
+ <bean id="shibboleth.VelocityEngine" class="net.shibboleth.shared.spring.velocity.VelocityEngineFactoryBean"
+ p:velocityPropertiesMap-ref="shibboleth.DefaultVelocityEngineProperties"/>
+
<DataConnector id="staticAttributes"
xsi:type="ScriptedDataConnector"
xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd"/>
+</beans>
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeTooManyFiles.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeTooManyFiles.xml
index 3439eac83..ffe9213cf 100644
--- a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeTooManyFiles.xml
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeTooManyFiles.xml
@@ -1,4 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+ default-init-method="initialize">
+
+ <util:map id="shibboleth.DefaultVelocityEngineProperties">
+ <entry key="parser.space_gobbling" value="%{idp.velocity.space.gobbling:bc}" />
+ <entry key="resource.loaders" value="file, classpath, string" />
+ <entry key="resource.loader.classpath.class" value="org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" />
+ <entry key="resource.loader.string.class" value="org.apache.velocity.runtime.resource.loader.StringResourceLoader" />
+ <entry key="resource.loader.file.class" value="org.apache.velocity.runtime.resource.loader.FileResourceLoader" />
+ <entry key="resource.loader.file.path" value="\" />
+ <entry key="resource.loader.file.cache" value="false" />
+ <entry key="runtime.strict_mode.enable" value="false" />
+ </util:map>
+
+ <bean id="shibboleth.VelocityEngine" class="net.shibboleth.shared.spring.velocity.VelocityEngineFactoryBean"
+ p:velocityPropertiesMap-ref="shibboleth.DefaultVelocityEngineProperties"/>
+
<DataConnector id="staticAttributes"
xsi:type="ScriptedDataConnector"
xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -8,3 +30,4 @@
<ScriptFile>classpath:/net/shibboleth/idp/attribute/resolver/spring/dc/scriptedConnector.8.js</ScriptFile>
<FailoverDataConnector ref="w"/>
</DataConnector>
+</beans>
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeTooManyScripts.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeTooManyScripts.xml
index 6d628f7d0..9b768d99f 100644
--- a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeTooManyScripts.xml
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeTooManyScripts.xml
@@ -1,4 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+ default-init-method="initialize">
+
+ <util:map id="shibboleth.DefaultVelocityEngineProperties">
+ <entry key="parser.space_gobbling" value="%{idp.velocity.space.gobbling:bc}" />
+ <entry key="resource.loaders" value="file, classpath, string" />
+ <entry key="resource.loader.classpath.class" value="org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" />
+ <entry key="resource.loader.string.class" value="org.apache.velocity.runtime.resource.loader.StringResourceLoader" />
+ <entry key="resource.loader.file.class" value="org.apache.velocity.runtime.resource.loader.FileResourceLoader" />
+ <entry key="resource.loader.file.path" value="\" />
+ <entry key="resource.loader.file.cache" value="false" />
+ <entry key="runtime.strict_mode.enable" value="false" />
+ </util:map>
+
+ <bean id="shibboleth.VelocityEngine" class="net.shibboleth.shared.spring.velocity.VelocityEngineFactoryBean"
+ p:velocityPropertiesMap-ref="shibboleth.DefaultVelocityEngineProperties"/>
+
<DataConnector id="staticAttributes"
xsi:type="ScriptedDataConnector"
xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -12,3 +34,4 @@
]]></Script>
<FailoverDataConnector ref="w"/>
</DataConnector>
+</beans>
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeWithCache.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeWithCache.xml
new file mode 100644
index 000000000..8e798ec41
--- /dev/null
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributeWithCache.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+ default-init-method="initialize">
+
+ <util:map id="shibboleth.DefaultVelocityEngineProperties">
+ <entry key="parser.space_gobbling" value="%{idp.velocity.space.gobbling:bc}" />
+ <entry key="resource.loaders" value="file, classpath, string" />
+ <entry key="resource.loader.classpath.class" value="org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" />
+ <entry key="resource.loader.string.class" value="org.apache.velocity.runtime.resource.loader.StringResourceLoader" />
+ <entry key="resource.loader.file.class" value="org.apache.velocity.runtime.resource.loader.FileResourceLoader" />
+ <entry key="resource.loader.file.path" value="\" />
+ <entry key="resource.loader.file.cache" value="false" />
+ <entry key="runtime.strict_mode.enable" value="false" />
+ </util:map>
+
+ <bean id="shibboleth.VelocityEngine" class="net.shibboleth.shared.spring.velocity.VelocityEngineFactoryBean"
+ p:velocityPropertiesMap-ref="shibboleth.DefaultVelocityEngineProperties"/>
+
+
+<DataConnector id="scriptedAttributes"
+ xsi:type="ScriptedDataConnector"
+ xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
+ xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd">
+ <Script><![CDATA[
+ foo;
+ ]]></Script>
+ <ResultCache />
+ <CacheKeyTemplate>99</CacheKeyTemplate>
+</DataConnector>
+
+</beans>
\ No newline at end of file
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributes.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributes.xml
index 4dd047973..d64648bf4 100644
--- a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributes.xml
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/scriptedAttributes.xml
@@ -1,4 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+ default-init-method="initialize">
+
+ <util:map id="shibboleth.DefaultVelocityEngineProperties">
+ <entry key="parser.space_gobbling" value="%{idp.velocity.space.gobbling:bc}" />
+ <entry key="resource.loaders" value="file, classpath, string" />
+ <entry key="resource.loader.classpath.class" value="org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" />
+ <entry key="resource.loader.string.class" value="org.apache.velocity.runtime.resource.loader.StringResourceLoader" />
+ <entry key="resource.loader.file.class" value="org.apache.velocity.runtime.resource.loader.FileResourceLoader" />
+ <entry key="resource.loader.file.path" value="\" />
+ <entry key="resource.loader.file.cache" value="false" />
+ <entry key="runtime.strict_mode.enable" value="false" />
+ </util:map>
+
+ <bean id="shibboleth.VelocityEngine" class="net.shibboleth.shared.spring.velocity.VelocityEngineFactoryBean"
+ p:velocityPropertiesMap-ref="shibboleth.DefaultVelocityEngineProperties"/>
+
<DataConnector id="staticAttributes"
xsi:type="ScriptedDataConnector"
xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -8,3 +30,4 @@
xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd">
<ScriptFile>classpath:/net/shibboleth/idp/attribute/resolver/spring/dc/scriptedConnector.8.js</ScriptFile>
</DataConnector>
+</beans>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list