“匹配的通配符是严格的,但是找不到元素'http'的声明。”错误

德米特里B:

我正在尝试配置NTLM身份验证,但收到错误:

cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素'http'的声明。

我读了很多类似错误的主题,但是找不到解决我问题的方法。

我的导致错误的security.xml文件是:

<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://www.springframework.org/schema/security
                            http://www.springframework.org/schema/security/spring-security.xsd" >
    
    <http access-denied-page="forms/error403.jsp" entry-point-ref="ntlmEntryPoint" servlet-api-provision="false"> 
        <intercept-url pattern="forms/error403.jsp" filters="none"/>
        <intercept-url pattern="forms/**" access="ROLE_GUEST,ROLE_OPERATOR,ROLE_ADMIN" />
                <custom-filter position="PRE_AUTH_FILTER"/>
    </http>
    
    <authentication-manager alias="mainAuthenticationManager"/>  
    <authentication-provider user-service-ref='userDetailsService' />

    <beans:bean id="userDetailsService"
        class="service.UserInfoService">
        <beans:property name="dataSource" ref="dataSource" />
        <beans:property name="usersByUsernameQuery" value="select distinct name, ' ' as password, 1 as enabled from TMP_SPRING_USERS where name=?" />
        <beans:property name="authoritiesByUsernameQuery" value="select name, role from TMP_SPRING_USERS where name=?" />
    </beans:bean>
      
    <beans:bean id="ntlmEntryPoint"
        class="org.springframework.security.ui.ntlm.NtlmProcessingFilterEntryPoint">
        <beans:property name="authenticationFailureUrl" value="forms/error403.html" />
    </beans:bean>
        
    <beans:bean id="exceptionTranslationFilter"
        class="org.springframework.security.ui.ExceptionTranslationFilter">
        <beans:property name="authenticationEntryPoint" ref="ntlmEntryPoint" />
    </beans:bean>
    
    <beans:bean id="ntlmFilter"
        class="org.springframework.security.ui.ntlm.NtlmProcessingFilter">
        <custom-filter position="NTLM_FILTER" />
        <beans:property name="authenticationManager" ref="mainAuthenticationManager" />
        <beans:property name="retryOnAuthFailure" value="true" />
        <beans:property name="stripDomain" value="true"/>
        <beans:property name="domainController" value="company.com" />
        <beans:property name="jcifsProperties">
            <beans:props>
                <beans:prop key="jcifs.smb.lmCompatibility">0</beans:prop> 
                <beans:prop key="jcifs.smb.client.useExtendedSecurity">false</beans:prop> 
                <beans:prop key="jcifs.smb.client.domain">COMPANY</beans:prop>
                <beans:prop key="jcifs.smb.client.username">somenycuser</beans:prop>
                <beans:prop key="jcifs.smb.client.password">AReallyLoooongRandomPassword</beans:prop>
            </beans:props> 
        </beans:property> 
    </beans:bean>
    
  
</beans:beans>

因为从3.X版本开始,Spring Security不再包含NTLM扩展,所以我从http://aloiscochard.blogspot.com/2010/03/spring-security-ntlm-3.html文章中使用了它

请帮我。

德米特里B:

问题解决了,我忘了添加spring-security-config.jar。我也更改了一些设置。正确的security.xml是::

<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                            http://www.springframework.org/schema/security
                            http://www.springframework.org/schema/security/spring-security-3.0.4.xsd" >

    <http access-denied-page="forms/error403.jsp" entry-point-ref="ntlmEntryPoint" servlet-api-provision="false"> 
                <intercept-url pattern="/**" access="ROLE_GUEST,ROLE_OPERATOR,ROLE_ADMIN" />
                <custom-filter position="PRE_AUTH_FILTER" ref="ntlmFilter"/>
        </http>

    <authentication-manager alias="mainAuthenticationManager">  
            <authentication-provider user-service-ref="userDetailsService" />
        </authentication-manager>

    <beans:bean id="userDetailsService"
        class="service.UserInfoService">
        <beans:property name="dataSource" ref="dataSource" />
        <beans:property name="usersByUsernameQuery" value="select distinct name, ' ' as password, 1 as enabled from TMP_SPRING_USERS where name=?" />
        <beans:property name="authoritiesByUsernameQuery" value="select name, role from TMP_SPRING_USERS where name=?" />
    </beans:bean>

    <beans:bean id="ntlmEntryPoint"
        class="org.springframework.security.ui.ntlm.NtlmAuthenticationFilterEntryPoint">
        <beans:property name="authenticationFailureUrl" value="forms/error403.html" />
    </beans:bean>



    <beans:bean id="ntlmFilter"
        class="org.springframework.security.ui.ntlm.NtlmAuthenticationFilter">
                <beans:property name="authenticationManager" ref="mainAuthenticationManager" />
        <beans:property name="retryOnAuthFailure" value="true" />
        <beans:property name="stripDomain" value="true"/>
        <beans:property name="domainController" value="company.com" />
        <beans:property name="jcifsProperties">
            <beans:props>
                <beans:prop key="jcifs.smb.lmCompatibility">0</beans:prop> 
                <beans:prop key="jcifs.smb.client.useExtendedSecurity">false</beans:prop> 
                <beans:prop key="jcifs.smb.client.domain">COMPANY</beans:prop>
                <beans:prop key="jcifs.smb.client.username">somenycuser</beans:prop>
                <beans:prop key="jcifs.smb.client.password">AReallyLoooongRandomPassword</beans:prop>
            </beans:props> 
        </beans:property> 
    </beans:bean>


</beans:beans>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

春季安全错误:cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'http'的声明

匹配的通配符是严格的,但是找不到元素'context:component-scan的声明

Spring + Maven:匹配的通配符很严格,但是找不到元素'jdbc:embedded-database'的声明

匹配的通配符很严格,但是在servlet.xml中找不到多个元素的声明。

匹配的通配符是严格的,但是找不到元素'context:component-scan'的声明

cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素“ mvc:annotation-driven”错误的声明

“匹配的通配符很严格,但是找不到声明”错误和“读取模式失败”错误

启用Spring存储库cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素jpa:repositories的声明

cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'mvc:annotation-driven'的声明

cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'bean'的声明-Spring config问题

cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'aop:scoped-proxy'的声明

“ cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素'context:component-scan'的声明。”

cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'constructor-arg'的声明

cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'tx:annotation-driven'的声明

错误Spring模块:cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素'rabbit:connection-factory'的声明

cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素'oai-identifier'的声明。如何解决这个问题?

cvc-complex-type.2.4.c:匹配的通配符是严格的,但找不到元素“jaxrs:server”的声明

org.xml.sax.SAXParseException;cvc-complex-type.2.4.c: 匹配通配符严格,但找不到声明

cvc-elt.1:找不到元素“ beans”错误的声明

第2行错误:找不到元素'xs:schema'的声明

XSD验证错误:找不到元素'xs:schema'的声明

Java Spring:错误消息“找不到元素'util:constant'的声明

错误:cvc-elt.1:找不到元素'beans'的声明

PhalconRest \ Http \ Response :: setJsonContent声明致命错误

退货声明中的“错误:找不到符号”

错误:找不到默认活动,但已声明

HTTP错误404.13-找不到

使用spring“ cvc-elt.1:找不到错误消息:找不到元素'beans'的声明。”

WCF Websocket服务“找不到与架构http匹配的基地址”错误