/** {@inheritDoc} */ @Nonnull public XMLObjectType buildObject(@Nonnull final Element element) { XMLObjectType xmlObject; String localName = element.getLocalName(); String nsURI = element.getNamespaceURI(); String nsPrefix = element.getPrefix(); QName schemaType = DOMTypeSupport.getXSIType(element); xmlObject = buildObject(nsURI, localName, nsPrefix, schemaType); return xmlObject; } }
/** {@inheritDoc} */ @Override protected void doParse(final Element element, final BeanDefinitionBuilder builder) { if (TYPE_NAME_FILESYSTEM.equals(DOMTypeSupport.getXSIType(element))) { log.warn("Credential type '{}' has been deprecated; use the compatible Credential type '{}'", TYPE_NAME_FILESYSTEM.getLocalPart(), TYPE_NAME_RESOURCE.getLocalPart()); } super.doParse(element, builder); } }
/** {@inheritDoc} */ @Override protected void doParse(final Element element, final BeanDefinitionBuilder builder) { if (TYPE_NAME_FILESYSTEM.equals(DOMTypeSupport.getXSIType(element))) { log.warn("Credential type '{}' has been deprecated; use the compatible Credential type '{}'", TYPE_NAME_FILESYSTEM.getLocalPart(), TYPE_NAME_RESOURCE.getLocalPart()); } super.doParse(element, builder); }
/** {@inheritDoc} */ @Nonnull public XMLObjectType buildObject(@Nonnull final Element element) { XMLObjectType xmlObject; String localName = element.getLocalName(); String nsURI = element.getNamespaceURI(); String nsPrefix = element.getPrefix(); QName schemaType = DOMTypeSupport.getXSIType(element); xmlObject = buildObject(nsURI, localName, nsPrefix, schemaType); return xmlObject; } }
/** {@inheritDoc} */ @Override protected void doParse(final Element element, final BeanDefinitionBuilder builder) { if (TYPE_NAME_FILESYSTEM.equals(DOMTypeSupport.getXSIType(element))) { log.warn("Credential type '{}' has been deprecated; use the compatible Credential type '{}'", TYPE_NAME_FILESYSTEM.getLocalPart(), TYPE_NAME_RESOURCE.getLocalPart()); } super.doParse(element, builder); } }
/** * Handle attributes which are inappropriate for specific implementations. The chaining metadata provider cannot * have "requireValidMetadata" or "failFastInitialization" set, even though they are present in the schema. <br/> * This method detects whether these elements are present and if the element is not a chaining provider returns * true, otherwise it returns false and emits a warning. * * @param element the element * @param attribute the attribute * @return true iff this is not a chaining resolver and the attribute is present */ private boolean isPresentNotChaining(@Nonnull final Element element, @Nonnull final String attribute) { if (!element.hasAttributeNS(null, attribute)) { return false; } if (CHAINING_PROVIDER_ELEMENT_NAME.equals(DOMTypeSupport.getXSIType(element))) { log.warn("{} is not valid for {}", attribute, CHAINING_PROVIDER_ELEMENT_NAME.getLocalPart()); return false; } return true; }
/** * Locates the {@link BeanDefinitionParser} from the register implementations using the local name of the supplied * {@link Node}. Supports both {@link Element Elements} and {@link Attr Attrs}. * * @param node the node to locate the decorator for * * @return the decorator for the given node */ protected BeanDefinitionDecorator findDecoratorForNode(final Node node) { BeanDefinitionDecorator decorator = null; if (node instanceof Element) { decorator = decorators.get(DOMTypeSupport.getXSIType((Element) node)); if (decorator == null) { decorator = decorators.get(QNameSupport.getNodeQName(node)); } } else if (node instanceof Attr) { decorator = attributeDecorators.get(node.getLocalName()); } else { throw new IllegalArgumentException("Can not decorate based on Nodes of type [" + node.getClass().getName() + "]"); } if (decorator == null) { throw new IllegalArgumentException("Can not locate BeanDefinitionDecorator for " + " [" + node.getLocalName() + "]"); } return decorator; }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); final QName suppliedQname = DOMTypeSupport.getXSIType(config); if (!AttributeResolverNamespaceHandler.NAMESPACE.equals(suppliedQname.getNamespaceURI())) { DeprecationSupport.warnOnce(ObjectType.XSITYPE, suppliedQname.toString(), parserContext.getReaderContext().getResource().getDescription(), getPreferredName().toString()); } }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); final QName suppliedQname = DOMTypeSupport.getXSIType(config); if (!AttributeResolverNamespaceHandler.NAMESPACE.equals(suppliedQname.getNamespaceURI())) { DeprecationSupport.warnOnce(ObjectType.XSITYPE, suppliedQname.toString(), parserContext.getReaderContext().getResource().getDescription(), getPreferredName().toString()); } }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element element, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { final QName suppliedQname = DOMTypeSupport.getXSIType(element); if (AttributeFilterSAMLNamespaceHandler.NAMESPACE.equals(suppliedQname.getNamespaceURI()) || AttributeFilterBasicNamespaceHandler.NAMESPACE.equals(suppliedQname.getNamespaceURI())) { DeprecationSupport.warnOnce(ObjectType.XSITYPE, suppliedQname.toString(), parserContext.getReaderContext().getResource().getDescription(), getAFPName().toString()); } super.doParse(element, parserContext, builder); }
/** {@inheritDoc} */ @Override protected void doParse(final Element element, final ParserContext parserContext, final BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); log.warn("Configuration {} contained unsupported Trust Engine type {}. This has been ignored.", parserContext .getReaderContext().getResource().getDescription(), DOMTypeSupport.getXSIType(element).toString()); }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); final QName suppliedQname = DOMTypeSupport.getXSIType(config); if (!AttributeResolverNamespaceHandler.NAMESPACE.equals(suppliedQname.getNamespaceURI())) { DeprecationSupport.warnOnce(ObjectType.XSITYPE, suppliedQname.toString(), parserContext.getReaderContext().getResource().getDescription(), getPreferredName().toString()); } }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); final QName suppliedQname = DOMTypeSupport.getXSIType(config); if (!AttributeResolverNamespaceHandler.NAMESPACE.equals(suppliedQname.getNamespaceURI())) { DeprecationSupport.warnOnce(ObjectType.XSITYPE, suppliedQname.toString(), parserContext.getReaderContext().getResource().getDescription(), getPreferredName().toString()); } }
/** * Retrieves the unmarshaller for the given element. The schema type, if present, is tried first as the key with the * element QName used if no schema type is present or does not have a unmarshaller registered under it. * * @param domElement the element to retrieve the unmarshaller for * * @return the unmarshaller for the XMLObject the given element can be unmarshalled into */ @Nullable public Unmarshaller getUnmarshaller(@Nullable final Element domElement) { Unmarshaller unmarshaller; unmarshaller = getUnmarshaller(DOMTypeSupport.getXSIType(domElement)); if (unmarshaller == null) { unmarshaller = getUnmarshaller(QNameSupport.getNodeQName(domElement)); } return unmarshaller; }
/** * Retrieves the XMLObject builder for the given element. The schema type, if present, is tried first as the key * with the element QName used if no schema type is present or does not have a builder registered under it. * * @param domElement the element to retrieve the builder for * * @return the builder for the XMLObject the given element can be unmarshalled into, or null */ @Nullable public XMLObjectBuilder<?> getBuilder(@Nullable final Element domElement) { XMLObjectBuilder<?> builder = getBuilder(DOMTypeSupport.getXSIType(domElement)); if (builder == null) { builder = getBuilder(QNameSupport.getNodeQName(domElement)); } return builder; }
/** * Retrieves the XMLObject builder for the given element. The schema type, if present, is tried first as the key * with the element QName used if no schema type is present or does not have a builder registered under it. * * @param domElement the element to retrieve the builder for * * @return the builder for the XMLObject the given element can be unmarshalled into, or null */ @Nullable public XMLObjectBuilder<?> getBuilder(@Nullable final Element domElement) { XMLObjectBuilder<?> builder = getBuilder(DOMTypeSupport.getXSIType(domElement)); if (builder == null) { builder = getBuilder(QNameSupport.getNodeQName(domElement)); } return builder; }
/** * Retrieves the unmarshaller for the given element. The schema type, if present, is tried first as the key with the * element QName used if no schema type is present or does not have a unmarshaller registered under it. * * @param domElement the element to retrieve the unmarshaller for * * @return the unmarshaller for the XMLObject the given element can be unmarshalled into */ @Nullable public Unmarshaller getUnmarshaller(@Nullable final Element domElement) { Unmarshaller unmarshaller; unmarshaller = getUnmarshaller(DOMTypeSupport.getXSIType(domElement)); if (unmarshaller == null) { unmarshaller = getUnmarshaller(QNameSupport.getNodeQName(domElement)); } return unmarshaller; }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); final BeanDefinitionBuilder strategyBuilder = BeanDefinitionBuilder.genericBeanDefinition(CryptoTransientIdGenerationStrategy.class); strategyBuilder.setInitMethodName("initialize"); strategyBuilder.addPropertyValue("id", "CryptoTransientIdGenerationStrategy:" + getDefinitionId()); if (config.hasAttributeNS(null, "lifetime")) { strategyBuilder.addPropertyValue("idLifetime", StringSupport.trimOrNull(config.getAttributeNS(null, "lifetime"))); } strategyBuilder.addPropertyReference("dataSealer", StringSupport.trimOrNull(config.getAttributeNS(null, "dataSealerRef"))); builder.addPropertyValue("transientIdGenerationStrategy", strategyBuilder.getBeanDefinition()); DeprecationSupport.warnOnce(ObjectType.XSITYPE, DOMTypeSupport.getXSIType(config).toString(), parserContext.getReaderContext().getResource().getDescription(), "via NameID Generation Service configuration"); }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); final BeanDefinitionBuilder strategyBuilder = BeanDefinitionBuilder.genericBeanDefinition(StoredTransientIdGenerationStrategy.class); strategyBuilder.setInitMethodName("initialize"); strategyBuilder.addPropertyValue("id", "StoredTransientIdGenerationStrategy:" + getDefinitionId()); if (config.hasAttributeNS(null, "lifetime")) { strategyBuilder.addPropertyValue("idLifetime", StringSupport.trimOrNull(config.getAttributeNS(null, "lifetime"))); } String idStore = "shibboleth.StorageService"; if (config.hasAttributeNS(null, "storageServiceRef")) { idStore = StringSupport.trimOrNull(config.getAttributeNS(null, "storageServiceRef")); } log.debug("{} idStore '{}'", getLogPrefix(), idStore); strategyBuilder.addPropertyReference("idStore", idStore); builder.addPropertyValue("transientIdGenerationStrategy", strategyBuilder.getBeanDefinition()); DeprecationSupport.warnOnce(ObjectType.XSITYPE, DOMTypeSupport.getXSIType(config).toString(), parserContext.getReaderContext().getResource().getDescription(), "via NameID Generation Service configuration"); }
/** {@inheritDoc} */ @Override public BeanDefinition parseCustomElement(final Element element, final BeanDefinition containingBd) { String namespaceUri = element.getNamespaceURI(); if (DOMTypeSupport.hasXSIType(element)) { namespaceUri = DOMTypeSupport.getXSIType(element).getNamespaceURI(); } final NamespaceHandler handler = getReaderContext().getNamespaceHandlerResolver().resolve(namespaceUri); if (handler == null) { error("Unable to locate NamespaceHandler for namespace [" + namespaceUri + "]", element); return null; } return handler.parse(element, new ParserContext(getReaderContext(), this, containingBd)); } }