/** * Determines whether a given DOM element has any element children. * * @param element Element to check for child elements. * @return true if and only if the Element has child elements. */ private boolean hasChildElements(@Nonnull final Element element) { Node firstChild = ElementSupport.getFirstChildElement(Constraint.isNotNull(element, "Element can not be null")); return firstChild != null; }
/** * Filter an <code>EntityAttributes</code> extension element. * * @param entityAttributes the <code>EntityAttributes</code> extension element * @param registrationAuthority the registration authority associated with the entity */ private void filterEntityAttributes(@Nonnull final Element entityAttributes, @Nullable final String registrationAuthority) { // Locate the Attribute elements to filter final List<Element> attributes = ElementSupport.getChildElements(entityAttributes, SAMLSupport.ATTRIBUTE_NAME); // Filter each Attribute in turn for (final Element attribute : attributes) { filterAttribute(attribute, registrationAuthority); // remove the Attribute container if it is now empty if (ElementSupport.getFirstChildElement(attribute) == null) { log.debug("removing empty Attribute"); entityAttributes.removeChild(attribute); } } }
LOG.warn("<TLSTrustEngine> subelement overrides setting of tlsTrustEngineRef "); final Element trustEngine = ElementSupport.getFirstChildElement(tlsTrustEngine, AbstractMetadataProviderParser.TRUST_ENGINE_ELEMENT_NAME);
builder.addPropertyReference("customObject", customRef); final Element scriptChild = ElementSupport.getFirstChildElement(element); builder.addConstructorArgValue(ElementSupport.getElementContentAsString(scriptChild)); if (ElementSupport.isElementNamed(scriptChild, element.getNamespaceURI(), "Script")) {
insertExtensionsElementBefore = ElementSupport.getNextSiblingElement(lastSignatureElement); } else { insertExtensionsElementBefore = ElementSupport.getFirstChildElement(descriptor);
@Override protected void doExecute(final Collection<Item<Element>> itemCollection) throws StageProcessingException { for (final Item<Element> item : itemCollection) { final Element entity = item.unwrap(); // Establish the item's registrationAuthority, if any final String registrationAuthority = extractRegistrationAuthority(item); /* * Process each EntityAttributes container independently. There MUST be only one * such container according to the specification, but we can't count on that being * picked up elsewhere as it isn't a schema constraint. */ for (final Element entityAttributes : SAMLMetadataSupport.getDescriptorExtensionList(entity, MDAttrSupport.ENTITY_ATTRIBUTES_NAME)) { filterEntityAttributes(entityAttributes, registrationAuthority); // remove the EntityAttributes container if it is now empty if (ElementSupport.getFirstChildElement(entityAttributes) == null) { log.debug("removing empty EntityAttributes"); final Node extensions = entityAttributes.getParentNode(); extensions.removeChild(entityAttributes); } } } }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); DeprecationSupport.warnOnce(ObjectType.XSITYPE, DOMTypeSupport.getXSIType(config).toString(), parserContext.getReaderContext().getResource().getDescription(), "via NameID Generation Service configuration"); if (config.hasAttributeNS(null, "activationConditionRef")) { builder.addPropertyReference("activationCondition", StringSupport.trimOrNull(config.getAttributeNS(null, "activationConditionRef"))); } else { final Element child = ElementSupport.getFirstChildElement(config); if (child != null && ElementSupport.isElementNamed(child, AttributeResolverNamespaceHandler.NAMESPACE, "ActivationConditionScript")) { builder.addPropertyValue("activationCondition", ScriptTypeBeanParser.parseScriptType(ScriptedPredicate.class, child).getBeanDefinition()); } } if (config.hasAttributeNS(null, FORMAT_ATTRIBUTE_NAME)) { final String namespace = StringSupport.trimOrNull(config.getAttributeNS(null, FORMAT_ATTRIBUTE_NAME)); builder.addPropertyValue("nameFormat", namespace); } builder.setInitMethodName(null); builder.addPropertyValue("nameQualifier", StringSupport.trimOrNull(config.getAttributeNS(null, NAMEQUALIFIER_ATTRIBUTE_NAME))); }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); DeprecationSupport.warnOnce(ObjectType.XSITYPE, DOMTypeSupport.getXSIType(config).toString(), parserContext.getReaderContext().getResource().getDescription(), "via NameID Generation Service configuration"); if (config.hasAttributeNS(null, "activationConditionRef")) { builder.addPropertyReference("activationCondition", StringSupport.trimOrNull(config.getAttributeNS(null, "activationConditionRef"))); } else { final Element child = ElementSupport.getFirstChildElement(config); if (child != null && ElementSupport.isElementNamed(child, AttributeResolverNamespaceHandler.NAMESPACE, "ActivationConditionScript")) { builder.addPropertyValue("activationCondition", ScriptTypeBeanParser.parseScriptType(ScriptedPredicate.class, child).getBeanDefinition()); } } if (config.hasAttributeNS(null, FORMAT_ATTRIBUTE_NAME)) { final String format = StringSupport.trimOrNull(config.getAttributeNS(null, FORMAT_ATTRIBUTE_NAME)); builder.addPropertyValue("nameFormat", format); } builder.setInitMethodName(null); builder.addPropertyValue("nameQualifier", StringSupport.trimOrNull(config.getAttributeNS(null, NAMEQUALIFIER_ATTRIBUTE_NAME))); }
final Element template = ElementSupport.getFirstChildElement(element, TEMPLATE); if (template != null) { final String templateString = StringSupport.trimOrNull(ElementSupport.getElementContentAsString(template)); final Element regex = ElementSupport.getFirstChildElement(element, REGEX); if (regex != null) { final String replacement = StringSupport.trimOrNull(ElementSupport.getElementContentAsString(regex)); final Element mdq = ElementSupport.getFirstChildElement(element, METADATA_QUERY_PROTOCOL); if (mdq != null) { final String baseURL = ElementSupport.getElementContentAsString(mdq);
builder.addPropertyValue("activationCondition", rpBuilder.getBeanDefinition()); } else { final Element child = ElementSupport.getFirstChildElement(config); if (child != null && ElementSupport.isElementNamed(child, AttributeResolverNamespaceHandler.NAMESPACE, "ActivationConditionScript")) {
Element child = ElementSupport.getFirstChildElement(element); while (child != null) { if (ElementSupport.isElementNamed(child, AbstractMetadataProviderParser.METADATA_NAMESPACE, "Format")) {
Element child = ElementSupport.getFirstChildElement(element);
final Element tlsTrustEngine = ElementSupport.getFirstChildElement(element, HTTPMetadataProvidersParserSupport.TLS_TRUST_ENGINE_ELEMENT_NAME); final String httpClientSecurityParametersRef =
final Element tlsTrustEngine = ElementSupport.getFirstChildElement(element, HTTPMetadataProvidersParserSupport.TLS_TRUST_ENGINE_ELEMENT_NAME); final String httpClientSecurityParametersRef =