[java-identity-provider] branch master updated: Adjust some logging, and rework example registry rules as XML.
Scott Cantor
cantor.2 at osu.edu
Tue May 21 13:57:53 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor 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=121bca4c067a1fc78c83286ab2d0b629452dfb8b
The following commit(s) were added to refs/heads/master by this push:
new 121bca4 Adjust some logging, and rework example registry rules as XML.
121bca4 is described below
commit 121bca4c067a1fc78c83286ab2d0b629452dfb8b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue May 21 13:57:50 2019 -0400
Adjust some logging, and rework example registry rules as XML.
---
.../attribute/AbstractCASAttributeTranscoder.java | 8 +--
.../main/resources/attributes/custom/README.txt | 9 ++++
.../src/main/resources/attributes/saml1-rules.xml | 61 ++++++++++++++++++++++
.../attributes/saml1/eduPersonPrincipalName.txt | 4 --
.../saml1/eduPersonScopedAffiliation.txt | 4 --
.../src/main/resources/attributes/saml1/mail.txt | 4 --
.../src/main/resources/attributes/saml1/uid.txt | 4 --
.../src/main/resources/attributes/saml2-rules.xml | 61 ++++++++++++++++++++++
.../attributes/saml2/eduPersonPrincipalName.txt | 4 --
.../saml2/eduPersonScopedAffiliation.txt | 4 --
.../src/main/resources/attributes/saml2/mail.txt | 4 --
.../src/main/resources/attributes/saml2/uid.txt | 4 --
.../src/main/resources/conf/attribute-registry.xml | 12 ++++-
.../src/main/resources/conf/services.properties | 2 +
idp-conf/src/main/resources/conf/services.xml | 2 +
.../main/resources/system/conf/services-system.xml | 2 +
.../AbstractSAMLAttributeTranscoder.java | 8 +--
.../impl/AttributeMappingNodeProcessor.java | 2 +-
18 files changed, 156 insertions(+), 43 deletions(-)
diff --git a/idp-cas-api/src/main/java/net/shibboleth/idp/cas/attribute/AbstractCASAttributeTranscoder.java b/idp-cas-api/src/main/java/net/shibboleth/idp/cas/attribute/AbstractCASAttributeTranscoder.java
index 3a70871..071bc67 100644
--- a/idp-cas-api/src/main/java/net/shibboleth/idp/cas/attribute/AbstractCASAttributeTranscoder.java
+++ b/idp-cas-api/src/main/java/net/shibboleth/idp/cas/attribute/AbstractCASAttributeTranscoder.java
@@ -76,7 +76,7 @@ public abstract class AbstractCASAttributeTranscoder<EncodedType extends IdPAttr
final String attributeId = attribute.getId();
- log.debug("Beginning to encode attribute {}", attributeId);
+ log.trace("Beginning to encode attribute {}", attributeId);
final String name = rule.getOrDefault(PROP_NAME, String.class, attributeId);
@@ -108,7 +108,7 @@ public abstract class AbstractCASAttributeTranscoder<EncodedType extends IdPAttr
throw new AttributeEncodingException("Failed to encode any values for attribute " + attribute.getId());
}
- log.debug("Encoded {} values for attribute {}", casAttribute.getValues().size(), attributeId);
+ log.trace("Encoded {} values for attribute {}", casAttribute.getValues().size(), attributeId);
return casAttribute;
}
@@ -119,7 +119,7 @@ public abstract class AbstractCASAttributeTranscoder<EncodedType extends IdPAttr
final String attributeName = getEncodedName(rule);
- log.debug("Beginning to decode attribute {}", attributeName);
+ log.trace("Beginning to decode attribute {}", attributeName);
final List<IdPAttributeValue> idpAttributeValues = new ArrayList<>();
@@ -139,7 +139,7 @@ public abstract class AbstractCASAttributeTranscoder<EncodedType extends IdPAttr
}
if (!idpAttributeValues.isEmpty()) {
- log.debug("Decoded {} values for attribute {}", idpAttributeValues.size(), attributeName);
+ log.trace("Decoded {} values for attribute {}", idpAttributeValues.size(), attributeName);
}
return buildIdPAttribute(profileRequestContext, input, rule, idpAttributeValues);
}
diff --git a/idp-conf/src/main/resources/attributes/custom/README.txt b/idp-conf/src/main/resources/attributes/custom/README.txt
new file mode 100644
index 0000000..03a9d73
--- /dev/null
+++ b/idp-conf/src/main/resources/attributes/custom/README.txt
@@ -0,0 +1,9 @@
+# You can create custom attribute mapping rules using
+# simple property files stored in this directory tree.
+# Spring property replacement is NOT supported.
+
+# As an example, a default SAML 2 rule for eduPersonPrincipalName would be:
+
+#id=eduPersonPrincipalName
+#transcoderBean=SAML2ScopedStringTranscoder
+#name=urn:oid:1.3.6.1.4.1.5923.1.1.1.6
diff --git a/idp-conf/src/main/resources/attributes/saml1-rules.xml b/idp-conf/src/main/resources/attributes/saml1-rules.xml
new file mode 100644
index 0000000..9f04672
--- /dev/null
+++ b/idp-conf/src/main/resources/attributes/saml1-rules.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:context="http://www.springframework.org/schema/context"
+ 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ 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.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+
+ default-init-method="initialize"
+ default-destroy-method="destroy">
+
+ <!-- Default SAML 1 Attribute transcoding rules. -->
+
+ <bean parent="shibboleth.TranscodingRule">
+ <constructor-arg>
+ <map>
+ <entry key="id" value="uid" />
+ <entry key="transcoder" value-ref="SAML1StringTranscoder" />
+ <entry key="name" value="urn:mace:dir:attribute-def:uid" />
+ <entry key="encodeType" value="%{idp.service.attribute.registry.encodeType:true}" />
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <bean parent="shibboleth.TranscodingRule">
+ <constructor-arg>
+ <map>
+ <entry key="id" value="mail" />
+ <entry key="transcoder" value-ref="SAML1StringTranscoder" />
+ <entry key="name" value="urn:mace:dir:attribute-def:mail" />
+ <entry key="encodeType" value="%{idp.service.attribute.registry.encodeType:true}" />
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <bean parent="shibboleth.TranscodingRule">
+ <constructor-arg>
+ <map>
+ <entry key="id" value="eduPersonPrincipalName" />
+ <entry key="transcoder" value-ref="SAML1ScopedStringTranscoder" />
+ <entry key="name" value="urn:mace:dir:attribute-def:eduPersonPrincipalName" />
+ <entry key="encodeType" value="%{idp.service.attribute.registry.encodeType:true}" />
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <bean parent="shibboleth.TranscodingRule">
+ <constructor-arg>
+ <map>
+ <entry key="id" value="eduPersonScopedAffiliation" />
+ <entry key="transcoder" value-ref="SAML1ScopedStringTranscoder" />
+ <entry key="name" value="urn:mace:dir:attribute-def:eduPersonScopedAffiliation" />
+ <entry key="encodeType" value="%{idp.service.attribute.registry.encodeType:true}" />
+ </map>
+ </constructor-arg>
+ </bean>
+
+</beans>
diff --git a/idp-conf/src/main/resources/attributes/saml1/eduPersonPrincipalName.txt b/idp-conf/src/main/resources/attributes/saml1/eduPersonPrincipalName.txt
deleted file mode 100644
index 74ff33e..0000000
--- a/idp-conf/src/main/resources/attributes/saml1/eduPersonPrincipalName.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-id = eduPersonPrincipalName
-transcoderBean = SAML1ScopedStringTranscoder
-name = urn:mace:dir:attribute-def:eduPersonPrincipalName
-encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml1/eduPersonScopedAffiliation.txt b/idp-conf/src/main/resources/attributes/saml1/eduPersonScopedAffiliation.txt
deleted file mode 100644
index 46fe82d..0000000
--- a/idp-conf/src/main/resources/attributes/saml1/eduPersonScopedAffiliation.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-id = eduPersonScopedAffiliation
-transcoderBean = SAML1ScopedStringTranscoder
-name = urn:mace:dir:attribute-def:eduPersonScopedAffiliation
-encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml1/mail.txt b/idp-conf/src/main/resources/attributes/saml1/mail.txt
deleted file mode 100644
index d406301..0000000
--- a/idp-conf/src/main/resources/attributes/saml1/mail.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-id = mail
-transcoderBean = SAML1StringTranscoder
-name = urn:mace:dir:attribute-def:mail
-encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml1/uid.txt b/idp-conf/src/main/resources/attributes/saml1/uid.txt
deleted file mode 100644
index bf6272e..0000000
--- a/idp-conf/src/main/resources/attributes/saml1/uid.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-id = uid
-transcoderBean = SAML1StringTranscoder
-name = urn:mace:dir:attribute-def:uid
-encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml2-rules.xml b/idp-conf/src/main/resources/attributes/saml2-rules.xml
new file mode 100644
index 0000000..0081038
--- /dev/null
+++ b/idp-conf/src/main/resources/attributes/saml2-rules.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:context="http://www.springframework.org/schema/context"
+ 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ 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.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+
+ default-init-method="initialize"
+ default-destroy-method="destroy">
+
+ <!-- Default SAML 2 Attribute transcoding rules. -->
+
+ <bean parent="shibboleth.TranscodingRule">
+ <constructor-arg>
+ <map>
+ <entry key="id" value="uid" />
+ <entry key="transcoder" value-ref="SAML2StringTranscoder" />
+ <entry key="name" value="urn:oid:0.9.2342.19200300.100.1.1" />
+ <entry key="encodeType" value="%{idp.service.attribute.registry.encodeType:true}" />
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <bean parent="shibboleth.TranscodingRule">
+ <constructor-arg>
+ <map>
+ <entry key="id" value="mail" />
+ <entry key="transcoder" value-ref="SAML2StringTranscoder" />
+ <entry key="name" value="urn:oid:0.9.2342.19200300.100.1.3" />
+ <entry key="encodeType" value="%{idp.service.attribute.registry.encodeType:true}" />
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <bean parent="shibboleth.TranscodingRule">
+ <constructor-arg>
+ <map>
+ <entry key="id" value="eduPersonPrincipalName" />
+ <entry key="transcoder" value-ref="SAML2ScopedStringTranscoder" />
+ <entry key="name" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.6" />
+ <entry key="encodeType" value="%{idp.service.attribute.registry.encodeType:true}" />
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <bean parent="shibboleth.TranscodingRule">
+ <constructor-arg>
+ <map>
+ <entry key="id" value="eduPersonScopedAffiliation" />
+ <entry key="transcoder" value-ref="SAML2ScopedStringTranscoder" />
+ <entry key="name" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" />
+ <entry key="encodeType" value="%{idp.service.attribute.registry.encodeType:true}" />
+ </map>
+ </constructor-arg>
+ </bean>
+
+</beans>
diff --git a/idp-conf/src/main/resources/attributes/saml2/eduPersonPrincipalName.txt b/idp-conf/src/main/resources/attributes/saml2/eduPersonPrincipalName.txt
deleted file mode 100644
index 8c1022e..0000000
--- a/idp-conf/src/main/resources/attributes/saml2/eduPersonPrincipalName.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-id = eduPersonPrincipalName
-transcoderBean = SAML2ScopedStringTranscoder
-name = urn:oid:1.3.6.1.4.1.5923.1.1.1.6
-encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml2/eduPersonScopedAffiliation.txt b/idp-conf/src/main/resources/attributes/saml2/eduPersonScopedAffiliation.txt
deleted file mode 100644
index d0e73e9..0000000
--- a/idp-conf/src/main/resources/attributes/saml2/eduPersonScopedAffiliation.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-id = eduPersonScopedAffiliation
-transcoderBean = SAML2ScopedStringTranscoder
-name = urn:oid:1.3.6.1.4.1.5923.1.1.1.9
-encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml2/mail.txt b/idp-conf/src/main/resources/attributes/saml2/mail.txt
deleted file mode 100644
index 8239f7d..0000000
--- a/idp-conf/src/main/resources/attributes/saml2/mail.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-id = mail
-transcoderBean = SAML2StringTranscoder
-name = urn:oid:0.9.2342.19200300.100.1.3
-encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml2/uid.txt b/idp-conf/src/main/resources/attributes/saml2/uid.txt
deleted file mode 100644
index 1e60e72..0000000
--- a/idp-conf/src/main/resources/attributes/saml2/uid.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-id = uid
-transcoderBean = SAML2StringTranscoder
-name = urn:oid:0.9.2342.19200300.100.1.1
-encodeType = false
diff --git a/idp-conf/src/main/resources/conf/attribute-registry.xml b/idp-conf/src/main/resources/conf/attribute-registry.xml
index da86845..b6774ba 100644
--- a/idp-conf/src/main/resources/conf/attribute-registry.xml
+++ b/idp-conf/src/main/resources/conf/attribute-registry.xml
@@ -12,7 +12,15 @@
default-init-method="initialize"
default-destroy-method="destroy">
- <!-- Default location for mappings. -->
- <bean parent="shibboleth.TranscodingRuleLoader" c:_0="%{idp.home}/attributes" />
+ <!--
+ The system comes preconfigured to load SAML mappings directly from resource files
+ configured in services.xml so they're monitored for changes.
+ You can add mappings here, add more XML resource files,
+ or drop property files into the directory noted below.
+ -->
+
+ <!-- Default directory for custom mappings. -->
+ <bean parent="shibboleth.TranscodingRuleLoader" c:_0="%{idp.home}/attributes/custom" />
+
</beans>
diff --git a/idp-conf/src/main/resources/conf/services.properties b/idp-conf/src/main/resources/conf/services.properties
index d691b4a..b5d0572 100644
--- a/idp-conf/src/main/resources/conf/services.properties
+++ b/idp-conf/src/main/resources/conf/services.properties
@@ -27,6 +27,8 @@ idp.service.relyingparty.ignoreUnmappedEntityAttributes=true
#idp.service.attribute.registry.resources = shibboleth.AttributeRegistryResources
#idp.service.attribute.registry.failFast = false
idp.service.attribute.registry.checkInterval = PT15M
+# Default control of whether to encode XML attribute data with xsi:type
+idp.service.attribute.registry.encodeType = false
#idp.service.attribute.resolver.resources = shibboleth.AttributeResolverResources
#idp.service.attribute.resolver.failFast = false
diff --git a/idp-conf/src/main/resources/conf/services.xml b/idp-conf/src/main/resources/conf/services.xml
index 558ae50..ae3b6f3 100644
--- a/idp-conf/src/main/resources/conf/services.xml
+++ b/idp-conf/src/main/resources/conf/services.xml
@@ -73,6 +73,8 @@
<util:list id ="shibboleth.AttributeRegistryResources">
<value>%{idp.home}/conf/attribute-registry.xml</value>
<value>%{idp.home}/system/conf/attribute-registry-system.xml</value>
+ <value>%{idp.home}/attributes/saml2-rules.xml</value>
+ <value>%{idp.home}/attributes/saml1-rules.xml</value>
</util:list>
<!-- This set of resources uses only AttributeEncoders for compatibility. -->
diff --git a/idp-conf/src/main/resources/system/conf/services-system.xml b/idp-conf/src/main/resources/system/conf/services-system.xml
index aff83bf..c6f753e 100644
--- a/idp-conf/src/main/resources/system/conf/services-system.xml
+++ b/idp-conf/src/main/resources/system/conf/services-system.xml
@@ -72,6 +72,8 @@
<util:list id ="shibboleth.DefaultAttributeRegistryResources">
<value>%{idp.home}/conf/attribute-registry.xml</value>
<value>%{idp.home}/system/conf/attribute-registry-system.xml</value>
+ <value>%{idp.home}/attributes/saml2-rules.xml</value>
+ <value>%{idp.home}/attributes/saml1-rules.xml</value>
</util:list>
<bean id="shibboleth.NameIdentifierGenerationService" class="net.shibboleth.ext.spring.service.ReloadableSpringService"
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/transcoding/AbstractSAMLAttributeTranscoder.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/transcoding/AbstractSAMLAttributeTranscoder.java
index ff8ce5c..84fbecb 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/transcoding/AbstractSAMLAttributeTranscoder.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/transcoding/AbstractSAMLAttributeTranscoder.java
@@ -68,7 +68,7 @@ public abstract class AbstractSAMLAttributeTranscoder<AttributeType extends SAML
final String attributeId = attribute.getId();
- log.debug("Beginning to encode attribute {}", attributeId);
+ log.trace("Beginning to encode attribute {}", attributeId);
final List<XMLObject> samlAttributeValues = new ArrayList<>();
@@ -95,7 +95,7 @@ public abstract class AbstractSAMLAttributeTranscoder<AttributeType extends SAML
}
}
- log.debug("Encoded {} values for attribute {}", samlAttributeValues.size(), attributeId);
+ log.trace("Encoded {} values for attribute {}", samlAttributeValues.size(), attributeId);
return buildAttribute(profileRequestContext, attribute, to, rule, samlAttributeValues);
}
@@ -107,7 +107,7 @@ public abstract class AbstractSAMLAttributeTranscoder<AttributeType extends SAML
final String attributeName = getEncodedName(rule);
- log.debug("Beginning to decode attribute {}", attributeName);
+ log.trace("Beginning to decode attribute {}", attributeName);
final List<IdPAttributeValue> idpAttributeValues = new ArrayList<>();
final Iterable<XMLObject> samlAttributeValues = getValues(input);
@@ -128,7 +128,7 @@ public abstract class AbstractSAMLAttributeTranscoder<AttributeType extends SAML
}
if (!idpAttributeValues.isEmpty()) {
- log.debug("Decoded {} values for attribute {}", idpAttributeValues.size(), attributeName);
+ log.trace("Decoded {} values for attribute {}", idpAttributeValues.size(), attributeName);
}
return buildIdPAttribute(profileRequestContext, input, rule, idpAttributeValues);
}
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/metadata/impl/AttributeMappingNodeProcessor.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/metadata/impl/AttributeMappingNodeProcessor.java
index d949eeb..51ffb7f 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/metadata/impl/AttributeMappingNodeProcessor.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/metadata/impl/AttributeMappingNodeProcessor.java
@@ -183,7 +183,7 @@ public class AttributeMappingNodeProcessor implements MetadataNodeProcessor {
Collection<TranscodingRule> rulesets = registry.getTranscodingRules(attr);
if (rulesets.isEmpty() && Attribute.URI_REFERENCE.equals(attr.getNameFormat())) {
- log.debug("Applying default decoding rule for URI-named attribute {}", attr.getName());
+ log.trace("Applying default decoding rule for URI-named attribute {}", attr.getName());
final Map<String,Object> rulemap = new HashMap<>();
rulemap.put(AttributeTranscoderRegistry.PROP_ID, attr.getName());
rulemap.put(AttributeTranscoderRegistry.PROP_TRANSCODER, defaultTranscoder);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list