[java-identity-provider COMMIT] in /trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter:...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Jul 1 05:36:08 EDT 2013
Author: rdw
Date: Mon Jul 1 05:36:08 2013
New Revision: 4543
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4543&view=rev
Log:
IDP-287 review comments.
Modified:
trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilter.java
trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterPolicy.java
Modified: trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilter.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilter.java?rev=4543&r1=4542&r2=4543&view=diff
==============================================================================
--- trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilter.java (original)
+++ trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilter.java Mon Jul 1 05:36:08 2013
@@ -137,11 +137,6 @@
try {
final List<AttributeFilterPolicy> policies = getFilterPolicies();
for (AttributeFilterPolicy policy : policies) {
- if (!policy.isApplicable(filterContext)) {
- log.debug("{} filter policy '{}' is not applicable", getLogPrefix(), policy.getId());
- continue;
- }
-
policy.apply(filterContext);
}
@@ -236,7 +231,7 @@
result = new StringBuffer("Attribute filtering engine '").append(getId()).append("' ").toString();
logPrefix = result;
}
- return logPrefix;
+ return result;
}
}
Modified: trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterPolicy.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterPolicy.java?rev=4543&r1=4542&r2=4543&view=diff
==============================================================================
--- trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterPolicy.java (original)
+++ trunk/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/AttributeFilterPolicy.java Mon Jul 1 05:36:08 2013
@@ -69,6 +69,9 @@
/** Filters to be used on attribute values. */
private final List<AttributeRule> valuePolicies;
+ /** Log prefix. */
+ private String logPrefix;
+
/**
* Constructor.
*
@@ -129,20 +132,16 @@
*
* @throws AttributeFilterException thrown if there is a problem evaluating this filter's requirement rule
*/
- public boolean isApplicable(@Nonnull final AttributeFilterContext filterContext)
+ private boolean isApplicable(@Nonnull final AttributeFilterContext filterContext)
throws AttributeFilterException {
- ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
- ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
-
- Constraint.isNotNull(filterContext, "Attribute filter context can not be null");
-
- log.debug("Checking if attribute filter policy '{}' is active", getId());
+
+ log.debug("{} Checking if attribute filter policy is active", getLogPrefix());
final boolean isActive = policyRequirementRule.matches(filterContext);
if (isActive) {
- log.debug("Attribute filter policy '{}' is active for this request", getId());
+ log.debug("{} policy is active for this request", getLogPrefix());
} else {
- log.debug("Attribute filter policy '{}' is not active for this request", getId());
+ log.debug("{} policy is not active for this request", getLogPrefix());
}
return isActive;
@@ -163,9 +162,13 @@
ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
Constraint.isNotNull(filterContext, "Attribute filter context can not be null");
+
+ if (!isApplicable(filterContext)) {
+ return;
+ }
final Map<String, Attribute> attributes = filterContext.getPrefilteredAttributes();
- log.debug("Applying attribute filter policy '{}' to current set of attributes: {}", getId(),
+ log.debug("{} Applying attribute filter policy to current set of attributes: {}", getLogPrefix(),
attributes.keySet());
Attribute attribute;
@@ -175,12 +178,6 @@
if (!attribute.getValues().isEmpty()) {
valuePolicy.apply(attribute, filterContext);
}
-
- if (attribute.getValues().isEmpty()) {
- log.debug("Removing attribute '{}' from attribute collection, it no longer contains any values",
- attribute.getId());
- filterContext.getFilteredAttributes().remove(attribute.getId());
- }
}
}
}
[... 31 lines stripped ...]
More information about the commits
mailing list