shjung 2 anos atrás
pai
commit
610b083d5c

+ 2 - 2
src/main/java/com/its/op/controller/its/LoginController.java

@@ -148,7 +148,7 @@ public class LoginController {
     public ModelAndView getLogout(HttpServletRequest request, HttpServletResponse response) {
         return commonLogout(request, response);
     }
-    @PostMapping({"/logout.do"})
+    @PostMapping({"/post-logout.do"})
     public ModelAndView postLogout(HttpServletRequest request, HttpServletResponse response) {
         return commonLogout(request, response);
     }
@@ -156,7 +156,7 @@ public class LoginController {
     public ModelAndView commonLogout(HttpServletRequest request, HttpServletResponse response) {
         Cookie[] cookies = request.getCookies();
         for (int ii = 0; ii < cookies.length; ii++) {
-            log.error("getLogout: {}, {}", cookies[ii].getName(), cookies[ii].getValue());
+            log.error("commonLogout: {}, {}", cookies[ii].getName(), cookies[ii].getValue());
         }
         String encUserId = "";
         String loginHms = "";

+ 3 - 1
src/main/java/com/its/op/scheduler/ItsOpSigPhaseListener.java

@@ -90,7 +90,9 @@ public class ItsOpSigPhaseListener {
 
         stopWatch.stop();
         long totalTimeMillis = stopWatch.getTotalTimeMillis();
-        log.info("--RUN: ItsOpSigPhaseListener.run: {}, {} ms.", Thread.currentThread().getName(), totalTimeMillis);
+        if (totalTimeMillis > 1000) {
+            log.info("--RUN: ItsOpSigPhaseListener.run: {}, {} ms.", Thread.currentThread().getName(), totalTimeMillis);
+        }
 
         long delayMillis = delayMilliSeconds - totalTimeMillis;
         if (delayMillis < 0) {

+ 18 - 17
src/main/java/com/its/op/security/WebSecurityConfig.java

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

+ 2 - 2
src/main/java/com/its/op/websocket/ItsWebSocketSession.java

@@ -10,7 +10,7 @@ import org.springframework.web.socket.WebSocketSession;
 public class ItsWebSocketSession {
 
     private ItsWebSocketHandler itsWebsocketHandler;
-    private WebSocketSession session;
+    private final WebSocketSession session;
     private String groupId;
 
     public ItsWebSocketSession(ItsWebSocketHandler itsWebsocketHandler, org.springframework.web.socket.WebSocketSession session) {
@@ -20,7 +20,7 @@ public class ItsWebSocketSession {
 
     public void sendMessage(String command, TextMessage message) {
         synchronized (this.session) {
-            if (this.session != null && this.session.isOpen()) {
+            if (this.session.isOpen()) {
                 try {
                     this.session.sendMessage(message);
                 } catch (Exception e) {