├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── src
├── main
│ ├── resources
│ │ ├── static
│ │ │ ├── img
│ │ │ │ └── naver.ico
│ │ │ ├── css
│ │ │ │ └── app.css
│ │ │ └── js
│ │ │ │ └── app.js
│ │ ├── templates
│ │ │ ├── layout
│ │ │ │ ├── footer.mustache
│ │ │ │ └── header.mustache
│ │ │ ├── posts
│ │ │ │ ├── posts-page.mustache
│ │ │ │ ├── posts-write.mustache
│ │ │ │ ├── posts-update.mustache
│ │ │ │ ├── posts-search.mustache
│ │ │ │ └── posts-read.mustache
│ │ │ ├── comment
│ │ │ │ ├── form.mustache
│ │ │ │ └── list.mustache
│ │ │ ├── index.mustache
│ │ │ └── user
│ │ │ │ ├── user-login.mustache
│ │ │ │ ├── user-modify.mustache
│ │ │ │ └── user-join.mustache
│ │ └── application.properties
│ └── java
│ │ └── com
│ │ └── coco
│ │ └── board
│ │ ├── domain
│ │ ├── Role.java
│ │ ├── Posts.java
│ │ ├── Comment.java
│ │ ├── User.java
│ │ └── BaseTimeEntity.java
│ │ ├── application
│ │ ├── security
│ │ │ ├── auth
│ │ │ │ ├── LoginUser.java
│ │ │ │ ├── CustomUserDetailsService.java
│ │ │ │ ├── LoginUserArgumentResolver.java
│ │ │ │ ├── CustomUserDetails.java
│ │ │ │ └── CustomAuthFailureHandler.java
│ │ │ └── oauth
│ │ │ │ ├── OAuthAttributes.java
│ │ │ │ └── CustomOAuth2UserService.java
│ │ ├── validator
│ │ │ ├── AbstractValidator.java
│ │ │ └── CustomValidators.java
│ │ ├── UserService.java
│ │ ├── dto
│ │ │ ├── PostsDto.java
│ │ │ ├── CommentDto.java
│ │ │ └── UserDto.java
│ │ ├── CommentService.java
│ │ └── PostsService.java
│ │ ├── infrastructure
│ │ ├── persistence
│ │ │ ├── CommentRepository.java
│ │ │ ├── PostsRepository.java
│ │ │ └── UserRepository.java
│ │ └── config
│ │ │ ├── WebConfig.java
│ │ │ └── SecurityConfig.java
│ │ ├── BoardApplication.java
│ │ └── presentation
│ │ ├── PostsApiController.java
│ │ ├── UserApiController.java
│ │ ├── CommentApiController.java
│ │ ├── UserController.java
│ │ └── PostsIndexController.java
└── test
│ └── java
│ └── com
│ └── coco
│ └── board
│ ├── BoardApplicationTests.java
│ ├── infrastructure
│ └── config
│ │ └── SecurityConfigTest.java
│ ├── domain
│ ├── PostsRepositoryTest.java
│ ├── UserRepositoryTest.java
│ └── CommentRepositoryTest.java
│ ├── service
│ └── PostsServiceTest.java
│ └── controller
│ └── PostsApiControllerTest.java
├── .gitignore
├── gradlew.bat
├── gradlew
└── README.md
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'board'
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hojunnnnn/board/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/src/main/resources/static/img/naver.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hojunnnnn/board/HEAD/src/main/resources/static/img/naver.ico
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/src/test/java/com/coco/board/BoardApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.coco.board;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class BoardApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/coco/board/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.coco.board.domain;
2 |
3 | import lombok.Getter;
4 | import lombok.RequiredArgsConstructor;
5 |
6 | @Getter
7 | @RequiredArgsConstructor
8 | public enum Role {
9 | USER("ROLE_USER"),
10 | ADMIN("ROLE_ADMIN"),
11 | SOCIAL("ROLE_SOCIAL");
12 |
13 | private final String value;
14 | }
15 |
--------------------------------------------------------------------------------
/src/test/java/com/coco/board/infrastructure/config/SecurityConfigTest.java:
--------------------------------------------------------------------------------
1 | package com.coco.board.infrastructure.config;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
5 |
6 |
7 | public class SecurityConfigTest {
8 |
9 | @Test
10 | public void 해쉬_암호화() {
11 | String encodePassword = new BCryptPasswordEncoder().encode("1234");
12 | System.out.println("1234 해쉬 : " + encodePassword);
13 | }
14 | }
--------------------------------------------------------------------------------
/src/main/java/com/coco/board/application/security/auth/LoginUser.java:
--------------------------------------------------------------------------------
1 | package com.coco.board.application.security.auth;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * 세션 관련 중복코드 제거하기 위해 LoginUser 어노테이션 생성
10 | */
11 |
12 | @Target(ElementType.PARAMETER) // 파라미터로 선언된 객체만 사용
13 | @Retention(RetentionPolicy.RUNTIME) //런타임까지 남아있는다.
14 | public @interface LoginUser {
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/resources/templates/layout/footer.mustache:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
11 |