[java-identity-provider] branch feature/IDP-1434 updated: Revert behavior of query filtering on unmapped attributes.
Scott Cantor
cantor.2 at osu.edu
Tue May 7 08:37:30 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch feature/IDP-1434
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=b5007e7eb19570105484dee56078afe497eec2cf
The following commit(s) were added to refs/heads/feature/IDP-1434 by this push:
new b5007e7 Revert behavior of query filtering on unmapped attributes.
b5007e7 is described below
commit b5007e7eb19570105484dee56078afe497eec2cf
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue May 7 08:37:23 2019 -0400
Revert behavior of query filtering on unmapped attributes.
---
.../test/flows/saml1/SAML1AttributeQueryFlowTest.java | 5 +++++
.../test/flows/saml2/SAML2AttributeQueryFlowTest.java | 5 +++++
.../impl/FilterByQueriedAttributeDesignators.java | 17 ++++++++---------
.../saml2/profile/impl/FilterByQueriedAttributes.java | 14 ++++++--------
.../impl/FilterByQueriedAttributeDesignatorsTest.java | 19 -------------------
.../profile/impl/FilterByQueriedAttributesTest.java | 18 ------------------
.../idp/saml/impl/profile/AttributeQuery.xml | 1 +
.../idp/saml/impl/profile/AttributeQuerySaml1.xml | 1 +
.../idp/saml/impl/profile/UnmappedAttributeQuery.xml | 19 -------------------
.../saml/impl/profile/UnmappedAttributeQuerySaml1.xml | 14 --------------
10 files changed, 26 insertions(+), 87 deletions(-)
diff --git a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java
index 58a55a4..92d8bec 100644
--- a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java
+++ b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml1/SAML1AttributeQueryFlowTest.java
@@ -161,6 +161,11 @@ public class SAML1AttributeQueryFlowTest extends AbstractSAML1FlowTest {
designator.setAttributeNamespace(SAMLConstants.SAML1_ATTR_NAMESPACE_URI);
designator.setAttributeName("urn:mace:dir:attribute-def:mail");
attributeQuery.getAttributeQuery().getAttributeDesignators().add(designator);
+
+ designator = designatorBuilder.buildObject();
+ designator.setAttributeNamespace(SAMLConstants.SAML1_ATTR_NAMESPACE_URI);
+ designator.setAttributeName("urn:mace:dir:attribute-def:foo");
+ attributeQuery.getAttributeQuery().getAttributeDesignators().add(designator);
}
final Envelope envelope = buildSOAP11Envelope(attributeQuery);
diff --git a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java
index 40af557..b994561 100644
--- a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java
+++ b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/saml2/SAML2AttributeQueryFlowTest.java
@@ -170,6 +170,11 @@ public class SAML2AttributeQueryFlowTest extends AbstractSAML2FlowTest {
XSAny value = valueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME);
value.setTextContent("jdoe at example.org");
designator.getAttributeValues().add(value);
+
+ designator = designatorBuilder.buildObject();
+ designator.setNameFormat(Attribute.URI_REFERENCE);
+ designator.setName("urn:mace:dir:attribute-def:foo");
+ attributeQuery.getAttributes().add(designator);
}
final Envelope envelope = buildSOAP11Envelope(attributeQuery);
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignators.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignators.java
index 6c1069e..e8dfbff 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignators.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignators.java
@@ -184,14 +184,13 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
}
for (final AttributeDesignator designator : query.getAttributeDesignators()) {
- decodeAttributeDesignator(component.getComponent(), profileRequestContext, designator,
- decodedAttributeIds);
+ try {
+ decodeAttributeDesignator(component.getComponent(), profileRequestContext, designator,
+ decodedAttributeIds);
+ } catch (final AttributeDecodingException e) {
+ log.warn("{} Error decoding AttributeDesignators", getLogPrefix(), e);
+ }
}
-
- } catch (final AttributeDecodingException e) {
- log.error("{} Error decoding AttributeDesignators, cannot process query", getLogPrefix(), e);
- ActionSupport.buildEvent(profileRequestContext, EventIds.MESSAGE_PROC_ERROR);
- return;
} finally {
if (component != null) {
component.unpinComponent();
@@ -231,8 +230,8 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
final Collection<Properties> transcodingRules = registry.getTranscodingProperties(input);
if (transcodingRules.isEmpty()) {
- throw new AttributeDecodingException("AttributeDesignator '" + input.getAttributeName() +
- "' does not have transcoding rules, cannot process query");
+ throw new AttributeDecodingException("No transcoding rule for AttributeDesignator '" +
+ input.getAttributeName() + "'");
}
for (final Properties rules : transcodingRules) {
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java
index c6e159c..6f0061a 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java
@@ -182,13 +182,12 @@ public class FilterByQueriedAttributes extends AbstractProfileAction {
}
for (final Attribute designator : query.getAttributes()) {
- decodeAttribute(component.getComponent(), profileRequestContext, designator, mapped);
+ try {
+ decodeAttribute(component.getComponent(), profileRequestContext, designator, mapped);
+ } catch (final AttributeDecodingException e) {
+ log.error("{} Error decoding queried Attribute", getLogPrefix(), e);
+ }
}
-
- } catch (final AttributeDecodingException e) {
- log.error("{} Error decoding queried Attribute, cannot process query", getLogPrefix(), e);
- ActionSupport.buildEvent(profileRequestContext, EventIds.MESSAGE_PROC_ERROR);
- return;
} finally {
if (component != null) {
component.unpinComponent();
@@ -241,8 +240,7 @@ public class FilterByQueriedAttributes extends AbstractProfileAction {
final Collection<Properties> transcodingRules = registry.getTranscodingProperties(input);
if (transcodingRules.isEmpty()) {
- throw new AttributeDecodingException("Attribute '" + input.getName() +
- "' does not have transcoding rules, cannot process query");
+ throw new AttributeDecodingException("No transcoding rule for Attribute '" + input.getName() + "'");
}
for (final Properties rules : transcodingRules) {
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
index 6921679..4d6bbb0 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
@@ -26,7 +26,6 @@ import javax.annotation.Nullable;
import org.opensaml.core.xml.XMLObjectBaseTestCase;
import org.opensaml.core.xml.io.UnmarshallingException;
-import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.saml1.core.Request;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -112,24 +111,6 @@ public class FilterByQueriedAttributeDesignatorsTest extends XMLObjectBaseTestCa
ActionTestingSupport.assertProceedEvent(event);
}
- @Test public void unmappedAttributes() throws XMLParserException, UnmarshallingException {
- query = unmarshallElement(PATH + "UnmappedAttributeQuerySaml1.xml", true);
-
- prc.getInboundMessageContext().setMessage(query);
-
- final RelyingPartyContext rpc = prc.getSubcontext(RelyingPartyContext.class,true);
- final AttributeContext ac = rpc.getSubcontext(AttributeContext.class,true);
- final List<IdPAttribute> attributes = List.of(
- new IdPAttribute("eduPersonAssurance"),
- new IdPAttribute("flooby"),
- new IdPAttribute("eduPersonScopedAffiliation"),
- new IdPAttribute("eduPersonTargetedID"));
- ac.setIdPAttributes(attributes);
-
- final Event event = action.execute(rc);
- ActionTestingSupport.assertEvent(event, EventIds.MESSAGE_PROC_ERROR);
- }
-
@Test public void noValues() {
final RelyingPartyContext rpc = prc.getSubcontext(RelyingPartyContext.class,true);
final AttributeContext ac = rpc.getSubcontext(AttributeContext.class,true);
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributesTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributesTest.java
index 1f08241..cc6738c 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributesTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributesTest.java
@@ -26,7 +26,6 @@ import javax.annotation.Nullable;
import org.opensaml.core.xml.XMLObjectBaseTestCase;
import org.opensaml.core.xml.io.UnmarshallingException;
-import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.saml2.core.AttributeQuery;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -111,23 +110,6 @@ public class FilterByQueriedAttributesTest extends XMLObjectBaseTestCase {
ActionTestingSupport.assertProceedEvent(event);
}
- @Test public void unmappedAttributes() throws XMLParserException, UnmarshallingException {
- query = unmarshallElement(PATH + "UnmappedAttributeQuery.xml", true);
-
- prc.getInboundMessageContext().setMessage(query);
-
- final RelyingPartyContext rpc = prc.getSubcontext(RelyingPartyContext.class,true);
- final AttributeContext ac = rpc.getSubcontext(AttributeContext.class,true);
- final List<IdPAttribute> attributes = List.of(
- new IdPAttribute("eduPersonAssurance"),
- new IdPAttribute("flooby"),
- new IdPAttribute("eduPersonScopedAffiliation"),
- new IdPAttribute("eduPersonTargetedID"));
- ac.setIdPAttributes(attributes);
- final Event event = action.execute(rc);
- ActionTestingSupport.assertEvent(event, EventIds.MESSAGE_PROC_ERROR);
- }
-
@Test public void noValues() {
final RelyingPartyContext rpc = prc.getSubcontext(RelyingPartyContext.class,true);
final AttributeContext ac = rpc.getSubcontext(AttributeContext.class,true);
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuery.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuery.xml
index 578b4f3..71d44c4 100644
--- a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuery.xml
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuery.xml
@@ -15,4 +15,5 @@
<AttributeValue xsi:type="xs:string">blue#yellow</AttributeValue>
</Attribute>
<Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" FriendlyName="eduPersonTargetedID"/>
+ <Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" FriendlyName="eduPersonTargetedIDWithWrongNameFormat"/>
</saml2p:AttributeQuery>
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuerySaml1.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuerySaml1.xml
index ccdc702..5bc3446 100644
--- a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuerySaml1.xml
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuerySaml1.xml
@@ -6,6 +6,7 @@
<Subject>
<NameIdentifier>you</NameIdentifier>
</Subject>
+ <AttributeDesignator AttributeName="flooby" AttributeNamespace="basic" />
<AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" AttributeNamespace="basic" />
<AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" AttributeNamespace="basic" />
<AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" AttributeNamespace="basic"/>
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuery.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuery.xml
deleted file mode 100644
index 3edbf78..0000000
--- a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuery.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
- Version="2.0" ID="AQ" IssueInstant="2018-03-14T17:31:00Z">
- <Issuer>me</Issuer>
- <Subject>
- <NameID>you</NameID>
- </Subject>
- <Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" FriendlyName="eduPersonAssurance">
- <AttributeValue xsi:type="xs:string">turquoise</AttributeValue>
- </Attribute>
- <Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" FriendlyName="eduPersonScopedAffiliation">
- <AttributeValue xsi:type="xs:string">blue#yellow</AttributeValue>
- </Attribute>
- <Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" FriendlyName="eduPersonTargetedID"/>
- <Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" FriendlyName="eduPersonTargetedIDWithWrongNameFormat"/>
-</saml2p:AttributeQuery>
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuerySaml1.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuerySaml1.xml
deleted file mode 100644
index 5bc3446..0000000
--- a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuerySaml1.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<saml1p:Request xmlns:saml1p="urn:oasis:names:tc:SAML:1.0:protocol" xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
- MajorVersion="1" MinorVersion="1" RequestID="ID" IssueInstant="2019-05-02T12:00:00">
- <saml1p:AttributeQuery>
- <Subject>
- <NameIdentifier>you</NameIdentifier>
- </Subject>
- <AttributeDesignator AttributeName="flooby" AttributeNamespace="basic" />
- <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" AttributeNamespace="basic" />
- <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" AttributeNamespace="basic" />
- <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" AttributeNamespace="basic"/>
- </saml1p:AttributeQuery>
-</saml1p:Request>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list