|
@@ -59,82 +59,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
web.ignoring().antMatchers(HttpMethod.PUT, "/api/scrs/file/**"); // GET Method 는 모두 통과
|
|
web.ignoring().antMatchers(HttpMethod.PUT, "/api/scrs/file/**"); // GET Method 는 모두 통과
|
|
web.ignoring().antMatchers(HttpMethod.DELETE, "/api/scrs/file/**"); // GET Method 는 모두 통과
|
|
web.ignoring().antMatchers(HttpMethod.DELETE, "/api/scrs/file/**"); // GET Method 는 모두 통과
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //@Override
|
|
|
|
- protected void configure_non_login(HttpSecurity http) {
|
|
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.GET, "/api/test/**"); // GET Method 는 모두 통과
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.POST, "/api/test/**"); // GET Method 는 모두 통과
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.PUT, "/api/test/**"); // GET Method 는 모두 통과
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.DELETE, "/api/test/**"); // GET Method 는 모두 통과
|
|
|
|
|
|
- // URL 권한 설정
|
|
|
|
- //setAntMatchers(http, "ROLE_");
|
|
|
|
|
|
+ web.ignoring().antMatchers(HttpMethod.GET, "/manual/**"); // GET Method 는 모두 통과
|
|
|
|
|
|
- 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/resource/**").permitAll()
|
|
|
|
- .antMatchers("/api/reload/**").permitAll()
|
|
|
|
- .antMatchers("/api/scrs/file/**").permitAll()
|
|
|
|
-// .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/dashboard/**", "/dashboard/**").permitAll()
|
|
|
|
- .antMatchers("/application/login/**").permitAll()
|
|
|
|
- .antMatchers("/api/auth/**").permitAll()
|
|
|
|
- .anyRequest().authenticated()
|
|
|
|
- .and()
|
|
|
|
- .formLogin()
|
|
|
|
- .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)
|
|
|
|
- .usernameParameter("username")
|
|
|
|
- .passwordParameter("password")
|
|
|
|
- .successHandler(this.webLoginSuccessHandler)
|
|
|
|
- .failureHandler(this.webLoginFailureHandler)
|
|
|
|
- .permitAll()
|
|
|
|
- .and()
|
|
|
|
- .logout()
|
|
|
|
- //.logoutUrl("/api/auth/logout.do")
|
|
|
|
- //.logoutRequestMatcher(new AntPathRequestMatcher("/api/auth/logout.do"))
|
|
|
|
- .addLogoutHandler(new UserLogoutHandler()).permitAll()
|
|
|
|
- .logoutSuccessUrl("/application/login/login.html").permitAll()
|
|
|
|
- //.logoutSuccessUrl("/api/auth/login.do").permitAll()
|
|
|
|
- .invalidateHttpSession(true)
|
|
|
|
- .deleteCookies("JSESSIONID")
|
|
|
|
- .deleteCookies(WebConstants.USER_UUID)
|
|
|
|
- .deleteCookies(WebConstants.USER_TIME)
|
|
|
|
- .and()
|
|
|
|
- .sessionManagement()
|
|
|
|
- .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) // 스프링 시큐리티가 필요 시 생성 (default)
|
|
|
|
- // 인증에 성공할 때 마다 세션 ID나 세션을 변경해서 발급해줌으로써
|
|
|
|
- // 세션을 중간에서 가로채더라도 해당 세션이 유효하지 않게 하는 기능
|
|
|
|
- .invalidSessionUrl("/application/login/login.html") // 세션이 유효하지 않을 경우 이동 할 페이지
|
|
|
|
- //.invalidSessionUrl("/api/auth/login.do") // 세션이 유효하지 않을 경우 이동 할 페이지
|
|
|
|
- .sessionFixation().changeSessionId() // changeSessionId : 새로운 세션 ID를 발급해서 전달(default)
|
|
|
|
- // none : 아무 동작 안함
|
|
|
|
- // migrateSession : 새로운 세션을 생성해서 전달 (속성값 유지)
|
|
|
|
- // newSession : 새로운 세션 전달 (속성값 유지 안됨)
|
|
|
|
- .maximumSessions(20) // 최대 허용 가능 세션 수, -1인 경우 무제한 세션 허용
|
|
|
|
- .maxSessionsPreventsLogin(true) // 동시 로그인 차단, false 인 경우 기존 세션 만료(default)
|
|
|
|
- .expiredUrl("/application/login/login.html") // 세션이 만료된 경우 이동 할 페이지
|
|
|
|
- //.expiredUrl("/api/auth/login.do") // 세션이 만료된 경우 이동 할 페이지
|
|
|
|
- .sessionRegistry(sessionRegistry())
|
|
|
|
- ;
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- // FOR KISA Secure Coding pass
|
|
|
|
- log.error("{configure: IOException}");
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("{configure: Exception}");
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -155,6 +86,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
.antMatchers("/ws/**").permitAll()
|
|
.antMatchers("/ws/**").permitAll()
|
|
.antMatchers("/api/resource/**").permitAll()
|
|
.antMatchers("/api/resource/**").permitAll()
|
|
.antMatchers("/api/reload/**").permitAll()
|
|
.antMatchers("/api/reload/**").permitAll()
|
|
|
|
+ .antMatchers("/api/test/**").permitAll()
|
|
|
|
+ .antMatchers("/api/manual/**").permitAll()
|
|
// .antMatchers("/api/**").permitAll() // 로그인 하지 않을 경우 주석해제
|
|
// .antMatchers("/api/**").permitAll() // 로그인 하지 않을 경우 주석해제
|
|
// 지도 URI 권한 설정하지
|
|
// 지도 URI 권한 설정하지
|
|
.antMatchers("/MAPDATA/**").permitAll()
|
|
.antMatchers("/MAPDATA/**").permitAll()
|