|
@@ -78,28 +78,28 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
|
|
|
try {
|
|
try {
|
|
http.csrf().disable(); // REST API 호출 유효하게(POST...)
|
|
http.csrf().disable(); // REST API 호출 유효하게(POST...)
|
|
- http
|
|
|
|
- .authorizeRequests()
|
|
|
|
- // SWAGGER 권한 설정
|
|
|
|
- .antMatchers("/swagger-ui.html", "/swagger/**", "/swagger-resources/**", "/webjars/**", "/v2/api-docs").permitAll()
|
|
|
|
- // 웹소켓 권한 설정하지
|
|
|
|
- .antMatchers("/ws/**").permitAll()
|
|
|
|
- .antMatchers("/api/resource/**").permitAll()
|
|
|
|
- .antMatchers("/api/reload/**").permitAll()
|
|
|
|
- .antMatchers("/api/test/**").permitAll()
|
|
|
|
- .antMatchers("/api/manual/**").permitAll()
|
|
|
|
-// .antMatchers("/api/**").permitAll() // 로그인 하지 않을 경우 주석해제
|
|
|
|
- // 지도 URI 권한 설정하지
|
|
|
|
- .antMatchers("/MAPDATA/**").permitAll()
|
|
|
|
- .antMatchers("/download/**").permitAll()
|
|
|
|
- // 페이지 권한 설정
|
|
|
|
- .antMatchers("/application/wall/**", "/wall/**").permitAll()
|
|
|
|
- .antMatchers("/application/facility/**", "/facility/**").permitAll()
|
|
|
|
- .antMatchers("/application/dashboard/**", "/dashboard/**").permitAll()
|
|
|
|
- .antMatchers("/application/login/**").permitAll()
|
|
|
|
- .antMatchers("/api/auth/**").permitAll()
|
|
|
|
- .anyRequest().authenticated()
|
|
|
|
- .and()
|
|
|
|
|
|
+ http.authorizeRequests()
|
|
|
|
+ // SWAGGER 권한 설정
|
|
|
|
+ .antMatchers("/swagger-ui.html", "/swagger/**", "/swagger-resources/**", "/webjars/**", "/v2/api-docs").permitAll()
|
|
|
|
+ // 웹소켓 권한 설정하지
|
|
|
|
+ .antMatchers("/ws/**").permitAll()
|
|
|
|
+ .antMatchers("/api/resource/**").permitAll()
|
|
|
|
+ .antMatchers("/api/reload/**").permitAll()
|
|
|
|
+ .antMatchers("/api/test/**").permitAll()
|
|
|
|
+ .antMatchers("/api/manual/**").permitAll()
|
|
|
|
+// .antMatchers("/api/**").permitAll() // 로그인 하지 않을 경우 주석해제
|
|
|
|
+ // 지도 URI 권한 설정하지
|
|
|
|
+ .antMatchers("/MAPDATA/**").permitAll()
|
|
|
|
+ .antMatchers("/download/**").permitAll()
|
|
|
|
+ // 페이지 권한 설정
|
|
|
|
+ .antMatchers("/application/wall/**", "/wall/**").permitAll()
|
|
|
|
+ .antMatchers("/application/facility/**", "/facility/**").permitAll()
|
|
|
|
+ .antMatchers("/application/dashboard/**", "/dashboard/**").permitAll()
|
|
|
|
+ .antMatchers("/application/login/**").permitAll()
|
|
|
|
+ .antMatchers("/application/manual/**").permitAll()
|
|
|
|
+ .antMatchers("/api/auth/**").permitAll()
|
|
|
|
+ .anyRequest().authenticated()
|
|
|
|
+ .and()
|
|
.formLogin()
|
|
.formLogin()
|
|
.loginPage(loginPage)
|
|
.loginPage(loginPage)
|
|
.loginProcessingUrl("/api/auth/login.do")
|
|
.loginProcessingUrl("/api/auth/login.do")
|
|
@@ -107,9 +107,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
.usernameParameter("username")
|
|
.usernameParameter("username")
|
|
.passwordParameter("password")
|
|
.passwordParameter("password")
|
|
.successHandler(this.webLoginSuccessHandler)
|
|
.successHandler(this.webLoginSuccessHandler)
|
|
- .failureHandler(this.webLoginFailureHandler)
|
|
|
|
- .permitAll()
|
|
|
|
- .and()
|
|
|
|
|
|
+ .failureHandler(this.webLoginFailureHandler).permitAll()
|
|
|
|
+ .and()
|
|
.logout()
|
|
.logout()
|
|
.addLogoutHandler(new UserLogoutHandler()).permitAll()
|
|
.addLogoutHandler(new UserLogoutHandler()).permitAll()
|
|
.logoutSuccessUrl(loginPage).permitAll()
|
|
.logoutSuccessUrl(loginPage).permitAll()
|
|
@@ -117,7 +116,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
.deleteCookies("JSESSIONID")
|
|
.deleteCookies("JSESSIONID")
|
|
.deleteCookies(WebConstants.USER_UUID)
|
|
.deleteCookies(WebConstants.USER_UUID)
|
|
.deleteCookies(WebConstants.USER_TIME)
|
|
.deleteCookies(WebConstants.USER_TIME)
|
|
- .and()
|
|
|
|
|
|
+ .and()
|
|
.sessionManagement()
|
|
.sessionManagement()
|
|
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) // 스프링 시큐리티가 필요 시 생성 (default)
|
|
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) // 스프링 시큐리티가 필요 시 생성 (default)
|
|
// 인증에 성공할 때 마다 세션 ID나 세션을 변경해서 발급해줌으로써
|
|
// 인증에 성공할 때 마다 세션 ID나 세션을 변경해서 발급해줌으로써
|
|
@@ -127,8 +126,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
// none : 아무 동작 안함
|
|
// none : 아무 동작 안함
|
|
// migrateSession : 새로운 세션을 생성해서 전달 (속성값 유지)
|
|
// migrateSession : 새로운 세션을 생성해서 전달 (속성값 유지)
|
|
// newSession : 새로운 세션 전달 (속성값 유지 안됨)
|
|
// newSession : 새로운 세션 전달 (속성값 유지 안됨)
|
|
- .maximumSessions(20) // 최대 허용 가능 세션 수, -1인 경우 무제한 세션 허용
|
|
|
|
- .maxSessionsPreventsLogin(true) // 동시 로그인 차단, false 인 경우 기존 세션 만료(default)
|
|
|
|
|
|
+ .maximumSessions(20) // 최대 허용 가능 세션 수, -1인 경우 무제한 세션 허용(같은 ID로 접속가능한 세션의 갯수)
|
|
|
|
+ .maxSessionsPreventsLogin(true) // false 인 경우 기존 사용자가 접속했고 새로 접속하는 사용자가 있을 경우 기존 사용자는 접속을 끊고 새로 들어오는 사용자를 받는다.(default)
|
|
.expiredUrl(loginPage) // 세션이 만료된 경우 이동 할 페이지
|
|
.expiredUrl(loginPage) // 세션이 만료된 경우 이동 할 페이지
|
|
.sessionRegistry(sessionRegistry())
|
|
.sessionRegistry(sessionRegistry())
|
|
;
|
|
;
|