12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- package com.its.op.security;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.security.core.Authentication;
- import org.springframework.security.core.context.SecurityContextHolder;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.servlet.ModelAndView;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- @Slf4j
- @Controller
- @RequestMapping("")
- public class WebController {
- private final String operContext = "forward:/application/op";
- private final String wallContext = "forward:/application/wall";
- private final String fcltContext = "forward:/application/facility";
- private final String dashBoardContext = "forward:/application/dashboard";
- private final String manualContext = "forward:/application/manual";
- /**
- * 로그인 화면 리다이렉션
- * @param request
- * @param response
- * @return
- */
- @GetMapping({"", "/", "/index.do", "/login.do"})
- public ModelAndView getLogin(HttpServletRequest request, HttpServletResponse response) {
- //log.info("getLogin1: {}", request);
- Authentication auth = SecurityContextHolder.getContext().getAuthentication();
- if(auth != null) {
- //log.info("getLogin2: {}", auth);
- return new ModelAndView("redirect:" + WebConstants.DEFAULT_URI);
- //new SecurityContextLogoutHandler().logout(request, response, auth);
- }
- return new ModelAndView("forward:" + WebConstants.LOGIN_PAGE_URI);
- //return new ModelAndView("forward:/api/auth/login.do");
- }
- /**
- * 시설물 관리 리다이렉션
- * @param request
- * @param response
- * @return
- */
- @GetMapping({"/facility", "/facility/", "/facility/index.do"})
- public ModelAndView facility(HttpServletRequest request, HttpServletResponse response) {
- return new ModelAndView(this.fcltContext + "/index.html");
- }
- /**
- * 상황판 리다이렉션
- * @param request
- * @param response
- * @return
- */
- @GetMapping({"/wall", "/wall/", "/wall/index.do"})
- public ModelAndView wall(HttpServletRequest request, HttpServletResponse response) {
- return new ModelAndView(this.wallContext + "/index.html");
- }
- /**
- * Dashboard 리다이렉션
- * @param request
- * @param response
- * @return
- */
- @GetMapping({"/dashboard", "/dashboard/", "/dashboard/dashboard.do"})
- public ModelAndView dashboard(HttpServletRequest request, HttpServletResponse response) {
- return new ModelAndView(this.dashBoardContext + "/index.html");
- }
- /**
- * 도움말 리다이렉션
- * @param request
- * @param response
- * @return
- */
- @GetMapping({"/manual", "/manual/", "/manual/manual.do"})
- public ModelAndView manual(HttpServletRequest request, HttpServletResponse response) {
- return new ModelAndView(this.manualContext + "/index.html");
- }
- }
|