|
@@ -54,16 +54,14 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
web.ignoring().antMatchers(HttpMethod.DELETE, "/resource/**"); // GET Method 는 모두 통과
|
|
web.ignoring().antMatchers(HttpMethod.DELETE, "/resource/**"); // GET Method 는 모두 통과
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- protected void configure(HttpSecurity http) {
|
|
|
|
|
|
+ //@Override
|
|
|
|
+ protected void configure_non_login(HttpSecurity http) {
|
|
|
|
|
|
// URL 권한 설정
|
|
// URL 권한 설정
|
|
//setAntMatchers(http, "ROLE_");
|
|
//setAntMatchers(http, "ROLE_");
|
|
|
|
|
|
try {
|
|
try {
|
|
- http.csrf()
|
|
|
|
- .disable()
|
|
|
|
- ; // REST API 호출 유효하게(POST...)
|
|
|
|
|
|
+ http.csrf().disable(); // REST API 호출 유효하게(POST...)
|
|
http
|
|
http
|
|
.authorizeRequests()
|
|
.authorizeRequests()
|
|
// SWAGGER 권한 설정
|
|
// SWAGGER 권한 설정
|
|
@@ -131,25 +129,25 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //@Override
|
|
|
|
- protected void configure_security(HttpSecurity http) {
|
|
|
|
|
|
+ @Override
|
|
|
|
+ protected void configure(HttpSecurity http) {
|
|
|
|
|
|
// URL 권한 설정
|
|
// URL 권한 설정
|
|
//setAntMatchers(http, "ROLE_");
|
|
//setAntMatchers(http, "ROLE_");
|
|
|
|
+ String loginPage = "/application/login/login.html"; // 로그인 할 경우 URL
|
|
|
|
+// String loginPage = "/application/op/00.main/main.html"; // 로그인 하지 않을 경우 URL
|
|
|
|
|
|
try {
|
|
try {
|
|
- http.csrf()
|
|
|
|
- .disable()
|
|
|
|
- ; // REST API 호출 유효하게(POST...)
|
|
|
|
|
|
+ http.csrf().disable(); // REST API 호출 유효하게(POST...)
|
|
http
|
|
http
|
|
.authorizeRequests()
|
|
.authorizeRequests()
|
|
// SWAGGER 권한 설정
|
|
// SWAGGER 권한 설정
|
|
.antMatchers("/swagger-ui.html", "/swagger/**", "/swagger-resources/**", "/webjars/**", "/v2/api-docs").permitAll()
|
|
.antMatchers("/swagger-ui.html", "/swagger/**", "/swagger-resources/**", "/webjars/**", "/v2/api-docs").permitAll()
|
|
// 웹소켓 권한 설정하지
|
|
// 웹소켓 권한 설정하지
|
|
.antMatchers("/ws/**").permitAll()
|
|
.antMatchers("/ws/**").permitAll()
|
|
-// .antMatchers("/api/**").permitAll()
|
|
|
|
- // API 권한 설정하지
|
|
|
|
- //.antMatchers("/api/**").permitAll()
|
|
|
|
|
|
+ .antMatchers("/api/resource/**").permitAll()
|
|
|
|
+ .antMatchers("/api/reload/**").permitAll()
|
|
|
|
+// .antMatchers("/api/**").permitAll() // 로그인 하지 않을 경우 주석해제
|
|
// 지도 URI 권한 설정하지
|
|
// 지도 URI 권한 설정하지
|
|
.antMatchers("/MAPDATA/**").permitAll()
|
|
.antMatchers("/MAPDATA/**").permitAll()
|
|
.antMatchers("/download/**").permitAll()
|
|
.antMatchers("/download/**").permitAll()
|
|
@@ -163,7 +161,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
.anyRequest().authenticated()
|
|
.anyRequest().authenticated()
|
|
.and()
|
|
.and()
|
|
.formLogin()
|
|
.formLogin()
|
|
- .loginPage("/application/login/login.html")
|
|
|
|
|
|
+ .loginPage(loginPage)
|
|
//.loginPage("/api/auth/login.do")
|
|
//.loginPage("/api/auth/login.do")
|
|
.loginProcessingUrl("/api/auth/login.do")
|
|
.loginProcessingUrl("/api/auth/login.do")
|
|
.defaultSuccessUrl("/application/op/00.main/main.html", true)
|
|
.defaultSuccessUrl("/application/op/00.main/main.html", true)
|
|
@@ -175,7 +173,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
.and()
|
|
.and()
|
|
.logout()
|
|
.logout()
|
|
.addLogoutHandler(new UserLogoutHandler()).permitAll()
|
|
.addLogoutHandler(new UserLogoutHandler()).permitAll()
|
|
- .logoutSuccessUrl("/application/login/login.html").permitAll()
|
|
|
|
|
|
+ .logoutSuccessUrl(loginPage).permitAll()
|
|
.invalidateHttpSession(true)
|
|
.invalidateHttpSession(true)
|
|
.deleteCookies("JSESSIONID")
|
|
.deleteCookies("JSESSIONID")
|
|
.deleteCookies(WebMvcConfig.USER_UUID)
|
|
.deleteCookies(WebMvcConfig.USER_UUID)
|
|
@@ -185,11 +183,14 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) // 스프링 시큐리티가 필요 시 생성 (default)
|
|
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) // 스프링 시큐리티가 필요 시 생성 (default)
|
|
// 인증에 성공할 때 마다 세션 ID나 세션을 변경해서 발급해줌으로써
|
|
// 인증에 성공할 때 마다 세션 ID나 세션을 변경해서 발급해줌으로써
|
|
// 세션을 중간에서 가로채더라도 해당 세션이 유효하지 않게 하는 기능
|
|
// 세션을 중간에서 가로채더라도 해당 세션이 유효하지 않게 하는 기능
|
|
- .invalidSessionUrl("/application/login/login.html") // 세션이 유효하지 않을 경우 이동 할 페이지
|
|
|
|
|
|
+ .invalidSessionUrl(loginPage) // 세션이 유효하지 않을 경우 이동 할 페이지
|
|
.sessionFixation().changeSessionId() // changeSessionId : 새로운 세션 ID를 발급해서 전달(default)
|
|
.sessionFixation().changeSessionId() // changeSessionId : 새로운 세션 ID를 발급해서 전달(default)
|
|
|
|
+ // none : 아무 동작 안함
|
|
|
|
+ // migrateSession : 새로운 세션을 생성해서 전달 (속성값 유지)
|
|
|
|
+ // newSession : 새로운 세션 전달 (속성값 유지 안됨)
|
|
.maximumSessions(20) // 최대 허용 가능 세션 수, -1인 경우 무제한 세션 허용
|
|
.maximumSessions(20) // 최대 허용 가능 세션 수, -1인 경우 무제한 세션 허용
|
|
.maxSessionsPreventsLogin(true) // 동시 로그인 차단, false 인 경우 기존 세션 만료(default)
|
|
.maxSessionsPreventsLogin(true) // 동시 로그인 차단, false 인 경우 기존 세션 만료(default)
|
|
- .expiredUrl("/application/login/login.html") // 세션이 만료된 경우 이동 할 페이지
|
|
|
|
|
|
+ .expiredUrl(loginPage) // 세션이 만료된 경우 이동 할 페이지
|
|
.sessionRegistry(sessionRegistry())
|
|
.sessionRegistry(sessionRegistry())
|
|
;
|
|
;
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|