/** {@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} */ protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException { AttributeQuery attributeQuery = (AttributeQuery) samlElement; if (attributeQuery.getResource() != null) { domElement.setAttributeNS(null, AttributeQuery.RESOURCE_ATTRIB_NAME, attributeQuery.getResource()); } } }
/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { AttributeQuery attributeQuery = (AttributeQuery) samlObject; if (attribute.getLocalName().equals(AttributeQuery.RESOURCE_ATTRIB_NAME)) { attributeQuery.setResource(attribute.getValue()); } else { super.processAttribute(samlObject, attribute); } } }
/** * Gets the attribute IDs for those attributes requested in the attribute query. * * @param samlRequest the attribute query * * @return attribute IDs for those attributes requested in the attribute query */ protected Set<String> getAttributeIds(SAMLObject samlRequest) { Set<String> queryAttributeIds = new HashSet<String>(); if (!(samlRequest instanceof AttributeQuery)) { return queryAttributeIds; } AttributeQuery query = (AttributeQuery) samlRequest; if (query != null) { List<AttributeDesignator> queryAttributes = query.getAttributeDesignators(); queryAttributeIds = getAttributeIds(queryAttributes); log.debug("query message contains the following attributes: {}", queryAttributeIds); } return queryAttributeIds; }
/** * Extract the issuer, and populate message context, from the Resource attribute of the Attribute query if * {@link #useQueryResourceAsEntityId} is true. * * @param messageContext current message context * @param query query to extract resource name from */ protected void extractAttributeQueryInfo(SAMLMessageContext messageContext, AttributeQuery query) { if (useQueryResourceAsEntityId) { log.debug("Attempting to extract issuer from SAML 1 AttributeQuery Resource attribute"); String resource = DatatypeHelper.safeTrimOrNullString(query.getResource()); if (resource != null) { messageContext.setInboundMessageIssuer(resource); log.debug("Extracted issuer from SAML 1.x AttributeQuery: {}", resource); } } }
designators = query.getAttributeDesignators(); if (designators != null && designators.isEmpty()) { designators = null;