Example usage for org.springframework.security.config.http HttpSecurityBeanDefinitionParser ATT_REQUIRES_CHANNEL

List of usage examples for org.springframework.security.config.http HttpSecurityBeanDefinitionParser ATT_REQUIRES_CHANNEL

Introduction

In this page you can find the example usage for org.springframework.security.config.http HttpSecurityBeanDefinitionParser ATT_REQUIRES_CHANNEL.

Prototype

String ATT_REQUIRES_CHANNEL

To view the source code for org.springframework.security.config.http HttpSecurityBeanDefinitionParser ATT_REQUIRES_CHANNEL.

Click Source Link

Usage

From source file:org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser.java

public BeanDefinition parse(Element element, ParserContext parserContext) {
    List<Element> interceptUrls = DomUtils.getChildElementsByTagName(element, Elements.INTERCEPT_URL);

    // Check for attributes that aren't allowed in this context
    for (Element elt : interceptUrls) {
        if (StringUtils.hasLength(elt.getAttribute(HttpSecurityBeanDefinitionParser.ATT_REQUIRES_CHANNEL))) {
            parserContext.getReaderContext().error("The attribute '"
                    + HttpSecurityBeanDefinitionParser.ATT_REQUIRES_CHANNEL + "' isn't allowed here.", elt);
        }/*from   ww w  .j a  v a  2s  .c  om*/

        if (StringUtils.hasLength(elt.getAttribute(HttpSecurityBeanDefinitionParser.ATT_FILTERS))) {
            parserContext.getReaderContext().error(
                    "The attribute '" + HttpSecurityBeanDefinitionParser.ATT_FILTERS + "' isn't allowed here.",
                    elt);
        }

        if (StringUtils.hasLength(elt.getAttribute(ATT_SERVLET_PATH))) {
            parserContext.getReaderContext()
                    .error("The attribute '" + ATT_SERVLET_PATH + "' isn't allowed here.", elt);
        }
    }

    BeanDefinition mds = createSecurityMetadataSource(interceptUrls, false, element, parserContext);

    String id = element.getAttribute(AbstractBeanDefinitionParser.ID_ATTRIBUTE);

    if (StringUtils.hasText(id)) {
        parserContext.registerComponent(new BeanComponentDefinition(mds, id));
        parserContext.getRegistry().registerBeanDefinition(id, mds);
    }

    return mds;
}