[java-identity-provider COMMIT] in /trunk: idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/context/Attri...
noreply at shibboleth.net
noreply at shibboleth.net
Sat May 23 12:37:30 EDT 2015
Author: rdw
Date: Sat May 23 12:37:29 2015
New Revision: 7531
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7531&view=rev
Log:
IDP-729 Make the unfiltered attributes available in the attribute context and teach the non-legacy NameId generators to look at them if told to.
Modified:
trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/context/AttributeContext.java
trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/PersistentSAML2NameIDGenerator.java
Modified: trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/context/AttributeContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/context/AttributeContext.java?rev=7531&r1=7530&r2=7531&view=diff
==============================================================================
--- trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/context/AttributeContext.java (original)
+++ trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/context/AttributeContext.java Sat May 23 12:37:29 2015
@@ -32,6 +32,8 @@
import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
import org.opensaml.messaging.context.BaseContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableMap;
@@ -43,15 +45,22 @@
public class AttributeContext extends BaseContext {
/** The attributes tracked by this context. */
- private Map<String, IdPAttribute> attributes;
-
+ @Nonnull private Map<String, IdPAttribute> attributes;
+
+ /** The attributes tracked by this context prior to filtering. */
+ @Nullable private Map<String, IdPAttribute> unfilteredAttributes;
+
+ /** Log. */
+ private final Logger log;
+
/** Constructor. */
public AttributeContext() {
attributes = Collections.emptyMap();
+ log = LoggerFactory.getLogger(AttributeContext.class);
}
/**
- * Gets the collection of attributes, indexed by attribute ID, tracked by this context.
+ * Gets the map of attributes, indexed by attribute ID, tracked by this context.
*
* @return the collection of attributes indexed by attribute ID
*/
@@ -80,4 +89,41 @@
attributes = ImmutableMap.copyOf(checkedAttributes);
}
+
+ /**
+ * Gets the map of unfiltered attributes, indexed by attribute ID, tracked by this context.
+ *
+ * @return the collection of attributes indexed by attribute ID
+ */
+ @Nonnull @NonnullElements @Unmodifiable public Map<String, IdPAttribute> getUnfilteredIdPAttributes() {
+ if (null == unfilteredAttributes) {
+ log.error("No Attributes have been set in this flow.");
+ return Collections.emptyMap();
+ }
+ return unfilteredAttributes;
+ }
+
+ /**
+ * Sets the unfiltered attributes tracked by this context.
+ *
+ * @param newAttributes the attributes
+ */
+ public void setUnfilteredIdPAttributes(@Nullable @NullableElements Collection<IdPAttribute> newAttributes) {
+ if (null != unfilteredAttributes) {
+ log.error("Unfiltered attributes have already been set in this flow.");
+ }
+ if (newAttributes == null) {
+ unfilteredAttributes = Collections.emptyMap();
+ return;
+ }
+
+ final HashMap<String,IdPAttribute> checkedAttributes = new HashMap<>();
+ for (final IdPAttribute attribute : newAttributes) {
+ if (attribute != null) {
+ checkedAttributes.put(attribute.getId(), attribute);
+ }
+ }
+
+ unfilteredAttributes = ImmutableMap.copyOf(checkedAttributes);
+ }
}
Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java?rev=7531&r1=7530&r2=7531&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java Sat May 23 12:37:29 2015
@@ -251,6 +251,7 @@
throw new ResolutionException("Unable to create or locate AttributeContext to populate");
}
attributeCtx.setIdPAttributes(resolutionContext.getResolvedIdPAttributes().values());
+ attributeCtx.setUnfilteredIdPAttributes(resolutionContext.getResolvedIdPAttributes().values());
}
[... 489 lines stripped ...]
More information about the commits
mailing list