0. <security:session-management>
스프링 시큐리티의 설정 XML 파일에서 <security:http> 안에서 <security:session-management> 태그를 사용할 수 있다. 이름 그대로 세션 관리 설정을 위한 영역이다.
<security:session-management> 태그 안에는 <security:concurrency-control> 태그를 사용할 수 있다. 세션의 동시성(Concurrency) 과 관련된 설정을 할 수 있는데 여기서 max-session을 "1"로 주면 서버에서 계정 당 한 명만 로그인할 수 있도록 설정할 수 있다.
error-if-maximum-exceeded 설정에는 최대 로그인 가능 수를 넘으면 에러를 발생시킬지 여부를 설정한다. 이렇게 설정한 뒤, 최대 접속자 수를 넘으면 에러가 발생하는데 session-management의 session-authentication-error-url 로 에러 페이지 경로를 설정할 수 있다.
<security:session-management session-authentication-error-url="/login" >
<security:concurrency-control max-sessions="1"
error-if-maximum-exceeded="true" />
</security:session-management>
'Java > Spring Framework' 카테고리의 다른 글
[Spring Framework] UserDetailsService에서 HttpServletRequest 받기 (0) | 2023.03.24 |
---|---|
[Spring Framework] 스프링 시큐리티 다중 로그인 화면 (0) | 2023.02.23 |
[Spring Framework] 스프링 시큐리티 적용 후 서버에서 회원 정보 확인하기 (0) | 2023.02.15 |
[Spring Framework] 어노테이션을 사용한 시큐리티 지정 (0) | 2023.02.15 |
[Spring Framework] 시큐리티 설정 정리 (0) | 2023.02.15 |