|
|
@@ -68,22 +68,21 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
.antMatchers("/ws/**").permitAll()
|
|
|
// .antMatchers("/api/**").permitAll()
|
|
|
// API 권한 설정하지
|
|
|
- //.antMatchers("/api/**").permitAll()
|
|
|
+ .antMatchers("/api/**").permitAll()
|
|
|
// 지도 URI 권한 설정하지
|
|
|
.antMatchers("/MAPDATA/**").permitAll()
|
|
|
.antMatchers("/download/**").permitAll()
|
|
|
// 페이지 권한 설정
|
|
|
-// .antMatchers("/application/facility/**", "/facility/**").permitAll()
|
|
|
.antMatchers("/application/**", "/facility/**").permitAll()
|
|
|
.antMatchers("/application/wall/**", "/wall/**").permitAll()
|
|
|
+ .antMatchers("/application/facility/**", "/facility/**").permitAll()
|
|
|
.antMatchers("/application/dash-board/**", "/dash-board/**").permitAll()
|
|
|
.antMatchers("/application/login/**").permitAll()
|
|
|
.antMatchers("/api/auth/**").permitAll()
|
|
|
-// .antMatchers("/api/**").permitAll()
|
|
|
.anyRequest().authenticated()
|
|
|
.and()
|
|
|
.formLogin()
|
|
|
- .loginPage("/application/login/login.html")
|
|
|
+ .loginPage("/application/op/00.main/main.html")
|
|
|
//.loginPage("/api/auth/login.do")
|
|
|
.loginProcessingUrl("/api/auth/login.do")
|
|
|
.defaultSuccessUrl("/application/op/00.main/main.html", true)
|
|
|
@@ -119,25 +118,75 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
.expiredUrl("/application/login/login.html") // 세션이 만료된 경우 이동 할 페이지
|
|
|
//.expiredUrl("/api/auth/login.do") // 세션이 만료된 경우 이동 할 페이지
|
|
|
.sessionRegistry(sessionRegistry())
|
|
|
-// .and()
|
|
|
-// .exceptionHandling()
|
|
|
-// .accessDeniedPage("/login.do")
|
|
|
-// .and()
|
|
|
-// .headers()
|
|
|
-// .defaultsDisabled()
|
|
|
-// .frameOptions()
|
|
|
-// .sameOrigin()
|
|
|
-// .cacheControl();
|
|
|
-
|
|
|
-// .and() // 로그아웃 설정
|
|
|
-// .logout()
|
|
|
-// .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
|
|
|
-// .logoutSuccessUrl("/login")
|
|
|
-// .invalidateHttpSession(true)
|
|
|
-// .deleteCookies("JSESSIONID")
|
|
|
-// .and()
|
|
|
-// // 403 예외처리 핸들링
|
|
|
-// .exceptionHandling().accessDeniedPage("/login");
|
|
|
+ ;
|
|
|
+ } catch (IOException e) {
|
|
|
+ // FOR KISA Secure Coding pass
|
|
|
+ log.error("{configure: IOException}");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("{configure: Exception}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //@Override
|
|
|
+ protected void configure_security(HttpSecurity http) {
|
|
|
+
|
|
|
+ // URL 권한 설정
|
|
|
+ //setAntMatchers(http, "ROLE_");
|
|
|
+
|
|
|
+ try {
|
|
|
+ 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/**").permitAll()
|
|
|
+ // API 권한 설정하지
|
|
|
+ //.antMatchers("/api/**").permitAll()
|
|
|
+ // 지도 URI 권한 설정하지
|
|
|
+ .antMatchers("/MAPDATA/**").permitAll()
|
|
|
+ .antMatchers("/download/**").permitAll()
|
|
|
+ // 페이지 권한 설정
|
|
|
+ .antMatchers("/application/**", "/facility/**").permitAll()
|
|
|
+ .antMatchers("/application/wall/**", "/wall/**").permitAll()
|
|
|
+ .antMatchers("/application/facility/**", "/facility/**").permitAll()
|
|
|
+ .antMatchers("/application/dash-board/**", "/dash-board/**").permitAll()
|
|
|
+ .antMatchers("/application/login/**").permitAll()
|
|
|
+ .antMatchers("/api/auth/**").permitAll()
|
|
|
+ .anyRequest().authenticated()
|
|
|
+ .and()
|
|
|
+ .formLogin()
|
|
|
+ .loginPage("/application/login/login.html")
|
|
|
+ //.loginPage("/api/auth/login.do")
|
|
|
+ .loginProcessingUrl("/api/auth/login.do")
|
|
|
+ .defaultSuccessUrl("/application/op/00.main/main.html", true)
|
|
|
+ .usernameParameter("username")
|
|
|
+ .passwordParameter("password")
|
|
|
+ .successHandler(this.webLoginSuccessHandler)
|
|
|
+ .failureHandler(this.webLoginFailureHandler)
|
|
|
+ .permitAll()
|
|
|
+ .and()
|
|
|
+ .logout()
|
|
|
+ .addLogoutHandler(new UserLogoutHandler()).permitAll()
|
|
|
+ .logoutSuccessUrl("/application/login/login.html").permitAll()
|
|
|
+ .invalidateHttpSession(true)
|
|
|
+ .deleteCookies("JSESSIONID")
|
|
|
+ .deleteCookies(WebMvcConfig.USER_UUID)
|
|
|
+ .deleteCookies(WebMvcConfig.USER_TIME)
|
|
|
+ .and()
|
|
|
+ .sessionManagement()
|
|
|
+ .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) // 스프링 시큐리티가 필요 시 생성 (default)
|
|
|
+ // 인증에 성공할 때 마다 세션 ID나 세션을 변경해서 발급해줌으로써
|
|
|
+ // 세션을 중간에서 가로채더라도 해당 세션이 유효하지 않게 하는 기능
|
|
|
+ .invalidSessionUrl("/application/login/login.html") // 세션이 유효하지 않을 경우 이동 할 페이지
|
|
|
+ .sessionFixation().changeSessionId() // changeSessionId : 새로운 세션 ID를 발급해서 전달(default)
|
|
|
+ .maximumSessions(20) // 최대 허용 가능 세션 수, -1인 경우 무제한 세션 허용
|
|
|
+ .maxSessionsPreventsLogin(true) // 동시 로그인 차단, false 인 경우 기존 세션 만료(default)
|
|
|
+ .expiredUrl("/application/login/login.html") // 세션이 만료된 경우 이동 할 페이지
|
|
|
+ .sessionRegistry(sessionRegistry())
|
|
|
;
|
|
|
} catch (IOException e) {
|
|
|
// FOR KISA Secure Coding pass
|