이 누리집은 대한민국 공식 전자정부 누리집입니다.
엄*진
2014-02-20 18:12:54
1,714
개발환경
완료
안녕하십니까
전자정부프레임워크 2.6버전에 엔터프라이즈 템플릿 세팅하여 프로젝트 중입니다.
다름이 아니오라 spring-security관련해서 질문 사항이 있습니다.
이슈는 이렇습니다.
로그인한 모든 사용자의 로그아웃 시간을 확인 해야합니다.
허나 창을 닫거나 중복 로그인으로 인하여 강제 로그아웃 당하는 로그아웃 시점을 확인 할 수가 없습니다.
그래서 생각한게 스프링 시큐리티에
package org.springframework.security.concurrent 패키지 안에 있는 SessionRegistryImpl 이 클래스를 이용하는것입니다.
이 클래스 안에 public void removeSessionInformation(String sessionId) {}
이메서드에 세션아이디를 확인하여 로그아웃을 처리 하는걸 생각중입니다.
그래서 구현한것이
SessionRegistryImpl{을 상속 받는 RefactorSessionRegistryImpl 라는 클래스입니다.
<b:bean id="refactorSessionRegistryImpl" class="org.springframework.security.concurrent.RefactorSessionRegistryImpl"/>
와 같이 bean 선언후
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="false" expired-url="/index.jsp" session-registry-alias="refactorSessionRegistryImpl" />
와 같이 선언하여 SessionRegistryImpl{ 클래스에 removeSessionInformation 메서드가 호출될때 로그아웃 기록을 남기는 것입니다.
허나 아래와 같은 문제가 있습니다.
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="false" expired-url="/index.jsp" session-registry-alias="refactorSessionRegistryImpl" />
이렇게 선언하게 되면 중복 로그인 기능은 되나 오버라이딩한 RefactorSessionRegistryImpl클래스에 removeSessionInformation메서드가 호출이 안됩니다.
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="false" expired-url="/index.jsp" session-registry-ref="refactorSessionRegistryImpl" />
를 하게되면 중복 로그인 기능이 안되고 오버라이딩한 RefactorSessionRegistryImpl클래스에 removeSessionInformation메서드는 호출이 됩니다.
해결 방안을 알려주시면 고맙겠습니다.
바쁘신 와중에도 글을 읽어주셔서 감사합니다.
안녕하세요. 엄태진님
스프링 시큐리티를 커스터마이징 하는 방법 대신에 httpSessionListener.을 등록하여서 sessionDestroyed 메소드를 구현하는 방식으로 접근하셔도 좋을 듯 합니다.
관련 url을 참고하시기 바랍니다.
https://groups.google.com/forum/#!topic/ksug/QeXPvwwT1SI
고맙습니다.