Example usage for org.springframework.security.config Elements HTTP

List of usage examples for org.springframework.security.config Elements HTTP

Introduction

In this page you can find the example usage for org.springframework.security.config Elements HTTP.

Prototype

String HTTP

To view the source code for org.springframework.security.config Elements HTTP.

Click Source Link

Usage

From source file:org.springframework.security.config.SecurityNamespaceHandler.java

public BeanDefinition parse(Element element, ParserContext pc) {
    if (!namespaceMatchesVersion(element)) {
        pc.getReaderContext().fatal(/*from   w  w w. ja v  a  2 s .c o  m*/
                "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);
}

From source file:org.springframework.security.config.SecurityNamespaceHandler.java

private void loadParsers() {
    // Parsers//w  ww  .  j  a  va  2  s  .c om
    parsers.put(Elements.LDAP_PROVIDER, new LdapProviderBeanDefinitionParser());
    parsers.put(Elements.LDAP_SERVER, new LdapServerBeanDefinitionParser());
    parsers.put(Elements.LDAP_USER_SERVICE, new LdapUserServiceBeanDefinitionParser());
    parsers.put(Elements.USER_SERVICE, new UserServiceBeanDefinitionParser());
    parsers.put(Elements.JDBC_USER_SERVICE, new JdbcUserServiceBeanDefinitionParser());
    parsers.put(Elements.AUTHENTICATION_PROVIDER, new AuthenticationProviderBeanDefinitionParser());
    parsers.put(Elements.GLOBAL_METHOD_SECURITY, new GlobalMethodSecurityBeanDefinitionParser());
    parsers.put(Elements.AUTHENTICATION_MANAGER, new AuthenticationManagerBeanDefinitionParser());
    parsers.put(Elements.METHOD_SECURITY_METADATA_SOURCE,
            new MethodSecurityMetadataSourceBeanDefinitionParser());

    // Only load the web-namespace parsers if the web classes are available
    if (ClassUtils.isPresent(FILTER_CHAIN_PROXY_CLASSNAME, getClass().getClassLoader())) {
        parsers.put(Elements.DEBUG, new DebugBeanDefinitionParser());
        parsers.put(Elements.HTTP, new HttpSecurityBeanDefinitionParser());
        parsers.put(Elements.HTTP_FIREWALL, new HttpFirewallBeanDefinitionParser());
        parsers.put(Elements.FILTER_SECURITY_METADATA_SOURCE,
                new FilterInvocationSecurityMetadataSourceParser());
        parsers.put(Elements.FILTER_CHAIN, new FilterChainBeanDefinitionParser());
        filterChainMapBDD = new FilterChainMapBeanDefinitionDecorator();
    }

    if (ClassUtils.isPresent(MESSAGE_CLASSNAME, getClass().getClassLoader())) {
        parsers.put(Elements.WEBSOCKET_MESSAGE_BROKER,
                new WebSocketMessageBrokerSecurityBeanDefinitionParser());
    }
}