private void reportUnsupportedNodeType(String name, ParserContext pc, Node node) { pc.getReaderContext().fatal( "Security namespace does not support decoration of " + (node instanceof Element ? "element" : "attribute") + " [" + name + "]", node); }
private void reportMissingWebClasses(String nodeName, ParserContext pc, Node node) { String errorMessage = "The classes from the spring-security-web jar " + "(or one of its dependencies) are not available. You need these to use <" + nodeName + ">"; try { ClassUtils.forName(FILTER_CHAIN_PROXY_CLASSNAME, getClass().getClassLoader()); // no details available pc.getReaderContext().fatal(errorMessage, node); } catch (Throwable cause) { // provide details on why it could not be loaded pc.getReaderContext().fatal(errorMessage, node, cause); } }
/** * Locates the {@link BeanDefinitionParser} from the register implementations using * the local name of the supplied {@link Element}. */ @Nullable private BeanDefinitionParser findParserForElement(Element element, ParserContext parserContext) { String localName = parserContext.getDelegate().getLocalName(element); BeanDefinitionParser parser = this.parsers.get(localName); if (parser == null) { parserContext.getReaderContext().fatal( "Cannot locate BeanDefinitionParser for element [" + localName + "]", element); } return parser; }
/** * 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}. */ @Nullable private BeanDefinitionDecorator findDecoratorForNode(Node node, ParserContext parserContext) { BeanDefinitionDecorator decorator = null; String localName = parserContext.getDelegate().getLocalName(node); if (node instanceof Element) { decorator = this.decorators.get(localName); } else if (node instanceof Attr) { decorator = this.attributeDecorators.get(localName); } else { parserContext.getReaderContext().fatal( "Cannot decorate based on Nodes of type [" + node.getClass().getName() + "]", node); } if (decorator == null) { parserContext.getReaderContext().fatal("Cannot locate BeanDefinitionDecorator for " + (node instanceof Element ? "element" : "attribute") + " [" + localName + "]", node); } return decorator; }
/** * Locates the {@link BeanDefinitionParser} from the register implementations using * the local name of the supplied {@link Element}. */ @Nullable private BeanDefinitionParser findParserForElement(Element element, ParserContext parserContext) { String localName = parserContext.getDelegate().getLocalName(element); BeanDefinitionParser parser = this.parsers.get(localName); if (parser == null) { parserContext.getReaderContext().fatal( "Cannot locate BeanDefinitionParser for element [" + localName + "]", element); } return parser; }
/** * 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}. */ @Nullable private BeanDefinitionDecorator findDecoratorForNode(Node node, ParserContext parserContext) { BeanDefinitionDecorator decorator = null; String localName = parserContext.getDelegate().getLocalName(node); if (node instanceof Element) { decorator = this.decorators.get(localName); } else if (node instanceof Attr) { decorator = this.attributeDecorators.get(localName); } else { parserContext.getReaderContext().fatal( "Cannot decorate based on Nodes of type [" + node.getClass().getName() + "]", node); } if (decorator == null) { parserContext.getReaderContext().fatal("Cannot locate BeanDefinitionDecorator for " + (node instanceof Element ? "element" : "attribute") + " [" + localName + "]", node); } return decorator; }
public BeanDefinition parse(Element element, ParserContext pc) { if (!namespaceMatchesVersion(element)) { pc.getReaderContext() .fatal("You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or spring-security-3.1.xsd schema or spring-security-3.2.xsd schema or spring-security-4.0.xsd schema " + "with Spring Security 4.2. Please update your schema declarations to the 4.2 schema.", element); } String name = pc.getDelegate().getLocalName(element); BeanDefinitionParser parser = parsers.get(name); if (parser == null) { // SEC-1455. Load parsers when required, not just on init(). loadParsers(); } if (parser == null) { if (Elements.HTTP.equals(name) || Elements.FILTER_SECURITY_METADATA_SOURCE.equals(name) || Elements.FILTER_CHAIN_MAP.equals(name) || Elements.FILTER_CHAIN.equals(name)) { reportMissingWebClasses(name, pc, element); } else { reportUnsupportedNodeType(name, pc, element); } return null; } return parser.parse(element, pc); }
private void reportUnsupportedNodeType(String name, ParserContext pc, Node node) { pc.getReaderContext().fatal( "Security namespace does not support decoration of " + (node instanceof Element ? "element" : "attribute") + " [" + name + "]", node); }
private void reportMissingWebClasses(String nodeName, ParserContext pc, Node node) { String errorMessage = "The classes from the spring-security-web jar " + "(or one of its dependencies) are not available. You need these to use <" + nodeName + ">"; try { ClassUtils.forName(FILTER_CHAIN_PROXY_CLASSNAME, getClass().getClassLoader()); // no details available pc.getReaderContext().fatal(errorMessage, node); } catch (Throwable cause) { // provide details on why it could not be loaded pc.getReaderContext().fatal(errorMessage, node, cause); } }
/** * Locates the {@link BeanDefinitionParser} from the register implementations using * the local name of the supplied {@link Element}. */ private BeanDefinitionParser findParserForElement(Element element, ParserContext parserContext) { String localName = parserContext.getDelegate().getLocalName(element); BeanDefinitionParser parser = this.parsers.get(localName); if (parser == null) { parserContext.getReaderContext().fatal( "Cannot locate BeanDefinitionParser for element [" + localName + "]", element); } return parser; }
/** * 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}. */ private BeanDefinitionDecorator findDecoratorForNode(Node node, ParserContext parserContext) { BeanDefinitionDecorator decorator = null; String localName = parserContext.getDelegate().getLocalName(node); if (node instanceof Element) { decorator = this.decorators.get(localName); } else if (node instanceof Attr) { decorator = this.attributeDecorators.get(localName); } else { parserContext.getReaderContext().fatal( "Cannot decorate based on Nodes of type [" + node.getClass().getName() + "]", node); } if (decorator == null) { parserContext.getReaderContext().fatal("Cannot locate BeanDefinitionDecorator for " + (node instanceof Element ? "element" : "attribute") + " [" + localName + "]", node); } return decorator; }
public BeanDefinition parse(Element element, ParserContext pc) { if (!namespaceMatchesVersion(element)) { pc.getReaderContext() .fatal("You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or spring-security-3.1.xsd schema or spring-security-3.2.xsd schema or spring-security-4.0.xsd schema " + "with Spring Security 4.2. Please update your schema declarations to the 4.2 schema.", element); } String name = pc.getDelegate().getLocalName(element); BeanDefinitionParser parser = parsers.get(name); if (parser == null) { // SEC-1455. Load parsers when required, not just on init(). loadParsers(); } if (parser == null) { if (Elements.HTTP.equals(name) || Elements.FILTER_SECURITY_METADATA_SOURCE.equals(name) || Elements.FILTER_CHAIN_MAP.equals(name) || Elements.FILTER_CHAIN.equals(name)) { reportMissingWebClasses(name, pc, element); } else { reportUnsupportedNodeType(name, pc, element); } return null; } return parser.parse(element, pc); }
private void reportUnsupportedNodeType(String name, ParserContext pc, Node node) { pc.getReaderContext().fatal("Security namespace does not support decoration of " + (node instanceof Element ? "element" : "attribute") + " [" + name + "]", node); }
private void reportUnsupportedNodeType(String name, ParserContext pc, Node node) { pc.getReaderContext().fatal( "Security namespace does not support decoration of " + (node instanceof Element ? "element" : "attribute") + " [" + name + "]", node); }
private void reportUnsupportedNodeType(String name, ParserContext parserContext, Node node) { parserContext.getReaderContext().fatal("Social namespace does not support decoration of " + (node instanceof Element ? "element" : "attribute") + " [" + name + "]", node); }
private void reportUnsupportedNodeType(String name, ParserContext parserContext, Node node) { parserContext.getReaderContext().fatal("Twitter namespace does not support " + (node instanceof Element ? "element" : "attribute") + " [" + name + "]", node); }
private void reportMissingWebClasses(String nodeName, ParserContext pc, Node node) { String errorMessage = "The classes from the spring-security-web jar " + "(or one of its dependencies) are not available. You need these to use <" + nodeName + ">"; try { ClassUtils.forName(FILTER_CHAIN_PROXY_CLASSNAME, getClass().getClassLoader()); // no details available pc.getReaderContext().fatal(errorMessage, node); } catch (Throwable cause) { // provide details on why it could not be loaded pc.getReaderContext().fatal(errorMessage, node, cause); } }
/** * Locates the {@link BeanDefinitionParser} from the register implementations using * the local name of the supplied {@link Element}. */ private BeanDefinitionParser findParserForElement(Element element, ParserContext parserContext) { String localName = parserContext.getDelegate().getLocalName(element); BeanDefinitionParser parser = this.parsers.get(localName); if (parser == null) { parserContext.getReaderContext().fatal( "Cannot locate BeanDefinitionParser for element [" + localName + "]", element); } return parser; }
private BeanDefinitionParser findParserForElement(Element element, ParserContext parserContext) { String localName = parserContext.getDelegate().getLocalName(element); if (parserContext.getContainingBeanDefinition() != null) { String beanClassName = parserContext.getContainingBeanDefinition().getBeanClassName(); Map<String, BeanDefinitionParser> parentLocalParsers = localParsers.get(beanClassName); if (parentLocalParsers != null) { BeanDefinitionParser parser = parentLocalParsers.get(localName); if (parser != null) return parser; } } BeanDefinitionParser parser = this.parsers.get(localName); if (parser == null) { parserContext.getReaderContext().fatal("Cannot locate BeanDefinitionParser for element [" + localName + "]", element); } return parser; }
private void registerExtensionParsers(String namespace, Element element, ParserContext parserContext) { try { Extension extension = locateExtensionByNamespace(namespace); registerTopLevelParameters(extension); registerConfigurations(extension); registerOperations(extension); handledExtensions.put(namespace, extension); } catch (Exception e) { parserContext.getReaderContext().fatal(e.getMessage(), element, e); } }