spring-security-web XML配置

时间:2015-11-03 14:58:37

标签: spring xsd

Spring platform-b​​om 1.1.1.4-RELEASE,Java-1.8.0_65,Tomcat 8.0.3

配置spring-security-web(3.2.8),出现以下错误:

org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/security/spring-security-3.2.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) [na:1.8.0_65]
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(Unknown Source) [na:1.8.0_65]

这是context-security.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xmlns:sec="http://www.springframework.org/schema/security"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
           http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd">

    <bean id="restApiAccessDeniedHandler" class="org.springframework.security.web.access.AccessDeniedHandlerImpl"/>
    <bean id="forbiddenEntryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"/>

    <bean id="jdbcUserDetailsService" class="com.alu.ode.mdm.security.service.impl.JdbcUserDetailsServiceImpl" />

    <bean id="jdbcAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
        <property name="userDetailsService" ref="jdbcUserDetailsService" /> 
    </bean>

    <sec:http pattern="/ui/**" security="none">
    </sec:http>

<!--    <sec:http name="uiSecurity" pattern="/ui/**"> -->
<!--        <sec:form-login default-target-url="/ui/index.jsp" always-use-default-target="true" /> -->
<!--        <sec:intercept-url pattern="/ui/**" access="isAuthenticated()" /> -->
<!--    </sec:http> -->

<!--    <sec:http name="restSecurity" pattern="/rest/**"> -->
<!--        <sec:access-denied-handler ref="restApiAccessDeniedHandler" /> -->
<!--        <sec:intercept-url pattern="/rest/**" access="isAuthenticated()" /> -->
<!--    </sec:http> -->

<!--    <sec:authentication-manager> -->
<!--        <sec:authentication-provider ref="jdbcAuthenticationProvider" /> -->
<!--    </sec:authentication-manager> -->

</beans>

0 个答案:

没有答案