Commit cb01f7b11d6f2fe2cd5cf48d1e5a2bb0379f6c31
1 parent
6f22ff1b
.
Showing
24 changed files
with
42 additions
and
77 deletions
Show diff stats
src/main/java/com/daeucna/board/BoardApplication.java
... | ... | @@ -2,8 +2,6 @@ package com.daeucna.board; |
2 | 2 | |
3 | 3 | import org.springframework.boot.SpringApplication; |
4 | 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
5 | -import org.springframework.boot.builder.SpringApplicationBuilder; | |
6 | -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | |
7 | 5 | |
8 | 6 | @SpringBootApplication |
9 | 7 | public class BoardApplication { | ... | ... |
src/main/java/com/daeucna/board/common/FileDownloadUtil.java
... | ... | @@ -5,11 +5,10 @@ import java.io.FileInputStream; |
5 | 5 | import java.io.OutputStream; |
6 | 6 | import java.net.URLEncoder; |
7 | 7 | import java.util.Map; |
8 | - | |
8 | + | |
9 | 9 | import javax.servlet.http.HttpServletRequest; |
10 | 10 | import javax.servlet.http.HttpServletResponse; |
11 | 11 | |
12 | -import org.springframework.stereotype.Component; | |
13 | 12 | import org.springframework.util.FileCopyUtils; |
14 | 13 | import org.springframework.web.servlet.view.AbstractView; |
15 | 14 | ... | ... |
src/main/java/com/daeucna/board/config/DataSourceConfig.java
... | ... | @@ -2,19 +2,17 @@ package com.daeucna.board.config; |
2 | 2 | |
3 | 3 | import javax.sql.DataSource; |
4 | 4 | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | 5 | import org.apache.ibatis.session.SqlSessionFactory; |
7 | 6 | import org.mybatis.spring.SqlSessionFactoryBean; |
8 | 7 | import org.mybatis.spring.SqlSessionTemplate; |
9 | -import org.mybatis.spring.annotation.MapperScan; | |
10 | 8 | import org.springframework.boot.context.properties.ConfigurationProperties; |
11 | 9 | import org.springframework.boot.jdbc.DataSourceBuilder; |
12 | 10 | import org.springframework.context.ApplicationContext; |
13 | 11 | import org.springframework.context.annotation.Bean; |
14 | 12 | import org.springframework.context.annotation.ComponentScan; |
13 | +import org.springframework.context.annotation.ComponentScan.Filter; | |
15 | 14 | import org.springframework.context.annotation.Configuration; |
16 | 15 | import org.springframework.context.annotation.FilterType; |
17 | -import org.springframework.context.annotation.ComponentScan.Filter; | |
18 | 16 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
19 | 17 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
20 | 18 | import org.springframework.transaction.PlatformTransactionManager; | ... | ... |
src/main/java/com/daeucna/board/config/WebMvcConfig.java
... | ... | @@ -9,24 +9,12 @@ import org.springframework.context.annotation.FilterType; |
9 | 9 | import org.springframework.http.MediaType; |
10 | 10 | import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
11 | 11 | import org.springframework.http.converter.xml.MarshallingHttpMessageConverter; |
12 | -import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
13 | 12 | import org.springframework.oxm.jaxb.Jaxb2Marshaller; |
14 | -import org.springframework.stereotype.Component; | |
15 | -import org.springframework.stereotype.Controller; | |
16 | -import org.springframework.stereotype.Repository; | |
17 | -import org.springframework.stereotype.Service; | |
18 | -import org.springframework.transaction.PlatformTransactionManager; | |
19 | -import org.springframework.web.bind.annotation.ControllerAdvice; | |
20 | -import org.springframework.web.multipart.commons.CommonsMultipartResolver; | |
21 | 13 | import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; |
22 | 14 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
23 | -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | |
24 | 15 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; |
25 | -import org.springframework.web.servlet.config.annotation.ViewResolverRegistry; | |
26 | 16 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
27 | -import org.springframework.web.servlet.view.BeanNameViewResolver; | |
28 | 17 | |
29 | -import com.daeucna.board.common.FileDownloadUtil; | |
30 | 18 | import com.daeucna.board.interceptor.BaseInterceptor; |
31 | 19 | import com.fasterxml.jackson.databind.DeserializationFeature; |
32 | 20 | import com.fasterxml.jackson.databind.ObjectMapper; | ... | ... |
src/main/java/com/daeucna/board/dao/BoardDao.java
1 | 1 | package com.daeucna.board.dao; |
2 | 2 | |
3 | 3 | import java.util.List; |
4 | - | |
4 | + | |
5 | 5 | import javax.annotation.Resource; |
6 | - | |
6 | + | |
7 | 7 | import org.apache.ibatis.session.SqlSession; |
8 | -import org.springframework.beans.factory.annotation.Autowired; | |
9 | 8 | import org.springframework.stereotype.Repository; |
10 | 9 | |
11 | 10 | import com.daeucna.board.domain.BoardDto; | ... | ... |
src/main/java/com/daeucna/board/interceptor/BaseInterceptor.java
... | ... | @@ -3,23 +3,22 @@ package com.daeucna.board.interceptor; |
3 | 3 | import javax.servlet.http.HttpServletRequest; |
4 | 4 | import javax.servlet.http.HttpServletResponse; |
5 | 5 | |
6 | -import org.slf4j.Logger; | |
7 | -import org.slf4j.LoggerFactory; | |
8 | 6 | import org.springframework.web.servlet.HandlerInterceptor; |
9 | 7 | import org.springframework.web.servlet.ModelAndView; |
8 | + | |
9 | +import lombok.extern.slf4j.Slf4j; | |
10 | 10 | |
11 | +@Slf4j | |
11 | 12 | public class BaseInterceptor implements HandlerInterceptor { |
12 | 13 | |
13 | - private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |
14 | - | |
15 | 14 | @Override |
16 | 15 | public boolean preHandle( HttpServletRequest request |
17 | 16 | , HttpServletResponse response |
18 | 17 | , Object handler ) throws Exception { |
19 | 18 | |
20 | - if (logger.isDebugEnabled()) { | |
21 | - logger.debug("===== ===== ===== ===== ===== START ===== ===== ===== ===== ====="); | |
22 | - logger.debug("RequestURI:[{}]", request.getRequestURI()); | |
19 | + if (log.isDebugEnabled()) { | |
20 | + log.debug("===== ===== ===== ===== ===== START ===== ===== ===== ===== ====="); | |
21 | + log.debug("RequestURI:[{}]", request.getRequestURI()); | |
23 | 22 | } |
24 | 23 | |
25 | 24 | return true; |
... | ... | @@ -31,8 +30,8 @@ public class BaseInterceptor implements HandlerInterceptor { |
31 | 30 | , Object handler |
32 | 31 | , ModelAndView modelAndView ) throws Exception { |
33 | 32 | |
34 | - if (logger.isDebugEnabled()) { | |
35 | - logger.debug("===== ===== ===== ===== ===== END ===== ===== ===== ===== =====\n"); | |
33 | + if (log.isDebugEnabled()) { | |
34 | + log.debug("===== ===== ===== ===== ===== END ===== ===== ===== ===== =====\n"); | |
36 | 35 | } |
37 | 36 | } |
38 | 37 | ... | ... |
src/main/java/com/daeucna/board/security/CustomAuthenticationFailureHandler.java
... | ... | @@ -18,6 +18,7 @@ public class CustomAuthenticationFailureHandler implements AuthenticationFailure |
18 | 18 | |
19 | 19 | @Override |
20 | 20 | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { |
21 | + log.info("Authentication Failure"); | |
21 | 22 | response.sendRedirect(request.getContextPath() + "/"); |
22 | 23 | } |
23 | 24 | ... | ... |
src/main/java/com/daeucna/board/security/CustomAuthenticationSuccessHandler.java
... | ... | @@ -22,6 +22,7 @@ public class CustomAuthenticationSuccessHandler implements AuthenticationSuccess |
22 | 22 | HttpSession session = request.getSession(); |
23 | 23 | session.setMaxInactiveInterval(60); |
24 | 24 | session.setAttribute("authentication", authentication); |
25 | + log.info("Authentication Success"); | |
25 | 26 | response.sendRedirect(request.getContextPath() + "/"); |
26 | 27 | } |
27 | 28 | ... | ... |
src/main/java/com/daeucna/board/security/CustomLoadUserByUsername.java
... | ... | @@ -27,8 +27,12 @@ public class CustomLoadUserByUsername implements UserDetailsService{ |
27 | 27 | UserDto user = null; |
28 | 28 | try { |
29 | 29 | user = userDao.getOne(userForm); |
30 | - if(user == null) throw new UsernameNotFoundException("Not Found User"); | |
31 | - } catch (Exception e) { | |
30 | + if(user == null) { | |
31 | + log.warn("Not Found User"); | |
32 | + throw new UsernameNotFoundException("Not Found User"); | |
33 | + } | |
34 | + } catch (Exception e) { | |
35 | + log.error("Not Found User Error"); | |
32 | 36 | throw new UsernameNotFoundException("Not Found User(Error)"); |
33 | 37 | } |
34 | 38 | return user; | ... | ... |
src/main/java/com/daeucna/board/security/controller/LoginController.java
... | ... | @@ -54,6 +54,7 @@ public class LoginController { |
54 | 54 | return "page/login/join"; |
55 | 55 | } |
56 | 56 | |
57 | + @SuppressWarnings({ "rawtypes", "unchecked" }) | |
57 | 58 | @PostMapping("/join_proc") |
58 | 59 | @ResponseBody |
59 | 60 | public ResponseEntity procJoin(HttpServletRequest request, HttpServletResponse response, UserForm userForm) { | ... | ... |
src/main/java/com/daeucna/board/security/domain/UserDto.java
... | ... | @@ -4,7 +4,6 @@ import java.util.ArrayList; |
4 | 4 | import java.util.Collection; |
5 | 5 | import java.util.List; |
6 | 6 | |
7 | -import org.springframework.security.core.Authentication; | |
8 | 7 | import org.springframework.security.core.GrantedAuthority; |
9 | 8 | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
10 | 9 | import org.springframework.security.core.userdetails.UserDetails; |
... | ... | @@ -16,6 +15,8 @@ import lombok.ToString; |
16 | 15 | @ToString |
17 | 16 | public class UserDto implements UserDetails { |
18 | 17 | |
18 | + private static final long serialVersionUID = -8756513459420668339L; | |
19 | + | |
19 | 20 | String ROLE_PREFIX = "ROLE_"; |
20 | 21 | |
21 | 22 | private String id; | ... | ... |
src/main/java/com/daeucna/board/security/service/LoginService.java
1 | 1 | package com.daeucna.board.security.service; |
2 | 2 | |
3 | -import java.io.File; | |
4 | -import java.util.ArrayList; | |
5 | -import java.util.HashMap; | |
6 | -import java.util.List; | |
7 | -import java.util.UUID; | |
8 | - | |
9 | -import org.slf4j.Logger; | |
10 | -import org.slf4j.LoggerFactory; | |
11 | 3 | import org.springframework.beans.factory.annotation.Autowired; |
12 | 4 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
13 | 5 | import org.springframework.stereotype.Service; |
14 | 6 | import org.springframework.transaction.annotation.Propagation; |
15 | 7 | import org.springframework.transaction.annotation.Transactional; |
16 | -import org.springframework.web.multipart.MultipartFile; | |
17 | 8 | |
18 | -import com.daeucna.board.common.PagingUtil; | |
19 | -import com.daeucna.board.common.ResultUtil; | |
20 | -import com.daeucna.board.dao.BoardDao; | |
21 | -import com.daeucna.board.domain.BoardDto; | |
22 | -import com.daeucna.board.domain.BoardFileForm; | |
23 | -import com.daeucna.board.domain.BoardForm; | |
24 | -import com.daeucna.board.domain.CommonDto; | |
25 | -import com.daeucna.board.domain.CommonForm; | |
26 | 9 | import com.daeucna.board.security.dao.UserDao; |
27 | -import com.daeucna.board.security.domain.UserDto; | |
28 | 10 | import com.daeucna.board.security.domain.UserForm; |
11 | + | |
12 | +import lombok.extern.slf4j.Slf4j; | |
29 | 13 | |
14 | +@Slf4j | |
30 | 15 | @Transactional(readOnly = true) |
31 | 16 | @Service |
32 | 17 | public class LoginService { |
33 | 18 | |
34 | - protected final Logger logger = LoggerFactory.getLogger(LoginService.class); | |
35 | - | |
36 | 19 | @Autowired |
37 | 20 | private UserDao userDao; |
38 | 21 | @Autowired |
... | ... | @@ -52,7 +35,7 @@ public class LoginService { |
52 | 35 | } else { |
53 | 36 | userForm.setResult("FAIL"); |
54 | 37 | } |
55 | - | |
38 | + log.info("사용자등록 완료"); | |
56 | 39 | return userForm; |
57 | 40 | } |
58 | 41 | ... | ... |
src/main/resources/templates/fragment/config.html
src/main/resources/templates/fragment/configNoCustom.html
src/main/resources/templates/fragment/footer.html
src/main/resources/templates/fragment/header.html
1 | -<html lagn="ko" | |
2 | - xmlns:th="http://www.thymeleaf.org"> | |
1 | +<html xmlns:th="http://www.thymeleaf.org"> | |
3 | 2 | |
4 | 3 | <!--headerFragment 선언--> |
5 | 4 | <div th:fragment="headerFragment" style="height: 4em;text-align: center;"> |
6 | 5 | <div class="shadow-sm p-3 mb-5 bg-body rounded" style="height: 3.4rem;"> |
7 | 6 | <div style="text-align: left; float: left;"> |
8 | - <button type="button" class="btn btn-outline-dark"><a th:href="@{/board/boardList?boardName=maintenance}">유지보수</a></button> | |
9 | - <button type="button" class="btn btn-outline-dark"><a th:href="@{/board/boardList?boardName=etc}">기타</a></button> | |
7 | + <a th:href="@{/board/boardList?boardName=maintenance}"><button type="button" class="btn btn-outline-dark">유지보수</button></a> | |
8 | + <a th:href="@{/board/boardList?boardName=etc}"><button type="button" class="btn btn-outline-dark">기타</button></a> | |
10 | 9 | </div> |
11 | 10 | <div style="text-align: right; float: right;"> |
12 | 11 | <form class="d-flex" th:action="@{/logout}"> | ... | ... |
src/main/resources/templates/layout/default_layout.html
src/main/resources/templates/layout/oneDoc_layout.html
src/main/resources/templates/page/boardDetail.html
src/main/resources/templates/page/boardList.html
... | ... | @@ -148,7 +148,7 @@ |
148 | 148 | <span class="total_count"><strong>전체</strong> : <span id="total_count" class="t_red">0</span>개</span> |
149 | 149 | </div> |
150 | 150 | |
151 | - <table width="100%" class="table01"> | |
151 | + <table style="width: 100%" class="table01"> | |
152 | 152 | <colgroup> |
153 | 153 | <col width="7%" /> |
154 | 154 | <col width="25%" /> | ... | ... |
src/main/resources/templates/page/boardReply.html
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | <h2>신규작성</h2> |
88 | 88 | <form id="boardForm" name="boardForm"> |
89 | 89 | <input type="hidden" id="board_parent_seq" name="board_parent_seq" th:value="${#request.getParameter('boardSeq')}"/> <!-- 부모 게시글 번호 --> |
90 | - <table width="100%" class="table02"> | |
90 | + <table style="width: 100%" class="table02"> | |
91 | 91 | <caption><strong><span class="t_red">*</span> 표시는 필수입력 항목입니다.</strong></caption> |
92 | 92 | <colgroup> |
93 | 93 | <col width="20%"> | ... | ... |
src/main/resources/templates/page/boardUpdate.html
... | ... | @@ -209,7 +209,7 @@ |
209 | 209 | <div class="inner"> |
210 | 210 | <h2>상세내역</h2> |
211 | 211 | <form id="boardForm" name="boardForm" action="/board/updateBoard" enctype="multipart/form-data" method="post" onsubmit="return false;"> |
212 | - <table width="100%" class="table02"> | |
212 | + <table style="width: 100%" class="table02"> | |
213 | 213 | <caption><strong><span class="t_red">*</span> 표시는 필수입력 항목입니다.</strong></caption> |
214 | 214 | <colgroup> |
215 | 215 | <col width="20%"> | ... | ... |
src/main/resources/templates/page/boardWrite.html
... | ... | @@ -90,7 +90,7 @@ |
90 | 90 | <div class="inner"> |
91 | 91 | <h2>신규작성</h2> |
92 | 92 | <form id="boardForm" name="boardForm" action="[[@{/}]]board/insertBoard" enctype="multipart/form-data" method="post" onsubmit="return false;"> |
93 | - <table width="100%" class="table02"> | |
93 | + <table style="width: 100%" class="table02"> | |
94 | 94 | <caption><strong><span class="t_red">*</span> 표시는 필수입력 항목입니다.</strong></caption> |
95 | 95 | <colgroup> |
96 | 96 | <col width="20%"> | ... | ... |
src/main/resources/templates/page/login/join.html
... | ... | @@ -128,7 +128,7 @@ |
128 | 128 | <input type="checkbox" class="custom-control-input" id="aggrement" required /> |
129 | 129 | <label class="custom-control-label" for="aggrement">개인정보 수집 및 이용에 동의합니다.</label> |
130 | 130 | </div> |
131 | - <div class="mb-4" /> | |
131 | + <hr class="mb-4" /> | |
132 | 132 | <button class="form-control btn btn-primary btn-lg btn-block" id="btnJoin">가입 완료</button> |
133 | 133 | </form> |
134 | 134 | </div> | ... | ... |