[java-identity-provider] branch master updated: IDP-1456 Parsers for ScopeMatchesShibMDScope and Value MatchesShibMDScope
Rod Widdowson
rdw at steadingsoftware.com
Fri May 31 11:42:31 EDT 2019
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=a52b2f5f04216e7b22e68aeecba1f674ff85b457
The following commit(s) were added to refs/heads/master by this push:
new a52b2f5 IDP-1456 Parsers for ScopeMatchesShibMDScope and Value MatchesShibMDScope
a52b2f5 is described below
commit a52b2f5f04216e7b22e68aeecba1f674ff85b457
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri May 31 16:38:07 2019 +0100
IDP-1456 Parsers for ScopeMatchesShibMDScope and Value MatchesShibMDScope
https://issues.shibboleth.net/jira/browse/IDP-1456
---
.../impl/AttributeFilterNamespaceHandler.java | 6 +++
.../saml/impl/ScopeMatchesShibMDScopeParser.java | 51 ++++++++++++++++++++++
.../saml/impl/ValueMatchesShibMDScopeParser.java | 50 +++++++++++++++++++++
.../filter/spring/saml/ScopeMatchesMDTest.java | 39 +++++++++++++++++
.../filter/spring/saml/ValueMatchesMDTest.java | 39 +++++++++++++++++
.../idp/attribute/filter/matcher/mdscope.xml | 4 ++
.../idp/attribute/filter/matcher/mdvalue.xml | 4 ++
.../src/main/resources/schema/shibboleth-afp.xsd | 25 +++++++++++
8 files changed, 218 insertions(+)
diff --git a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/impl/AttributeFilterNamespaceHandler.java b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/impl/AttributeFilterNamespaceHandler.java
index 0c617ea..f9d052a 100644
--- a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/impl/AttributeFilterNamespaceHandler.java
+++ b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/impl/AttributeFilterNamespaceHandler.java
@@ -50,6 +50,8 @@ import net.shibboleth.idp.attribute.filter.spring.saml.impl.AttributeRequesterIn
import net.shibboleth.idp.attribute.filter.spring.saml.impl.AttributeRequesterNameIdFormatRuleParser;
import net.shibboleth.idp.attribute.filter.spring.saml.impl.AttributeRequesterRegistrationAuthorityRuleParser;
import net.shibboleth.idp.attribute.filter.spring.saml.impl.MappedAttributeInMetadataRuleParser;
+import net.shibboleth.idp.attribute.filter.spring.saml.impl.ScopeMatchesShibMDScopeParser;
+import net.shibboleth.idp.attribute.filter.spring.saml.impl.ValueMatchesShibMDScopeParser;
/** Namespace handler for the attribute filtering engine. */
public class AttributeFilterNamespaceHandler extends BaseSpringNamespaceHandler {
@@ -150,6 +152,10 @@ public class AttributeFilterNamespaceHandler extends BaseSpringNamespaceHandler
registerBeanDefinitionParser(AttributeIssuerRegistrationAuthorityRuleParser.SCHEMA_TYPE,
new AttributeIssuerRegistrationAuthorityRuleParser());
+
+ registerBeanDefinitionParser(ValueMatchesShibMDScopeParser.SCHEMA_TYPE, new ValueMatchesShibMDScopeParser());
+
+ registerBeanDefinitionParser(ScopeMatchesShibMDScopeParser.SCHEMA_TYPE, new ScopeMatchesShibMDScopeParser());
}
// Checkstyle: MethodLength ON
}
\ No newline at end of file
diff --git a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/ScopeMatchesShibMDScopeParser.java b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/ScopeMatchesShibMDScopeParser.java
new file mode 100644
index 0000000..868b6be
--- /dev/null
+++ b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/ScopeMatchesShibMDScopeParser.java
@@ -0,0 +1,51 @@
+/*
+ * 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.attribute.filter.spring.saml.impl;
+
+import javax.annotation.Nonnull;
+import javax.xml.namespace.QName;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+import net.shibboleth.idp.attribute.filter.matcher.saml.impl.AttributeScopeMatchesShibMDScope;
+import net.shibboleth.idp.attribute.filter.spring.BaseFilterParser;
+import net.shibboleth.idp.attribute.filter.spring.matcher.BaseAttributeValueMatcherParser;
+
+/**
+ * Bean definition parser for {@link AttributeScopeMatchesShibMDScope}.
+ */
+public class ScopeMatchesShibMDScopeParser extends BaseAttributeValueMatcherParser {
+
+ /** Schema type. */
+ public static final QName SCHEMA_TYPE = new QName(BaseFilterParser.NAMESPACE,
+ "ScopeMatchesShibMDScope");
+
+ /** {@inheritDoc} */
+ @Override @Nonnull protected Class<AttributeScopeMatchesShibMDScope> getNativeBeanClass() {
+ return AttributeScopeMatchesShibMDScope.class;
+ }
+
+ /** {@inheritDoc} */
+ protected void doNativeParse(final Element element,
+ final ParserContext parserContext, final BeanDefinitionBuilder builder) {
+ // Nothing to do
+ }
+
+}
diff --git a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/ValueMatchesShibMDScopeParser.java b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/ValueMatchesShibMDScopeParser.java
new file mode 100644
index 0000000..1b484f7
--- /dev/null
+++ b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/ValueMatchesShibMDScopeParser.java
@@ -0,0 +1,50 @@
+/*
+ * 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.attribute.filter.spring.saml.impl;
+
+import javax.annotation.Nonnull;
+import javax.xml.namespace.QName;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+import net.shibboleth.idp.attribute.filter.matcher.saml.impl.AttributeValueMatchesShibMDScope;
+import net.shibboleth.idp.attribute.filter.spring.BaseFilterParser;
+import net.shibboleth.idp.attribute.filter.spring.matcher.BaseAttributeValueMatcherParser;
+
+/**
+ * Bean definition parser for {@link AttributeValueMatchesShibMDScope}.
+ */
+public class ValueMatchesShibMDScopeParser extends BaseAttributeValueMatcherParser {
+
+ /** Schema type. */
+ public static final QName SCHEMA_TYPE = new QName(BaseFilterParser.NAMESPACE,
+ "ValueMatchesShibMDScope");
+
+ /** {@inheritDoc} */
+ @Override @Nonnull protected Class<AttributeValueMatchesShibMDScope> getNativeBeanClass() {
+ return AttributeValueMatchesShibMDScope.class;
+ }
+
+ /** {@inheritDoc} */
+ protected void doNativeParse(final Element element,
+ final ParserContext parserContext, final BeanDefinitionBuilder builder) {
+ // Nothing to do
+ }
+}
diff --git a/idp-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/saml/ScopeMatchesMDTest.java b/idp-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/saml/ScopeMatchesMDTest.java
new file mode 100644
index 0000000..910c3d9
--- /dev/null
+++ b/idp-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/saml/ScopeMatchesMDTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.attribute.filter.spring.saml;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import net.shibboleth.idp.attribute.filter.Matcher;
+import net.shibboleth.idp.attribute.filter.matcher.saml.impl.AttributeScopeMatchesShibMDScope;
+import net.shibboleth.idp.attribute.filter.spring.BaseAttributeFilterParserTest;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
+/**
+ * Test for {@link AttributeScopeMatchesShibMDScope} matcher or policy Rule.
+ */
+public class ScopeMatchesMDTest extends BaseAttributeFilterParserTest {
+
+ @Test public void testMatcher() throws ComponentInitializationException {
+ Matcher matcher = getMatcher("mdscope.xml");
+
+ assertEquals(matcher.getClass(), AttributeScopeMatchesShibMDScope.class);
+ }
+}
diff --git a/idp-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/saml/ValueMatchesMDTest.java b/idp-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/saml/ValueMatchesMDTest.java
new file mode 100644
index 0000000..438cf3c
--- /dev/null
+++ b/idp-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/saml/ValueMatchesMDTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.attribute.filter.spring.saml;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import net.shibboleth.idp.attribute.filter.Matcher;
+import net.shibboleth.idp.attribute.filter.matcher.saml.impl.AttributeValueMatchesShibMDScope;
+import net.shibboleth.idp.attribute.filter.spring.BaseAttributeFilterParserTest;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
+/**
+ * Test for {@link AttributeValueMatchesShibMDScope} matcher or policy Rule.
+ */
+public class ValueMatchesMDTest extends BaseAttributeFilterParserTest {
+
+ @Test public void testMatcher() throws ComponentInitializationException {
+ Matcher matcher = getMatcher("mdvalue.xml");
+
+ assertEquals(matcher.getClass(), AttributeValueMatchesShibMDScope.class);
+ }
+}
diff --git a/idp-attribute-filter-spring/src/test/resources/net/shibboleth/idp/attribute/filter/matcher/mdscope.xml b/idp-attribute-filter-spring/src/test/resources/net/shibboleth/idp/attribute/filter/matcher/mdscope.xml
new file mode 100644
index 0000000..ad01630
--- /dev/null
+++ b/idp-attribute-filter-spring/src/test/resources/net/shibboleth/idp/attribute/filter/matcher/mdscope.xml
@@ -0,0 +1,4 @@
+<AttributeRule attributeID="email" xmlns="urn:mace:shibboleth:2.0:afp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:mace:shibboleth:2.0:afp http://shibboleth.net/schema/idp/shibboleth-afp.xsd">
+ <PermitValueRule xsi:type="ScopeMatchesShibMDScope" />
+</AttributeRule>
\ No newline at end of file
diff --git a/idp-attribute-filter-spring/src/test/resources/net/shibboleth/idp/attribute/filter/matcher/mdvalue.xml b/idp-attribute-filter-spring/src/test/resources/net/shibboleth/idp/attribute/filter/matcher/mdvalue.xml
new file mode 100644
index 0000000..2cf4ec5
--- /dev/null
+++ b/idp-attribute-filter-spring/src/test/resources/net/shibboleth/idp/attribute/filter/matcher/mdvalue.xml
@@ -0,0 +1,4 @@
+<AttributeRule attributeID="email" xmlns="urn:mace:shibboleth:2.0:afp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:mace:shibboleth:2.0:afp http://shibboleth.net/schema/idp/shibboleth-afp.xsd">
+ <PermitValueRule xsi:type="ValueMatchesShibMDScope" />
+</AttributeRule>
\ No newline at end of file
diff --git a/idp-schema/src/main/resources/schema/shibboleth-afp.xsd b/idp-schema/src/main/resources/schema/shibboleth-afp.xsd
index 1f8085b..49ea555 100644
--- a/idp-schema/src/main/resources/schema/shibboleth-afp.xsd
+++ b/idp-schema/src/main/resources/schema/shibboleth-afp.xsd
@@ -755,7 +755,32 @@
<extension base="afp:RegistrationAuthorityMatchType" />
</complexContent>
</complexType>
+
+ <complexType name="ScopeMatchesShibMDScope">
+ <annotation>
+ <documentation>
+ A match function that ensures that an attribute value's scope matches a scope given in
+ metadata for the entity or role of the attribute issuer.
+
+ </documentation>
+ </annotation>
+ <complexContent>
+ <extension base="afp:MatchFunctorType"/>
+ </complexContent>
+ </complexType>
+ <complexType name="ValueMatchesShibMDScope">
+ <annotation>
+ <documentation>
+ A match function that ensures that an attribute value's scope matches a scope given in
+ metadata for the entity or role of the attribute issuer.
+ </documentation>
+ </annotation>
+ <complexContent>
+ <extension base="afp:MatchFunctorType"/>
+ </complexContent>
+ </complexType>
+
<complexType name="IssuerRegistrationAuthority">
<annotation>
<documentation>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list