2010-06-30 12 views
2

나는 봄 보안 작업을하고 있습니다. 하지만 j_spring_security serlvet는 작동하지 않는 것 같습니다. 어떻게 문제를 디버깅합니까, 아니면 근본 원인을 찾으십니까? 내가스프링 보안 j_spring_security 로그 아웃 문제

를 로그 오프하고 때 나는 오류를 체크 아웃하고 여기에 로그 파일

의 컷 한

<?xml version="1.0" encoding="UTF-8"?> 

<!-- 
    - Sample namespace-based configuration 
    - 
    --> 

<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.xsd"> 

<global-method-security pre-post-annotations="enabled"> 
    <!-- 
    AspectJ pointcut expression that locates our "post" method and 
    applies security that way <protect-pointcut expression="execution(* 
    bigbank.*Service.post*(..))" access="ROLE_TELLER"/> 
    --> 
</global-method-security> 

<http use-expressions="true"> 
    <intercept-url pattern="/" access="permitAll" /> 
    <intercept-url pattern="/login/**" filters="none" /> 
    <intercept-url pattern="/static/**" filters="none" /> 
    <intercept-url pattern="/**" access="isAuthenticated()" /> 
    <form-login login-page="/login/login.jsp" 
    default-target-url="/fileList.do" authentication-failure-url="/login/login.jsp?login_error=1" /> 
    <logout logout-success-url="/login/logout_success.jsp" /> 
    <!-- 
    Uncomment to enable X509 client authentication support <x509 /> 
    --> 
    <!-- Uncomment to limit the number of sessions a user can have --> 
    <session-management invalid-session-url="/timeout.jsp"> 
    <concurrency-control max-sessions="1" 
    error-if-maximum-exceeded="true" /> 
    </session-management> 
</http> 

편집 한 후

... 유용한 로그 파일을 참조하십시오 해달라고

