/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { AttributeQuery attributeQuery = (AttributeQuery) parentSAMLObject; if (childSAMLObject instanceof AttributeDesignator) { attributeQuery.getAttributeDesignators().add((AttributeDesignator) childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } }
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) { final Collection<IdPAttribute> keepers = new ArrayList<>(query.getAttributeDesignators().size()); final Multimap<String,IdPAttribute> mapped = mapperService.mapAttributes(query.getAttributeDesignators()); log.debug("Query content mapped to attribute IDs: {}", mapped.keySet()); for (final IdPAttribute attribute : attributeContext.getIdPAttributes().values()) { if (mapped.containsKey(attribute.getId())) { log.debug("Retaining attribute '{}' requested by query", attribute.getId()); keepers.add(attribute); } else { log.debug("Removing attribute '{}' not requested by query", attribute.getId()); } } attributeContext.setIdPAttributes(keepers); }
/** {@inheritDoc} */ @Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) { if (!super.doPreExecute(profileRequestContext)) { return false; } final Request request = requestLookupStrategy.apply(profileRequestContext); if (request != null) { query = request.getAttributeQuery(); } if (query == null || query.getAttributeDesignators().isEmpty()) { log.debug("No AttributeDesignators found, nothing to do "); return false; } attributeContext = attributeContextLookupStrategy.apply(profileRequestContext); if (attributeContext == null) { log.debug("{} No attribute context, no attributes to filter", getLogPrefix()); return false; } if (attributeContext.getIdPAttributes().isEmpty()) { log.debug("{} No attributes to filter", getLogPrefix()); return false; } return true; }