我有两个王国的安全性,每个参考一个AuthenticationManager与authentication-manager-ref不同,每个特定的http cabeceera都是pattern =" /",但是当我运行并尝试登录每个报告时形成我得到错误:
09.16.2014 17:03:25 DEBUG FilterChainProxy: 180 - / j_spring_security_check has not matching filters
09.16.2014 17:03:25 DEBUG DispatcherServlet: 819 - DispatcherServlet with name 'dispatcher' processing POST request for [/ testholding / j_spring_security_check]
09.16.2014 17:03:25 DEBUG RequestMappingHandlerMapping: 209 - Looking up handler method for path / j_spring_security_check
09.16.2014 17:03:25 DEBUG RequestMappingHandlerMapping: 219 - Did not find handler method for [/ j_spring_security_check]
09.16.2014 17:03:25 DEBUG SimpleUrlHandlerMapping: 169 - Matching patterns for request [/ j_spring_security_check] are [/ **]
09.16.2014 17:03:25 DEBUG SimpleUrlHandlerMapping: 193 - URI Template variables for request [/ j_spring_security_check] are {}
09.16.2014 17:03:25 DEBUG SimpleUrlHandlerMapping: 124 - Mapping [/ j_spring_security_check] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler@1477b3e] and 1 interceptor
09.16.2014 17:03:25 DEBUG DispatcherServlet: 957 - Null ModelAndView returned to DispatcherServlet with name 'dispatcher': Assuming HandlerAdapter completed request handling
09.16.2014 17:03:25 DEBUG DispatcherServlet: 913 - Successfully completed request
我的spring-security.xml:
<!-- REINO DE SEGURIDAD USUARIO WEB SERVICE UNIVERSIA -->
<http auto-config="false"
use-expressions="true" pattern="/testUser/**" authentication-manager-ref="authenticationManager" >
<intercept-url pattern="/testUser/**" access="hasRole('ROLE_USER')" />
<intercept-url pattern="/j_spring_security_check" access="permitAll"/>
<access-denied-handler error-page="/403" />
<form-login login-page="/loginUser.html"
authentication-failure-url="/loginUser.html?login_error=true"
default-target-url="/testUser"
username-parameter="j_username" password-parameter="j_password" />
<!--<custom-filter position="FORM_LOGIN_FILTER" ref="userAuthenticationProcessingFilter" />-->
<logout invalidate-session="true" logout-success-url="/loginUser.html" />
</http>
<!--REINO DE SEGURIDAD ACCESO ADMINISTRADOR POR BASE DE DATOS -->
<http auto-config="true" use-expressions="true" pattern="/test/**" authentication-manager-ref="DBauthenticationManager">
<intercept-url pattern="/test/**" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/testUser/**" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/member/**" access="hasRole('ROLE_EMPLOYEES')" />
<access-denied-handler error-page="/403" />
<form-login login-page="/login.html"
authentication-failure-url="/login.html?login_error=true"
username-parameter="j_username" password-parameter="j_password" />
<logout invalidate-session="true" logout-success-url="/loginUser.html" />
</http>
<beans:bean id="md5PasswordEncoder"
class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" />
<beans:bean id="customUserDetailsService"
class="net.universia.test.autenticacionService.CustomUserDetailsService" />
<!-- Acceso contra base de datos -->
<authentication-manager alias="DBauthenticationManager" id="DBauthenticationManager">
<authentication-provider user-service-ref="customUserDetailsService">
<password-encoder hash="md5" />
</authentication-provider>
</authentication-manager>
<beans:bean id="customAuthenticationProvider"
class="net.universia.test.autenticacionService.CustomAuthenticationProvider" />
<!-- Acceso por WS -->
<authentication-manager id="authenticationManager" alias="authenticationManager">
<authentication-provider ref="customAuthenticationProvider" />
</authentication-manager>
我的web.xml:
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher > ERROR </dispatcher >
<dispatcher > REQUEST </dispatcher >
<dispatcher > INCLUDE </dispatcher >
<dispatcher > FORWARD </dispatcher >
</filter-mapping>
请帮帮我!
答案 0 :(得分:0)
解决问题 只需实现/ user / j_spring_security_check和/ admin / j_spring_security_check并调用login-processing-url =&#34;&#34;和行动=&#34;&#34;每种形式的jsp