[java-shib-common COMMIT] in /branches/REL_1: doc/RELEASE-NOTES.txt src/main/java/edu/internet2/middleware/shibboleth...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Nov 7 15:19:32 EST 2012
Author: scantor
Date: Wed Nov 7 15:19:31 2012
New Revision: 1039
URL: http://svn.shibboleth.net/view/java-shib-common?rev=1039&view=rev
Log:
SIDP-559 - Designators in queries and limit encoded attributes based on them
Modified:
branches/REL_1/doc/RELEASE-NOTES.txt
branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/ShibbolethSAML1AttributeAuthority.java
branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/ShibbolethSAML2AttributeAuthority.java
Modified: branches/REL_1/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-shib-common/branches/REL_1/doc/RELEASE-NOTES.txt?rev=1039&r1=1038&r2=1039&view=diff
==============================================================================
--- branches/REL_1/doc/RELEASE-NOTES.txt (original)
+++ branches/REL_1/doc/RELEASE-NOTES.txt Wed Nov 7 15:19:31 2012
@@ -1,5 +1,6 @@
Changes in Release 1.4.0
=============================================
+[SIDP-559] - Attribute queries are ignoring input designators
[SC-183] - Inappropriate 'RuleReference elements within an AND rule are not supported' error
Changes in Release 1.3.6
Modified: branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/ShibbolethSAML1AttributeAuthority.java
URL: http://svn.shibboleth.net/view/java-shib-common/branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/ShibbolethSAML1AttributeAuthority.java?rev=1039&r1=1038&r2=1039&view=diff
==============================================================================
--- branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/ShibbolethSAML1AttributeAuthority.java (original)
+++ branches/REL_1/src/main/java/edu/internet2/middleware/shibboleth/common/attribute/provider/ShibbolethSAML1AttributeAuthority.java Wed Nov 7 15:19:31 2012
@@ -35,6 +35,7 @@
import org.opensaml.saml1.core.ResponseAbstractType;
import org.opensaml.saml2.metadata.EntityDescriptor;
import org.opensaml.xml.XMLObjectBuilderFactory;
+import org.opensaml.xml.util.DatatypeHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
@@ -114,7 +115,7 @@
public AttributeStatement buildAttributeStatement(AttributeQuery query, Collection<BaseAttribute> attributes)
throws AttributeEncodingException {
- Collection<Attribute> encodedAttributes = encodeAttributes(attributes);
+ Collection<Attribute> encodedAttributes = encodeAttributes(query, attributes);
if (encodedAttributes != null && !encodedAttributes.isEmpty()) {
AttributeStatement statement = statementBuilder.buildObject();
statement.getAttributes().addAll(encodedAttributes);
@@ -227,46 +228,75 @@
/**
* This encodes the supplied attributes with that attribute's SAML1 encoder.
*
- * @param attributes shibboleth attributes to be encoded into SAML attributes
+ * @param query request that may containing filtering designators
+ * @param attributes internal attributes to be encoded into SAML attributes
*
* @return collection of encoded SAML attributes
*/
@SuppressWarnings("unchecked")
- protected Collection<Attribute> encodeAttributes(Collection<BaseAttribute> attributes) {
+ protected Collection<Attribute> encodeAttributes(AttributeQuery query, Collection<BaseAttribute> attributes) {
Collection<Attribute> encodedAttributes = new ArrayList<Attribute>();
- boolean attributeEncoded = false;
-
+ List<AttributeDesignator> designators = null;
+ if (query != null) {
+ designators = query.getAttributeDesignators();
+ if (designators != null && designators.isEmpty()) {
+ designators = null;
+ }
+ }
+
for (BaseAttribute<?> shibbolethAttribute : attributes) {
if (shibbolethAttribute.getValues() == null || shibbolethAttribute.getValues().size() == 0) {
continue;
}
-
- // first try to encode with an SAML 1 attribute encoders
+
+ boolean attributeEncoded = false;
+
+ // first try to encode with a SAML 1 attribute encoder
Attribute attribute;
for (AttributeEncoder encoder : shibbolethAttribute.getEncoders()) {
if (encoder instanceof SAML1AttributeEncoder) {
- try {
- attribute = (Attribute) encoder.encode(shibbolethAttribute);
- if (attribute != null) {
- encodedAttributes.add(attribute);
- attributeEncoded = true;
- if (log.isDebugEnabled()) {
- log.debug("Encoded attribute {} with encoder of type {}", shibbolethAttribute.getId(),
- encoder.getClass().getName());
+
[... 185 lines stripped ...]
More information about the commits
mailing list