thymeleaf template change complate

dev_tymeleaf
jangwonseokicom 2 years ago
parent 43ad473107
commit a8ddf60848

Binary file not shown.

@ -4,5 +4,5 @@
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>

@ -1,6 +1,6 @@
plugins {
id 'org.springframework.boot' version '2.7.6'
id "org.sonarqube" version "2.7"
// id "org.sonarqube" version "2.7"
id 'io.spring.dependency-management' version '1.0.14.RELEASE'
id 'java'
id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
@ -9,7 +9,7 @@ plugins {
group = 'com.icom'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
//sourceCompatibility = '1.8'
/*
apply plugin: 'war'
configurations {
compileOnly {
@ -30,25 +30,34 @@ repositories {
}
}
}
*/
//repositories {
// mavenCentral()
// maven { url "https://maven.egovframe.go.kr/maven/" } // egovframe maven
//}
repositories {
mavenCentral()
}
/*
ext {
set('springCloudVersion', "2021.0.4")
set('log4j2.version', "2.17.1") // log4j
}
*/
ext {
set('springCloudVersion', "2021.0.4")
}
dependencies {
/*
implementation 'org.egovframe.cloud:module-common:0.1'
implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.0.0') {
exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
}
*/
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
implementation 'org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.4.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
@ -71,35 +80,36 @@ dependencies {
implementation 'com.querydsl:querydsl-sql-spring:5.0.0'
implementation 'com.querydsl:querydsl-sql-codegen:5.0.0'
implementation 'org.apache.tomcat:tomcat-jdbc:10.1.1'
implementation 'javax.servlet:javax.servlet-api'
// implementation 'javax.servlet:javax.servlet-api'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'org.apache.poi:poi:5.2.2'
implementation 'org.apache.poi:poi-ooxml:5.2.2'
implementation 'software.amazon.awssdk:s3:2.16.1'
//
implementation 'commons-codec:commons-codec:1.15'
implementation 'org.apache.commons:commons-text:1.8'
implementation 'org.apache.commons:commons-lang3:3.10'
implementation 'org.apache.poi:poi:5.2.2'
implementation 'org.apache.poi:poi-ooxml:5.2.2'
implementation 'org.apache.tomcat:tomcat-jdbc:10.1.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
//
// implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
// implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.4.5'
// testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.5'
// implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: '2.0.6'
//jsp
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
implementation 'javax.servlet:jstl'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
implementation 'net.jodah:expiringmap:0.5.9'
// implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
// implementation 'javax.servlet:jstl'
// providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
// testImplementation 'org.springframework.boot:spring-boot-starter-test'
// testImplementation 'org.springframework.security:spring-security-test'
// implementation 'net.jodah:expiringmap:0.5.9'
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
compileOnly 'org.projectlombok:lombok'
@ -132,6 +142,7 @@ dependencyManagement {
}
}
// querydsl
def querydslDir = "$buildDir/generated/querydsl"
//def querydslDir = "src/main/qfile"

@ -14,7 +14,7 @@ spring:
# url: jdbc:log4jdbc:oracle:thin:@localhost:1522:XE
# username: LG_LOCAL
# password: pass180901
owner: LG_LOCAL
owner: LG_LOCALqq
driver-class-name: net.sf.log4jdbc.DriverSpy
hikari:
connection-timeout: 60000

@ -50,6 +50,12 @@ spring:
jackson:
serialization:
fail-on-empty-beans: false
thymeleaf:
mode: HTML
cache: false
template-resolver-order: 0
check-template-location: true
autoconfigure:
# exclude: org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration

@ -9,7 +9,6 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@SpringBootApplication
@EnableFeignClients
@EnableWebMvc
public class MainVmApplication extends SpringBootServletInitializer {
public static void main(String[] args) {

@ -127,25 +127,25 @@ public class AdviceHandler {
return new ResponseEntity(er, HttpStatus.NOT_FOUND);
}
@ExceptionHandler
public String CustomNoSuchFieldException(NoSuchFieldException e) {
return "adm/signin/signin";
}
@ExceptionHandler
public String CustomNoSuchFieldException(CustomNoSuchFieldException e) {
return "adm/signin/signin";
}
@ExceptionHandler(NoHandlerFoundException.class)
public String noHandlerFoundHandle(NoHandlerFoundException e) {
return "cmm/error/egovError";
}
// @ExceptionHandler
// public String CustomNoSuchFieldException(NoSuchFieldException e) {
// return "adm/signin/signin";
// }
@ExceptionHandler
public ResponseEntity responseStatusException(ResponseStatusException e) {
return ResponseEntity.status(e.getStatus()).build();
}
// @ExceptionHandler
// public String CustomNoSuchFieldException(CustomNoSuchFieldException e) {
// return "adm/signin/signin";
// }
//
// @ExceptionHandler(NoHandlerFoundException.class)
// public String noHandlerFoundHandle(NoHandlerFoundException e) {
// return "cmm/error/egovError";
// }
//
// @ExceptionHandler
// public ResponseEntity responseStatusException(ResponseStatusException e) {
// return ResponseEntity.status(e.getStatus()).build();
// }
}

@ -13,9 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.time.LocalDate;
import java.time.LocalDateTime;

@ -12,7 +12,9 @@ import javax.servlet.http.HttpServletRequest;
@Controller
@Slf4j
@RequiredArgsConstructor
public class ErrorPageController implements ErrorController {
public class ErrorPageController
// implements ErrorController
{
private final HttpServletRequest httpServletRequest;
@ -22,18 +24,18 @@ public class ErrorPageController implements ErrorController {
Object status = httpServletRequest.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
log.info("error status - {}", status.toString());
if(status.equals("490")){
return "adm/signin/signin";
}
if(status.toString().equals("491")){
return "adm/signin/changePwd";
}
// if(status.equals("490")){
// return "adm/signin/signin";
// }
// if(status.toString().equals("491")){
// return "adm/signin/changePwd";
// }
// ModelMap mm = new ModelMap();
// ErrorResult er = new ErrorResult();
// er.setCode(status.toString());
// mm.addAttribute("errorResult", "aaa");
// return "adm/common/error";
return "adm/signin/signin";
return "/layout/signin";
}
}

@ -16,13 +16,12 @@ import com.icomsys.main_vm.biz.common.login.service.LoginService;
import com.icomsys.main_vm.common.code.MenuVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
@ -41,9 +40,10 @@ public class LoginController {
private final HttpServletRequest httpServletRequest;
@GetMapping(value = {"/adm/main/egovLoginUsr.do", "/"})
public String loginUsrView() {
loginService.Logout();
return "adm/signin/signin";
public ModelAndView loginUsrView() {
// loginService.Logout();
log.info("loginpage");
return new ModelAndView("/layout/signin");
}
@GetMapping(value = "/adm/main/changePwd")
@ -64,8 +64,10 @@ public class LoginController {
}
@RequestMapping(value = "/adm/main/actionSecurityLogin.do")
public String actionSecurityLogin(@Valid LoginReq loginReq, ModelMap model) {
return loginService.LoginValidService(loginReq, model);
public ModelAndView actionSecurityLogin(@Valid LoginReq loginReq, ModelMap model) {
log.info("actionlogin");
// return loginService.LoginValidService(loginReq, model);
return new ModelAndView(loginService.LoginValidService(loginReq, model));
}
@RequestMapping(value = "/adm/main/actionMain.do")

@ -32,6 +32,7 @@ public class SystemCommoncodeController {
@PostMapping("/oprmngcode/list")
@ResponseBody
public DslDataTableRes<SystemCommoncodeRes> SystemCommoncodeList(@RequestBody SystemCommoncodeReq dto) {
log.info("test!!!");
QueryResults<SystemCommoncodeRes> result = systemOprmngcodeService.SystemCommoncodeList(dto);
return new DslDataTableRes<SystemCommoncodeRes>(result);
}

@ -16,7 +16,6 @@ import com.icomsys.main_vm.db.jpa.repo.system.*;
import com.querydsl.core.QueryResults;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.stream.Streams;
import org.apache.el.lang.FunctionMapperImpl;
import org.apache.http.conn.HttpHostConnectException;
import org.springframework.beans.factory.annotation.Value;

@ -1,27 +1,19 @@
package com.icomsys.main_vm.biz.rcp.conversation.controller;
import com.google.gson.Gson;
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
import com.icomsys.main_vm.biz.advice.excep.CustomRuntimeException;
import com.icomsys.main_vm.biz.common.common.service.ExcelService;
import com.icomsys.main_vm.biz.rcp.conversation.dto.IntentRequestDTO;
import com.icomsys.main_vm.biz.rcp.conversation.service.IntentManageService;
import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectIntentListVo;
import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.ExcelIntentListVo;
import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.IntentSearchVo;
import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymListVo;
import com.icomsys.main_vm.common.code.enumresource.ActionResource;
import com.icomsys.main_vm.common.code.enumresource.MenuResource;
import com.icomsys.main_vm.db.jpa.repo.system.TbIntentMasterRepo;
import com.icomsys.main_vm.db.mybatis.alias.LoginVO;
import com.querydsl.core.QueryResults;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -32,11 +24,8 @@ import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller

@ -11,30 +11,21 @@ import com.icomsys.main_vm.biz.rcp.monitoring.vo.ConsultingVO;
import com.icomsys.main_vm.biz.rcp.monitoring.vo.RecordDownloadVO;
import com.icomsys.main_vm.common.code.enumresource.ActionResource;
import com.icomsys.main_vm.common.code.enumresource.MenuResource;
import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymMaster;
import com.icomsys.main_vm.db.mybatis.alias.MonitoringConsultingVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URI;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

@ -1,10 +1,7 @@
package com.icomsys.main_vm.biz.rcp.oprManage.service;
import com.icomsys.main_vm.biz.common.common.service.LogService;
import com.icomsys.main_vm.biz.common.common.service.LogVO;
import com.icomsys.main_vm.biz.common.system.vo.SystemBotTtsTagVo;
import com.icomsys.main_vm.common.code.enumresource.ActionResource;
import com.icomsys.main_vm.common.code.enumresource.MenuResource;
import com.icomsys.main_vm.db.jpa.entity.oprManage.TbBotTtsTag;
import com.icomsys.main_vm.db.jpa.repo.oprManage.TbBotTtsTagRepo;
import com.icomsys.main_vm.db.mybatis.alias.LoginVO;

@ -1,13 +1,8 @@
package com.icomsys.main_vm.biz.test.controller;
import aj.org.objectweb.asm.TypeReference;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.google.gson.*;
import com.google.gson.Gson;
import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException;
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
import com.icomsys.main_vm.biz.common.common.service.LogVO;
import com.icomsys.main_vm.biz.common.common.service.RestTemplateService;
import com.icomsys.main_vm.biz.common.common.service.SequenceService;
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
@ -15,7 +10,6 @@ import com.icomsys.main_vm.biz.common.login.res.ServiceGroupRes;
import com.icomsys.main_vm.biz.common.login.res.UserVo;
import com.icomsys.main_vm.biz.common.system.service.SystemServiceGroupService;
import com.icomsys.main_vm.biz.common.system.vo.*;
import com.icomsys.main_vm.biz.test.controller.testvo.APINodeVo;
import com.icomsys.main_vm.common.code.EnumToMap;
import com.icomsys.main_vm.common.code.MenuVo;
import com.icomsys.main_vm.common.code.enumresource.MenuResource;
@ -31,7 +25,6 @@ import com.querydsl.core.QueryResults;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.usermodel.*;
import org.json.JSONObject;
import org.modelmapper.ModelMapper;
@ -42,20 +35,16 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.net.URI;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

@ -8,7 +8,8 @@ import java.util.List;
@Getter
public enum MenuResource {
root("common", 1L, 0L, 1, "대쉬보드", "대쉬보드", "/admin/common/dashboard/manage.do"),
// root("common", 1L, 0L, 1, "대쉬보드", "대쉬보드", "/admin/common/dashboard/manage.do"),
root("common", 1L, 0L, 1, "대쉬보드", "대쉬보드", "/layout/adm/common/dashboard"),
// root("common", 1L, 0L, 1, "대쉬보드", "대쉬보드", "0"),
rcpconversation("rcp", 1800000L, 1L, 2, "대화관리", "대화관리", "0"),
rcpconversationintentmanage("rcp", 1800001L, 1800000L, 3, "인텐트관리", "인텐트관리", "/admin/rcp/conversation/intent/manage.do"),

@ -1,13 +1,17 @@
package com.icomsys.main_vm.common.config;
import lombok.extern.slf4j.Slf4j;
import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import org.springframework.web.servlet.view.JstlView;
@ -16,12 +20,15 @@ import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
import org.springframework.web.client.RestTemplate;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.apache.http.client.HttpClient;
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
@Configuration
@Slf4j
public class ConfigMvc extends WebMvcConfigurationSupport {
public class ConfigMvc implements WebMvcConfigurer {
@Value("${file.path}")
private String filePath;
@ -30,33 +37,32 @@ public class ConfigMvc extends WebMvcConfigurationSupport {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// @Override
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
/*
Path path = Paths.get(filePath).toAbsolutePath().normalize();
String patsString = path.toString();
log.info("path = {}",path);
log.info("pathString = {}",patsString);
*/
registry.addResourceHandler("/**","/img/**")
.addResourceLocations("/");
// registry.addResourceHandler("/**","/img/**")
// .addResourceLocations("/");
// .addResourceLocations("file:///"+patsString+"/");
registry.addResourceHandler("/files/**").addResourceLocations("file:/logs/was/aicb/cinnamon_ui/files/");
}
// registry.addResourceHandler("/files/**").addResourceLocations("file:/logs/was/aicb/cinnamon_ui/files/");
// }
@Override
public void addViewControllers(ViewControllerRegistry registry) {
// @Override
// public void addViewControllers(ViewControllerRegistry registry) {
// registry.addViewController("/**/*.do").setViewName("redirect:/adm/main/egovLoginUsr.do");
// registry.addViewController("/").setViewName("redirect:/adm/main/egovLoginUsr.do");
// registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
// }
// @Override
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
// registry.addResourceHandler("/**").addResourceLocations("/");
// }
/*
@Bean
public UrlBasedViewResolver urlBasedViewResolver() {
UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
@ -78,14 +84,14 @@ public class ConfigMvc extends WebMvcConfigurationSupport {
interceptor.setParamName("language");
return interceptor;
}
*/
@Bean
public MappingJackson2JsonView jsonView() {
MappingJackson2JsonView jackson2JsonView = new MappingJackson2JsonView();
// jackson2JsonView.setContentType("\"text/html;charset=UTF-8\"");
return jackson2JsonView;
}
/*
// @Override
// public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
// Properties prop = new Properties();
@ -109,7 +115,7 @@ public class ConfigMvc extends WebMvcConfigurationSupport {
// smer.setStatusCodes(statusCode);
// exceptionResolvers.add(smer);
// }
*/
@Bean
@ -124,4 +130,56 @@ public class ConfigMvc extends WebMvcConfigurationSupport {
return new RestTemplate(factory);
}
//
// @Value("${spring.thymeleaf.cache}")
// private boolean isCache;
// @Value("${spring.thymeleaf.template-resolver-order}")
// private int order;
// @Value("${spring.thymeleaf.mode}")
// private String mode;
// //
// @Bean
// public SpringResourceTemplateResolver templateResolver() {
// SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver ();
//// templateResolver.setPrefix("classpath:webapp/WEB-INF/templates/");
// templateResolver.setPrefix("classpath:templates/");
// templateResolver.setCharacterEncoding("UTF-8");
// templateResolver.setSuffix(".html");
// templateResolver.setTemplateMode(mode);
// templateResolver.setCacheable(isCache);
// templateResolver.setOrder(order);
// return templateResolver;
// }
//
// @Bean
// public SpringTemplateEngine templateEngine(MessageSource messageSource) {
// SpringTemplateEngine templateEngine = new SpringTemplateEngine();
// templateEngine.setTemplateResolver(templateResolver());
// templateEngine.setTemplateEngineMessageSource(messageSource);
// templateEngine.addDialect(layoutDialect());
// templateEngine.addDialect(new Java8TimeDialect());
//
// return templateEngine;
// }
//
// @Bean
// public LayoutDialect layoutDialect() {
// return new LayoutDialect();
// }
//
// @Bean
// public ViewResolver viewResolver(MessageSource messageSource) {
// ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
// viewResolver.setTemplateEngine(templateEngine(messageSource));
// viewResolver.setCharacterEncoding("UTF-8");
// viewResolver.setOrder(order);
// return viewResolver;
// }
//
// @Bean
// public Java8TimeDialect java8TimeDialect(){
// return new Java8TimeDialect();
// }
}

@ -26,21 +26,20 @@ public class ConfigSecurity {
private final ObjectMapper objectMapper;
private final CustomUserDetailsService customUserDetailsService;
private final LoginFilter loginFilter;
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public WebSecurityCustomizer configure() {
return (web) -> web.ignoring().mvcMatchers(
// "/v3/api-docs/**", // doc용
// "/swagger-ui/**", //스웨거
"/ws/**", // 테스트API,
"/login",
"/logout"
);
}
// @Bean
// public WebSecurityCustomizer configure() {
// return (web) -> web.ignoring().mvcMatchers(
//// "/v3/api-docs/**", // doc용
//// "/swagger-ui/**", //스웨거
// "/**"
// );
// }
// @Bean
// public AuthTokenFilter authenticationJwtTokenFilter() {
@ -56,6 +55,41 @@ public class ConfigSecurity {
authenticationManagerBuilder.userDetailsService(customUserDetailsService).passwordEncoder(passwordEncoder());
}
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http.csrf().disable()
.exceptionHandling()
// .authenticationEntryPoint(authenticationEntryPoint)
// .accessDeniedHandler(accessDeniedHandler)
// exception handling 할 때 우리가 만든 클래스를 추가
// h2-console 을 위한 설정을 추가
.and()
.headers()
// .frameOptions()
// .sameOrigin()
// 시큐리티는 기본적으로 세션을 사용
// 여기서는 세션을 사용하지 않기 때문에 세션 설정을 Stateless 로 설정
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
// .successHandler(authenticationEntryPoint)
// 로그인, 회원가입 API 는 토큰이 없는 상태에서 요청이 들어오기 때문에 permitAll 설정
.authorizeRequests()
.and()
.logout()
.invalidateHttpSession(true)
.deleteCookies("JSESSIONID", "jsessionid")
.permitAll()
.and()
.addFilterBefore(loginFilter, UsernamePasswordAuthenticationFilter.class)
.build()
// JwtFilter 를 addFilterBefore 로 등록했던 JwtSecurityConfig 클래스를 적용
// .and()
;
}
/*
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http.antMatcher("/**")
@ -88,17 +122,7 @@ public class ConfigSecurity {
.addFilterBefore(loginFilter, UsernamePasswordAuthenticationFilter.class)
.build();
}
// @Bean
// public WebMvcConfigurer corsConfigurer() {
// return new WebMvcConfigurer() {
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**")
// .allowedMethods("*");
// }
// };
// }
*/
}

@ -0,0 +1,68 @@
package com.icomsys.main_vm.common.config;
import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
@Configuration
public class ConfigThymeleafViewResolver {
@Value("${spring.thymeleaf.cache}")
private boolean isCache;
@Value("${spring.thymeleaf.template-resolver-order}")
private int order;
@Value("${spring.thymeleaf.mode}")
private String mode;
//
@Bean
public SpringResourceTemplateResolver templateResolver() {
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
// templateResolver.setPrefix("classpath:webapp/WEB-INF/templates/");
templateResolver.setPrefix("classpath:templates");
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode(mode);
templateResolver.setCacheable(isCache);
templateResolver.setOrder(order);
return templateResolver;
}
@Bean
public SpringTemplateEngine templateEngine(MessageSource messageSource) {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
templateEngine.setTemplateEngineMessageSource(messageSource);
templateEngine.addDialect(layoutDialect());
templateEngine.addDialect(new Java8TimeDialect());
return templateEngine;
}
@Bean
public LayoutDialect layoutDialect() {
return new LayoutDialect();
}
@Bean
public ViewResolver viewResolver(MessageSource messageSource) {
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
viewResolver.setTemplateEngine(templateEngine(messageSource));
viewResolver.setCharacterEncoding("UTF-8");
viewResolver.setOrder(order);
return viewResolver;
}
@Bean
public Java8TimeDialect java8TimeDialect() {
return new Java8TimeDialect();
}
}

@ -40,25 +40,14 @@ public class LoginFilter extends OncePerRequestFilter {
// String reqUrl = request.getRequestURI().toString().replaceAll(context, "");
String reqUrl = request.getRequestURI();
// log.info("meyhod-"+ reqUrl+ request.getMethod());
// log.info("필터 요청유알엘 - {}, {}", reqUrl);
log.info("필터 요청유알엘 - {}", reqUrl);
if (reqUrl.startsWith("/re1")){
response.sendError(490);
return;
}
if (reqUrl.startsWith("/re2")){
response.sendError(491);
return;
}
if (reqUrl.startsWith("/lib")
if (reqUrl.startsWith("/ws")
|| reqUrl.startsWith("/lib")
|| reqUrl.startsWith("/css")
|| reqUrl.startsWith("/images")
|| reqUrl.startsWith("/js")
|| reqUrl.startsWith("/adm")
|| reqUrl.startsWith("/ws")
|| reqUrl.startsWith("/adm/")
|| reqUrl.startsWith("/rest")
|| reqUrl.startsWith("/create")
|| reqUrl.startsWith("/data")
@ -67,43 +56,11 @@ public class LoginFilter extends OncePerRequestFilter {
|| reqUrl.startsWith("/files")
|| reqUrl.equals("/")
) {
log.info("static file check");
filterChain.doFilter(request, response);
} else {
if (request.getSession().getAttribute(SessionResource.UserVO.getName()) == null || request.getSession().getAttribute(SessionResource.UserVO.getName()).equals("")) {
log.info("session Check");
response.sendError(490);
return;
} else {
log.info("Permission Check");
//세션이 있으면 URL별 권한 확인.
//ajax로 호출되는 url은 auth메뉴에 리스트업이 안되있어서 검사를 어떻게할지 계획이 필요함.
// LoginVO loginVO = (LoginVO) request.getSession().getAttribute("LoginVO");
// List<String> auths =
// if(!tbBotMenuRepo.findByMenuNoInOrderByMenuNoAsc(tbBotAuthMenuRepo.findByAuthCode(loginVO.getAuthCode())
// .stream().map(e -> e.getMenuNo())
// .collect(Collectors.toList()))
// .stream()
// .map(f -> f.getUrlPath())
// .collect(Collectors.toList())
// .contains(reqUrl)){
// wrapResponse.sendRedirect("adm/main/egovLoginUsr.do");
// }
// log.info("auths - {}", new Gson().toJson(auths));
//
// for (String e : auths) {
// if (e != null && !e.equals("") && !e.equals("null") && e.equals(reqUrl)) {
// chk+=1;
// break;
// }
// }
// if(chk == 0){
// wrapResponse.setStatus(404);
// wrapResponse.sendRedirect("adm/main/egovLoginUsr.do");
// }
filterChain.doFilter(request, response);
}
}
// response.copyBodyToResponse();
}
}

@ -14,7 +14,7 @@ spring:
# url: jdbc:log4jdbc:oracle:thin:@localhost:1522:XE
# username: LG_LOCAL
# password: pass180901
owner: LG_LOCAL
owner: LG_LOCALqq
driver-class-name: net.sf.log4jdbc.DriverSpy
hikari:
connection-timeout: 60000

@ -50,6 +50,12 @@ spring:
jackson:
serialization:
fail-on-empty-beans: false
thymeleaf:
mode: HTML
cache: false
template-resolver-order: 0
check-template-location: true
autoconfigure:
# exclude: org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration

@ -288,22 +288,22 @@
<a href="#">대화관리</a>
<ul class="depth2">
<li class="has_children">
<a href="./intent.html"><span>인텐트 관리</span></a>
<a href="intent.html"><span>인텐트 관리</span></a>
</li>
<li class="has_children">
<a href="./slot.html"><span>슬롯 관리</span></a>
<a href="slot.html"><span>슬롯 관리</span></a>
</li>
<li class="has_children">
<a href="./scenario.html"><span>시나리오 관리</span></a>
<a href="scenario.html"><span>시나리오 관리</span></a>
</li>
<li class="has_children">
<a href="./synonym.html"><span>동의어 관리</span></a>
<a href="synonym.html"><span>동의어 관리</span></a>
</li>
<li class="has_children">
<a href="./systemEntity.html"><span>시스템 엔티티</span></a>
<a href="systemEntity.html"><span>시스템 엔티티</span></a>
</li>
<li class="has_children">
<a href="./dictionary.html" class="on"><span>사전 관리</span></a>
<a href="dictionary.html" class="on"><span>사전 관리</span></a>
</li>
</ul>
</li>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save