簡體   English   中英

春季安全性ldap

[英]Spring Security ldap

我正在嘗試Spring MVC外部ldap身份驗證,但遇到了問題。 有人可以幫幫我嗎 。

彈簧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 use-expressions="true">
    <intercept-url pattern="/**" access="authenticated" />
    <form-login />
</http>

<ldap-server url="ldap://hostname:port" id="ldapServer" manager-dn="cn=Directory Manager" manager-password="XXXXXXX" root="dc=abc,dc=def,dc=ghi"/>

<authentication-manager>
    <ldap-authentication-provider server-ref="ldapServer" group-search-base="dc=abc,dc=def,dc=ghi"
        user-dn-pattern="uid={0}" >
        <password-compare password-attribute="userPassword" hash="sha"></password-compare>
    </ldap-authentication-provider>
</authentication-manager>

雖然它提供了錯誤的身份驗證,但我使用的憑據是正確的。 我猜問題出在security.xml上,如果有人可以驗證我的spring-security.xml,那將是一個很大的幫助。

LDAP屏幕截圖 在此處輸入圖片說明

在此處輸入圖片說明

春季安全日志

02:19:34,504  INFO ContextLoader:307 - Root WebApplicationContext: initialization started
02:19:34,662  INFO XmlWebApplicationContext:574 - Refreshing Root WebApplicationContext: startup date [Wed Jun 28 02:19:34 EDT 2017]; root of context hierarchy
02:19:34,728  INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-security.xml]
02:19:34,930  INFO SecurityNamespaceHandler:78 - Spring Security 'config' module version is 4.2.2.RELEASE
02:19:35,011  INFO FilterInvocationSecurityMetadataSourceParser:194 - Creating access control expression attribute 'authenticated' for /**
02:19:35,794  INFO AuthenticationConfigBuilder:537 - No login page configured. The default internal one will be used. Use the 'login-page' attribute to set the URL of the login page.
02:19:35,806  INFO HttpSecurityBeanDefinitionParser:306 - Checking sorted filter chain: [Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 200, Root bean: class [org.springframework.security.web.header.HeaderWriterFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 500, Root bean: class [org.springframework.security.web.csrf.CsrfFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 700, <org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0>, order = 1200, Root bean: class [org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1400, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1700, Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.security.config.http.HttpConfigurationBuilder$SecurityContextHolderAwareRequestFilterBeanFactory#0; factoryMethodName=getBean; initMethodName=null; destroyMethodName=null, order = 1800, Root bean: class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2100, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2200, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2300, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 2400]
02:19:35,821  INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from ServletContext resource [/WEB-INF/springmvc-servlet.xml]
02:19:36,370  INFO PropertySourcesPlaceholderConfigurer:172 - Loading properties file from class path resource [hibernate.properties]
02:19:36,654  INFO DefaultSpringSecurityContextSource:76 -  URL 'ldap://hostname:port', root DN is ''
02:19:36,970 DEBUG ExpressionBasedFilterInvocationSecurityMetadataSource:74 - Adding web access control expression 'authenticated', for org.springframework.security.web.util.matcher.AnyRequestMatcher@1
02:19:37,014 DEBUG FilterSecurityInterceptor:180 - Validated configuration attributes
02:19:37,016  INFO DefaultSecurityFilterChain:43 - Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.SecurityContextPersistenceFilter@1e097d59, org.springframework.security.web.header.HeaderWriterFilter@673be18f, org.springframework.security.web.csrf.CsrfFilter@6581dc0a, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@39de3d36, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@6ce86ce1, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@54e7df6a, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@3fed2870, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@77128536, org.springframework.security.web.session.SessionManagementFilter@58326051, org.springframework.security.web.access.ExceptionTranslationFilter@32c4e8b2, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@64bce832]
02:19:37,043  INFO DefaultFilterChainValidator:154 - Checking whether login URL '/login' is accessible with your configuration
02:19:37,052 DEBUG DefaultFilterChainValidator:175 - Default generated login page is in use
02:19:37,307  INFO RequestMappingHandlerMapping:531 - Mapped "{[/ || /welcome**],methods=[GET]}" onto public java.lang.String com.edx.controller.loginController.welcomePage()
02:19:37,310  INFO RequestMappingHandlerMapping:531 - Mapped "{[/logout],methods=[GET]}" onto public java.lang.String com.edx.controller.loginController.logoutPage(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
02:19:37,311  INFO RequestMappingHandlerMapping:531 - Mapped "{[/admin**],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.edx.controller.loginController.adminPage()
02:19:37,315  INFO RequestMappingHandlerMapping:531 - Mapped "{[/Views/getAllPartners],methods=[GET],produces=[application/json]}" onto public java.util.List<com.edx.model.Partner> com.edx.controller.MainController.getAllPartners(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
02:19:38,391  INFO RequestMappingHandlerAdapter:532 - Looking for @ControllerAdvice: Root WebApplicationContext: startup date [Wed Jun 28 02:19:34 EDT 2017]; root of context hierarchy
02:19:38,453  INFO RequestMappingHandlerAdapter:532 - Looking for @ControllerAdvice: Root WebApplicationContext: startup date [Wed Jun 28 02:19:34 EDT 2017]; root of context hierarchy
02:19:38,539  INFO SimpleUrlHandlerMapping:341 - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
02:19:38,565  INFO DriverManagerDataSource:133 - Loaded JDBC driver: oracle.jdbc.driver.OracleDriver
02:19:57,546  INFO HibernateTransactionManager:357 - Using DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource@36480b2d] of Hibernate SessionFactory for HibernateTransactionManager
02:19:57,656  INFO ContextLoader:347 - Root WebApplicationContext: initialization completed in 23150 ms
02:19:57,704  INFO DispatcherServlet:488 - FrameworkServlet 'springmvc': initialization started
02:19:57,706  INFO XmlWebApplicationContext:574 - Refreshing WebApplicationContext for namespace 'springmvc-servlet': startup date [Wed Jun 28 02:19:57 EDT 2017]; parent: Root WebApplicationContext
02:19:57,708  INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from ServletContext resource [/WEB-INF/springmvc-servlet.xml]
02:19:57,801  INFO PropertySourcesPlaceholderConfigurer:172 - Loading properties file from class path resource [hibernate.properties]
02:19:57,830  INFO RequestMappingHandlerMapping:531 - Mapped "{[/ || /welcome**],methods=[GET]}" onto public java.lang.String com.edx.controller.loginController.welcomePage()
02:19:57,831  INFO RequestMappingHandlerMapping:531 - Mapped "{[/logout],methods=[GET]}" onto public java.lang.String com.edx.controller.loginController.logoutPage(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
02:19:57,831  INFO RequestMappingHandlerMapping:531 - Mapped "{[/admin**],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.edx.controller.loginController.adminPage()
02:19:57,832  INFO RequestMappingHandlerMapping:531 - Mapped "{[/Views/getAllPartners],methods=[GET],produces=[application/json]}" onto public java.util.List<com.edx.model.Partner> com.edx.controller.MainController.getAllPartners(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
02:19:57,865  INFO RequestMappingHandlerAdapter:532 - Looking for @ControllerAdvice: WebApplicationContext for namespace 'springmvc-servlet': startup date [Wed Jun 28 02:19:57 EDT 2017]; parent: Root WebApplicationContext
02:19:57,887  INFO RequestMappingHandlerAdapter:532 - Looking for @ControllerAdvice: WebApplicationContext for namespace 'springmvc-servlet': startup date [Wed Jun 28 02:19:57 EDT 2017]; parent: Root WebApplicationContext
02:19:57,926  INFO SimpleUrlHandlerMapping:341 - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
02:19:57,928  INFO DriverManagerDataSource:133 - Loaded JDBC driver: oracle.jdbc.driver.OracleDriver
02:20:22,504  INFO HibernateTransactionManager:357 - Using DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource@38e7ed69] of Hibernate SessionFactory for HibernateTransactionManager
02:20:22,546  INFO DispatcherServlet:507 - FrameworkServlet 'springmvc': initialization completed in 24842 ms
02:25:12,439 DEBUG FilterChainProxy:325 - / at position 1 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
02:25:12,440 DEBUG HttpSessionSecurityContextRepository:174 - No HttpSession currently exists
02:25:12,440 DEBUG HttpSessionSecurityContextRepository:116 - No SecurityContext was available from the HttpSession: null. A new one will be created.
02:25:12,442 DEBUG FilterChainProxy:325 - / at position 2 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'
02:25:12,448 DEBUG HstsHeaderWriter:130 - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@2e462440
02:25:12,449 DEBUG FilterChainProxy:325 - / at position 3 of 11 in additional filter chain; firing Filter: 'CsrfFilter'
02:25:12,451 DEBUG FilterChainProxy:325 - / at position 4 of 11 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
02:25:12,451 DEBUG AntPathRequestMatcher:137 - Request 'GET /' doesn't match 'POST /login
02:25:12,451 DEBUG FilterChainProxy:325 - / at position 5 of 11 in additional filter chain; firing Filter: 'DefaultLoginPageGeneratingFilter'
02:25:12,451 DEBUG FilterChainProxy:325 - / at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
02:25:12,452 DEBUG FilterChainProxy:325 - / at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
02:25:12,453 DEBUG FilterChainProxy:325 - / at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
02:25:12,455 DEBUG AnonymousAuthenticationFilter:100 - Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@9055c2bc: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'
02:25:12,456 DEBUG FilterChainProxy:325 - / at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'
02:25:12,456 DEBUG FilterChainProxy:325 - / at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
02:25:12,457 DEBUG FilterChainProxy:325 - / at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
02:25:12,457 DEBUG FilterSecurityInterceptor:219 - Secure object: FilterInvocation: URL: /; Attributes: [authenticated]
02:25:12,457 DEBUG FilterSecurityInterceptor:348 - Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@9055c2bc: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS
02:25:12,489 DEBUG AffirmativeBased:66 - Voter: org.springframework.security.web.access.expression.WebExpressionVoter@38142c54, returned: -1
02:25:12,496 DEBUG ExceptionTranslationFilter:173 - Access is denied (user is anonymous); redirecting to authentication entry point
org.springframework.security.access.AccessDeniedException: Access is denied
    at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:84)
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:124)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:177)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
02:25:12,512 DEBUG AntPathRequestMatcher:147 - Request '/' matched by universal pattern '/**'
02:25:12,531 DEBUG HttpSessionRequestCache:60 - DefaultSavedRequest added to Session: DefaultSavedRequest[http://localhost:8080/NewEDXUI/]
02:25:12,531 DEBUG ExceptionTranslationFilter:202 - Calling Authentication entry point.
02:25:12,533 DEBUG DefaultRedirectStrategy:54 - Redirecting to 'http://localhost:8080/NewEDXUI/login'
02:25:12,533 DEBUG HttpSessionSecurityContextRepository:352 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
02:25:12,553 DEBUG SecurityContextPersistenceFilter:119 - SecurityContextHolder now cleared, as request processing completed
02:25:12,556 DEBUG FilterChainProxy:325 - /login at position 1 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
02:25:12,556 DEBUG HttpSessionSecurityContextRepository:186 - HttpSession returned null object for SPRING_SECURITY_CONTEXT
02:25:12,557 DEBUG HttpSessionSecurityContextRepository:116 - No SecurityContext was available from the HttpSession: org.mortbay.jetty.servlet.HashSessionManager$Session:1umvm4pd25kscauq3nuefya9c@658118451. A new one will be created.
02:25:12,557 DEBUG FilterChainProxy:325 - /login at position 2 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'
02:25:12,557 DEBUG HstsHeaderWriter:130 - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@2e462440
02:25:12,557 DEBUG FilterChainProxy:325 - /login at position 3 of 11 in additional filter chain; firing Filter: 'CsrfFilter'
02:25:12,558 DEBUG FilterChainProxy:325 - /login at position 4 of 11 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
02:25:12,558 DEBUG AntPathRequestMatcher:137 - Request 'GET /login' doesn't match 'POST /login
02:25:12,558 DEBUG FilterChainProxy:325 - /login at position 5 of 11 in additional filter chain; firing Filter: 'DefaultLoginPageGeneratingFilter'
02:25:12,562 DEBUG HttpSessionSecurityContextRepository:352 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
02:25:12,565 DEBUG SecurityContextPersistenceFilter:119 - SecurityContextHolder now cleared, as request processing completed
02:25:29,510 DEBUG FilterChainProxy:325 - /login at position 1 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
02:25:29,510 DEBUG HttpSessionSecurityContextRepository:186 - HttpSession returned null object for SPRING_SECURITY_CONTEXT
02:25:29,510 DEBUG HttpSessionSecurityContextRepository:116 - No SecurityContext was available from the HttpSession: org.mortbay.jetty.servlet.HashSessionManager$Session:1umvm4pd25kscauq3nuefya9c@658118451. A new one will be created.
02:25:29,511 DEBUG FilterChainProxy:325 - /login at position 2 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'
02:25:29,511 DEBUG HstsHeaderWriter:130 - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@2e462440
02:25:29,511 DEBUG FilterChainProxy:325 - /login at position 3 of 11 in additional filter chain; firing Filter: 'CsrfFilter'
02:25:29,513 DEBUG FilterChainProxy:325 - /login at position 4 of 11 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
02:25:29,513 DEBUG AntPathRequestMatcher:157 - Checking match of request : '/login'; against '/login'
02:25:29,514 DEBUG UsernamePasswordAuthenticationFilter:206 - Request is to process authentication
02:25:29,514 DEBUG ProviderManager:169 - Authentication attempt using org.springframework.security.ldap.authentication.LdapAuthenticationProvider
02:25:29,514 DEBUG LdapAuthenticationProvider:69 - Processing authentication request for user: Nitin1234
02:25:31,370 DEBUG UsernamePasswordAuthenticationFilter:345 - Authentication request failed: org.springframework.security.authentication.BadCredentialsException: Bad credentials
org.springframework.security.authentication.BadCredentialsException: Bad credentials
    at org.springframework.security.ldap.authentication.LdapAuthenticationProvider.doAuthentication(LdapAuthenticationProvider.java:197)
    at org.springframework.security.ldap.authentication.AbstractLdapAuthenticationProvider.authenticate(AbstractLdapAuthenticationProvider.java:85)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:174)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:199)
    at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:94)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
02:25:31,370 DEBUG UsernamePasswordAuthenticationFilter:346 - Updated SecurityContextHolder to contain null Authentication
02:25:31,371 DEBUG UsernamePasswordAuthenticationFilter:347 - Delegating to authentication failure handler org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler@723dd275
02:25:31,371 DEBUG SimpleUrlAuthenticationFailureHandler:90 - Redirecting to /login?error
02:25:31,371 DEBUG DefaultRedirectStrategy:54 - Redirecting to '/NewEDXUI/login?error'
02:25:31,371 DEBUG HttpSessionSecurityContextRepository:352 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.

關於nitin

您可以試試這個提供者:

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

<bean id="contextSource"
        class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
        <constructor-arg value="ldap://localhost:389/dc=abc,dc=def,dc=ghi" />
        <property name="userDn" value="user" />
        <property name="password" value="pass" />
    </bean>

    <bean id="userSearch"
        class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
        <constructor-arg index="0" value="" />
        <constructor-arg index="1" value="(uid={0})" />
        <constructor-arg index="2" ref="contextSource" />
        <property name="searchSubtree" value="true" />
    </bean>

    <bean id="ldapAuthProvider"
        class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
        <constructor-arg>
            <bean
                class="org.springframework.security.ldap.authentication.BindAuthenticator">
                <constructor-arg ref="contextSource" />
                <property name="userSearch" ref="userSearch" />
            </bean>
        </constructor-arg>
        <constructor-arg>
            <bean
                class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
                <constructor-arg ref="contextSource" />
                <constructor-arg value="" />
                <property name="defaultRole" value="ROLE_USER"/>
                <property name="searchSubtree" value="true" />
                <property name="ignorePartialResultException" value="true" />
            </bean>
        </constructor-arg>
    </bean>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM