[java-identity-provider COMMIT] in /trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl: FilterAttri...
noreply at shibboleth.net
noreply at shibboleth.net
Sat Sep 17 00:03:33 BST 2011
Author: lajoie
Date: Sat Sep 17 00:03:33 2011
New Revision: 4069
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4069&view=rev
Log:
Place attributes in AttributeSubcontext on relying party context
Modified:
trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java
trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java?rev=4069&r1=4068&r2=4069&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java Sat Sep 17 00:03:33 2011
@@ -24,15 +24,21 @@
import net.shibboleth.idp.attribute.filtering.AttributeFilterContext;
import net.shibboleth.idp.attribute.filtering.AttributeFilteringEngine;
import net.shibboleth.idp.attribute.filtering.AttributeFilteringException;
-import net.shibboleth.idp.profile.AbstractIdentityProviderAction;
+import net.shibboleth.idp.profile.AbstractProfileRequestSubcontextAction;
import net.shibboleth.idp.profile.ActionSupport;
import net.shibboleth.idp.profile.ProfileRequestContext;
+import net.shibboleth.idp.relyingparty.RelyingPartySubcontext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;
/** A stage which invokes the {@link AttributeFilteringEngine} for the current request. */
-public class FilterAttributes extends AbstractIdentityProviderAction {
+public class FilterAttributes extends AbstractProfileRequestSubcontextAction<RelyingPartySubcontext> {
+
+ /** Class logger. */
+ private final Logger log = LoggerFactory.getLogger(FilterAttributes.class);
/** Resolver used to fetch attributes. */
private AttributeFilteringEngine filterEngine;
@@ -43,10 +49,17 @@
}
/** {@inheritDoc} */
- public Event doExecute(final HttpServletRequest httpRequest, final HttpServletResponse httpResponse,
- final RequestContext springRequestContext, final ProfileRequestContext profileRequestContext) {
-
- final AttributeSubcontext attributeCtx = profileRequestContext.getSubcontext(AttributeSubcontext.class, false);
+ protected Class<RelyingPartySubcontext> getSubcontextType() {
+ return RelyingPartySubcontext.class;
+ }
+
+ /** {@inheritDoc} */
+ protected Event doExecute(HttpServletRequest httpRequest, HttpServletResponse httpResponse,
+ RequestContext springRequestContext, ProfileRequestContext profileRequestContext,
+ RelyingPartySubcontext relyingPartyContext) {
+
+ final AttributeSubcontext attributeContext =
+ relyingPartyContext.getSubcontext(AttributeSubcontext.class, false);
// Get the filer context from the profile request
// this may already exist but if not, auto-create it
@@ -55,23 +68,23 @@
// If the filter context doesn't have a set of attributes to filter already
// then look for them in the profile request context
+ if (filterContext.getPrefilteredAttributes().isEmpty() && attributeContext != null) {
+ filterContext.setPrefilteredAttributes(attributeContext.getAttributes().values());
+ }
+
if (filterContext.getPrefilteredAttributes().isEmpty()) {
- if (attributeCtx == null) {
- // TODO error
- return ActionSupport.buildEvent(this, ActionSupport.ERROR_EVENT_ID, null);
- }
-
- filterContext.setPrefilteredAttributes(attributeCtx.getAttributes().values());
+ log.debug("Action {}: No attributes available to filter, nothing to do", getId());
+ return ActionSupport.buildProceedEvent(this);
}
try {
filterEngine.filterAttributes(filterContext);
- // TODO remove filter context from profile request context?
+ profileRequestContext.removeSubcontext(filterContext);
- attributeCtx.setAttributes(filterContext.getFilteredAttributes().values());
+ attributeContext.setAttributes(filterContext.getFilteredAttributes().values());
} catch (AttributeFilteringException e) {
- // TODO error
- return ActionSupport.buildEvent(this, ActionSupport.ERROR_EVENT_ID, null);
+ log.error("Action {}: Error encountered while filtering attributes", getId(), e);
+ return ActionSupport.buildErrorEvent(this, e);
}
return ActionSupport.buildProceedEvent(this);
Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
[... 65 lines stripped ...]
More information about the commits
mailing list