/** {@inheritDoc} */
  @Override
  protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {

    // Get the filter context from the profile request
    // this may already exist but if not, auto-create it.
    final AttributeFilterContext filterContext =
        filterContextCreationStrategy.apply(profileRequestContext);
    if (filterContext == null) {
      log.error("{} Unable to locate or create AttributeFilterContext", getLogPrefix());
      if (maskFailures) {
        log.warn("Filter error masked, clearing resolved attributes");
        attributeContext.setIdPAttributes(null);
      } else {
        ActionSupport.buildEvent(profileRequestContext, IdPEventIds.UNABLE_FILTER_ATTRIBS);
      }
      return;
    }

    populateFilterContext(profileRequestContext, filterContext);

    ServiceableComponent<AttributeFilter> component = null;

    try {
      component = attributeFilterService.getServiceableComponent();
      if (null == component) {
        log.error(
            "{} Error encountered while filtering attributes : Invalid Attribute Filter configuration",
            getLogPrefix());
        if (maskFailures) {
          log.warn("Filter error masked, clearing resolved attributes");
          attributeContext.setIdPAttributes(null);
        } else {
          ActionSupport.buildEvent(profileRequestContext, IdPEventIds.UNABLE_FILTER_ATTRIBS);
        }
      } else {
        final AttributeFilter filter = component.getComponent();
        filter.filterAttributes(filterContext);
        filterContext.getParent().removeSubcontext(filterContext);
        attributeContext.setIdPAttributes(filterContext.getFilteredIdPAttributes().values());
      }
    } catch (final AttributeFilterException e) {
      log.error("{} Error encountered while filtering attributes", getLogPrefix(), e);
      if (maskFailures) {
        log.warn("Filter error masked, clearing resolved attributes");
        attributeContext.setIdPAttributes(null);
      } else {
        ActionSupport.buildEvent(profileRequestContext, IdPEventIds.UNABLE_FILTER_ATTRIBS);
      }
    } finally {
      if (null != component) {
        component.unpinComponent();
      }
    }
  }
 /** {@inheritDoc} */
 @Override
 protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
   final LogoutPropagationContext logoutPropCtx =
       contextCreationStrategy.apply(profileRequestContext);
   if (logoutPropCtx == null) {
     log.error("{} Unable to create or locate SingleLogoutContext", getLogPrefix());
     ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
     return;
   }
   logoutPropCtx.setSession(session);
   logoutPropCtx.setSessionKey(sessionKey);
 }
  /** {@inheritDoc} */
  @Override
  protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {

    if (!super.doPreExecute(profileRequestContext)) {
      return false;
    }

    final RequestContext requestContext = getRequestContext(profileRequestContext);
    if (requestContext == null) {
      log.error("{} Spring RequestContext is not set", getLogPrefix());
      ActionSupport.buildEvent(profileRequestContext, EventIds.UNABLE_TO_DECODE);
      return false;
    }

    final String sessionRef = requestContext.getRequestParameters().get(SESSION_PARAM_BYREF);
    final String sessionVal = requestContext.getRequestParameters().get(SESSION_PARAM_BYVAL);
    try {
      if (sessionRef != null) {
        sessionKey = sessionRef;
        session = getSessionByReference(requestContext, sessionKey);
      } else if (sessionVal != null) {
        session = getSessionByValue(sessionVal);
      } else {
        log.warn("{} No session parameter provided, nothing to do", getLogPrefix());
        ActionSupport.buildEvent(profileRequestContext, EventIds.UNABLE_TO_DECODE);
        return false;
      }
      log.debug("{} Got session to propagate logout: {}", getLogPrefix(), session);
    } catch (MessageDecodingException e) {
      log.warn("{} Message decoding exception: {}", e.getMessage());
      ActionSupport.buildEvent(profileRequestContext, EventIds.UNABLE_TO_DECODE);
      return false;
    } catch (MessageException e) {
      log.warn("{} Required state not found: {}", e.getMessage());
      ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
      return false;
    }

    return true;
  }