DEBUG [http-8080-2] (FilterChainProxy.java:175) - Converted URL to lowercase, from: '/j_spring_security_logout'; to: '/j_spring_security_logout' 
DEBUG [http-8080-2] (FilterChainProxy.java:182) - Candidate is: '/j_spring_security_logout'; pattern is /login/**; matched=false 
DEBUG [http-8080-2] (FilterChainProxy.java:175) - Converted URL to lowercase, from: '/j_spring_security_logout'; to: '/j_spring_security_logout' 
DEBUG [http-8080-2] (FilterChainProxy.java:182) - Candidate is: '/j_spring_security_logout'; pattern is /static/**; matched=false 
DEBUG [http-8080-2] (FilterChainProxy.java:175) - Converted URL to lowercase, from: '/j_spring_security_logout'; to: '/j_spring_security_logout' 
DEBUG [http-8080-2] (FilterChainProxy.java:182) - Candidate is: '/j_spring_security_logout'; pattern is /**; matched=true 
DEBUG [http-8080-2] (FilterChainProxy.java:350) - /j_spring_security_logout at position 1 of 10 in additional filter chain; firing Filter: 'o[email protected]40ece0' 
DEBUG [http-8080-2] (FilterChainProxy.java:350) - /j_spring_security_logout at position 2 of 10 in additional filter chain; firing Filter: 'org.spring[email protected]1041876' 
DEBUG [http-8080-2] (HttpSessionSecurityContextRepository.java:165) - Obtained a valid SecurityContext from SPRING_SECURITY_CONTEXT: '[email protected]583dd2: Authentication: org.springframew[email protected]86583dd2: Principal: [email protected]: Username: rod; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_SUPERVISOR,ROLE_TELLER,ROLE_USER; Password: [PROTECTED]; Authenticated: true; Details: org.sprin[email protected]fffe3f86: RemoteIpAddress: 127.0.0.1; SessionId: C6056CE774DE3568943D98A05ABCC744; Granted Authorities: ROLE_SUPERVISOR, ROLE_TELLER, ROLE_USER' 
DEBUG [http-8080-2] (FilterChainProxy.java:350) - /j_spring_security_logout at position 3 of 10 in additional filter chain; firing Filter: 'org.[email protected]174a6e2' 
DEBUG [http-8080-2] (LogoutFilter.java:93) - Logging out user 'org.springframew[email protected]86583dd2: Principal: [email protected]: Username: rod; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_SUPERVISOR,ROLE_TELLER,ROLE_USER; Password: [PROTECTED]; Authenticated: true; Details: org.sprin[email protected]fffe3f86: RemoteIpAddress: 127.0.0.1; SessionId: C6056CE774DE3568943D98A05ABCC744; Granted Authorities: ROLE_SUPERVISOR, ROLE_TELLER, ROLE_USER' and transferring to logout destination 
DEBUG [http-8080-2] (AbstractAuthenticationTargetUrlRequestHandler.java:93) - Using default Url: /login/logout_success.jsp 
DEBUG [http-8080-2] (DefaultRedirectStrategy.java:34) - Redirecting to '/crvWeb/login/logout_success.jsp' 
DEBUG [http-8080-2] (HttpSessionSecurityContextRepository.java:359) - HttpSession is now null, but was not null at start of request; session was invalidated, so do not create a new session 
DEBUG [http-8080-2] (SecurityContextPersistenceFilter.java:89) - SecurityContextHolder now cleared, as request processing completed 
DEBUG [http-8080-2] (FilterChainProxy.java:175) - Converted URL to lowercase, from: '/login/logout_success.jsp'; to: '/login/logout_success.jsp' 
DEBUG [http-8080-2] (FilterChainProxy.java:182) - Candidate is: '/login/logout_success.jsp'; pattern is /login/**; matched=true 
DEBUG [http-8080-2] (FilterChainProxy.java:139) - has an empty filter list 

그리고 다시 로그인하십시오. 봄에 나는 현재 세션이 있고 로그인을 허용하지 않는다고 말합니다.

로그의 예외를 메모하십시오. 이유 :이 주체에 대해 최대 세션 수를 초과했습니다.

DEBUG [http-8080-2] (FilterChainProxy.java:175) - Converted URL to lowercase, from: '/j_spring_security_check'; to: '/j_spring_security_check' 
DEBUG [http-8080-2] (FilterChainProxy.java:182) - Candidate is: '/j_spring_security_check'; pattern is /login/**; matched=false 
DEBUG [http-8080-2] (FilterChainProxy.java:175) - Converted URL to lowercase, from: '/j_spring_security_check'; to: '/j_spring_security_check' 
DEBUG [http-8080-2] (FilterChainProxy.java:182) - Candidate is: '/j_spring_security_check'; pattern is /static/**; matched=false 
DEBUG [http-8080-2] (FilterChainProxy.java:175) - Converted URL to lowercase, from: '/j_spring_security_check'; to: '/j_spring_security_check' 
DEBUG [http-8080-2] (FilterChainProxy.java:182) - Candidate is: '/j_spring_security_check'; pattern is /**; matched=true 
DEBUG [http-8080-2] (FilterChainProxy.java:350) - /j_spring_security_check at position 1 of 10 in additional filter chain; firing Filter: 'o[email protected]40ece0' 
DEBUG [http-8080-2] (FilterChainProxy.java:350) - /j_spring_security_check at position 2 of 10 in additional filter chain; firing Filter: 'org.spring[email protected]1041876' 
DEBUG [http-8080-2] (HttpSessionSecurityContextRepository.java:141) - HttpSession returned null object for SPRING_SECURITY_CONTEXT 
DEBUG [http-8080-2] (HttpSessionSecurityContextRepository.java:87) - No SecurityContext was available from the HttpSession: [email protected] A new one will be created. 
DEBUG [http-8080-2] (FilterChainProxy.java:350) - /j_spring_security_check at position 3 of 10 in additional filter chain; firing Filter: 'org.[email protected]174a6e2' 
DEBUG [http-8080-2] (FilterChainProxy.java:350) - /j_spring_security_check at position 4 of 10 in additional filter chain; firing Filter: 'org.springframework.s[email protected]1786a3c' 
DEBUG [http-8080-2] (AbstractAuthenticationProcessingFilter.java:193) - Request is to process authentication 
DEBUG [http-8080-2] (ProviderManager.java:117) - Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider 
DEBUG [http-8080-2] (AbstractAuthenticationProcessingFilter.java:318) - Authentication request failed: org.springframework.security.web.authentication.session.SessionAuthenticationException: Maximum sessions of 1 for this principal exceeded 
DEBUG [http-8080-2] (AbstractAuthenticationProcessingFilter.java:319) - Updated SecurityContextHolder to contain null Authentication 
DEBUG [http-8080-2] (AbstractAuthenticationProcessingFilter.java:320) - Delegating to authentication failure handlerorg.springframework.se[email protected]21447f 
DEBUG [http-8080-2] (SimpleUrlAuthenticationFailureHandler.java:56) - Redirecting to /login/login.jsp?login_error=1 
DEBUG [http-8080-2] (DefaultRedirectStrategy.java:34) - Redirecting to '/crvWeb/login/login.jsp?login_error=1' 
DEBUG [http-8080-2] (SecurityContextPersistenceFilter.java:89) - SecurityContextHolder now cleared, as request processing completed 
DEBUG [http-8080-2] (FilterChainProxy.java:175) - Converted URL to lowercase, from: '/login/login.jsp'; to: '/login/login.jsp' 
DEBUG [http-8080-2] (FilterChainProxy.java:182) - Candidate is: '/login/login.jsp'; pattern is /login/**; matched=true 
DEBUG [http-8080-2] (FilterChainProxy.java:139) - has an empty filter list 

로그 오프가 작동하지 않는 이유는 무엇입니까? 어떻게해야할까요?

답변

3

당신이 로깅 수준 디버깅 설정하려면 웹 애플리케이션의 로깅을 구성한 내가 유용한 로그 파일을 참조하십시오 해달라고

... ? Spring/SpringSecurity는 그 수준에서 많은 유용한 것들을 출력합니다.

편집

귀하의 로그 파일은 일반적으로 $CATALINA_HOME/logs에 기록됩니다,하지만 당신의 로깅 속성에 따라 달라집니다.

webapp의 로깅을 구성하는 간단한 방법은 log4j.properties 또는 log4j.xml 파일을 웹 응용 프로그램의 /WEB-INF/classes 디렉토리에 넣는 것입니다.

클래스 경로를 통해 리소스 파일에 액세스하려면 classes 디렉토리에 있어야합니다. 그러나 다른 방법으로 액세스 할 수 있으면 웹 응용 프로그램 트리의 아무 곳에 나있을 수 있습니다. (트리 외부에 리소스를 배치 할 수도 있지만 배포에 문제가있을 수 있습니다.)

이러한 질문은 모두 관련 Tomcat 및 Log4j 설명서에서보다 포괄적으로 다루어집니다. Spring의 "시작하기"문서에서도 가능합니다.

+0

가 온다? – nokheat

+0

나는 네가하는 말을 이해하지 못한다. 당신이 말하는 "그들"은 무엇입니까? –

+0

리소스 파일에 대해 이야기하고 있습니다. 개발 모드 및 프로덕션 모드에서 리소스 파일을 가리키는 위치는 어디입니까? 어떤 구성이 필요합니까? 아니면 그냥 기본값을 사용합니까? 그리고 로그 파일이 가리킬 곳은? – nokheat

5

봄 보안을 활성화하기 위해 web.xml에서 <listener>을 필요로 <concurrency-control>, see docs : 우리가 연습에 넣어 어떻게 자원 경로를 정의하기 :

또한
<listener> 
    <listener-class> 
     org.springframework.security.web.session.HttpSessionEventPublisher 
    </listener-class> 
</listener> 
+0

이것은 거의 확실하게 여기에서의 문제입니다. 로그 아웃시 세션이 파괴되면 스프링 보안 세션 레지스트리를 업데이트해야합니다. 또한 Spring Security FAQ에 이에 대한 항목이 있습니다. –

관련 문제