Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
378 commits
Select commit Hold shift + click to select a range
639e13b
fix user entity
jun3327 Jan 24, 2024
b7d4eb7
feat jwt refreshtoken
jun3327 Feb 1, 2024
f82debb
feat jwt refreshtoken
jun3327 Feb 1, 2024
064abc7
feat send friend request
jun3327 Feb 1, 2024
53293a9
feat send friend request
jun3327 Feb 1, 2024
aa4f7a9
feat add friend
jun3327 Feb 1, 2024
31b191d
feat add friend
jun3327 Feb 1, 2024
869ef62
fix delete friend
jun3327 Feb 1, 2024
c7fbb57
fix delete friend
jun3327 Feb 1, 2024
1b270f2
fix oauth login controller
jun3327 Feb 2, 2024
604dd80
fix oauth login controller
jun3327 Feb 2, 2024
95d83f8
Like, Post 수정
RyuJiye Feb 2, 2024
437e75e
Like, Post 수정
RyuJiye Feb 2, 2024
231bda2
PostController수정
RyuJiye Feb 2, 2024
af4d39a
PostController수정
RyuJiye Feb 2, 2024
3175601
fix remove println
jun3327 Feb 2, 2024
0c5b3bc
fix remove println
jun3327 Feb 2, 2024
3fe7424
fix oauthproperties
jun3327 Feb 2, 2024
b9fab64
Merge remote-tracking branch 'origin/main'
RyuJiye Feb 2, 2024
c5d84ba
Merge remote-tracking branch 'origin/main'
RyuJiye Feb 2, 2024
3f5d7a8
Merge branch 'main' into KimHwanJun
jun3327 Feb 2, 2024
50ce37c
Merge branch 'main' into KimHwanJun
jun3327 Feb 2, 2024
70cd86a
Merge pull request #4 from B612-TEAM2/KimHwanJun
jun3327 Feb 2, 2024
0a857b0
Merge pull request #4 from B612-TEAM2/KimHwanJun
jun3327 Feb 2, 2024
1d8fe70
fix errors
jun3327 Feb 2, 2024
5329a2a
fix errors
jun3327 Feb 2, 2024
13b29bb
fix error
jun3327 Feb 2, 2024
01144ae
fix error
jun3327 Feb 2, 2024
4c1c944
Post수정
RyuJiye Feb 2, 2024
781e17f
Post수정
RyuJiye Feb 2, 2024
d41ec83
Merge branch 'main' of https://github.com/B612-TEAM2/Backend
RyuJiye Feb 2, 2024
c37f9d6
Merge branch 'main' of https://github.com/B612-TEAM2/Backend
RyuJiye Feb 2, 2024
da1a667
fix postService
jun3327 Feb 2, 2024
5cdc631
fix postService
jun3327 Feb 2, 2024
be0b9c0
ãfix
jun3327 Feb 2, 2024
7571fc9
ãfix
jun3327 Feb 2, 2024
2185f73
remove cache
jun3327 Feb 2, 2024
ec15853
remove cache
jun3327 Feb 2, 2024
97249af
commit
jun3327 Feb 3, 2024
4d5221f
commit
jun3327 Feb 3, 2024
daaba83
fix
jun3327 Feb 3, 2024
00c11e6
fix
jun3327 Feb 3, 2024
fa5486e
Merge branch 'main' into KimHwanJun
jun3327 Feb 3, 2024
9cb1487
Merge branch 'main' into KimHwanJun
jun3327 Feb 3, 2024
9136291
Merge pull request #5 from B612-TEAM2/KimHwanJun
jun3327 Feb 3, 2024
5239774
Merge pull request #5 from B612-TEAM2/KimHwanJun
jun3327 Feb 3, 2024
dbd35a5
fix GET /accout controller
jun3327 Feb 4, 2024
7ef301a
fix GET /accout controller
jun3327 Feb 4, 2024
a8bdf52
Merge pull request #6 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
2006cfd
Merge pull request #6 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
1e252f9
fix POST /profile controller
jun3327 Feb 4, 2024
a638add
fix POST /profile controller
jun3327 Feb 4, 2024
4f9c639
Merge pull request #7 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
3af4a28
Merge pull request #7 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
c22fb30
fix POST /accout and UserSerivce
jun3327 Feb 4, 2024
9ca26e8
fix POST /accout and UserSerivce
jun3327 Feb 4, 2024
233f3d1
Merge pull request #8 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
ffc221d
Merge pull request #8 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
fba985e
feat add dummy users
jun3327 Feb 4, 2024
4806e96
feat add dummy users
jun3327 Feb 4, 2024
2e28dba
Merge pull request #9 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
5d5828a
Merge pull request #9 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
0169e99
feat GET /friends/pending
jun3327 Feb 4, 2024
b1b1cf9
feat GET /friends/pending
jun3327 Feb 4, 2024
5f7a31a
Merge pull request #10 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
b42b349
Merge pull request #10 from B612-TEAM2/KimHwanJun
jun3327 Feb 4, 2024
2d585c4
fix joinOAuthUser
jun3327 Feb 4, 2024
84a7510
fix joinOAuthUser
jun3327 Feb 4, 2024
ae7082a
feat 친구 요청 거절
jun3327 Feb 5, 2024
c565fe2
feat 친구 요청 거절
jun3327 Feb 5, 2024
13ec678
Merge pull request #11 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
4e3f8f5
Merge pull request #11 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
f05865a
fix searchUser
jun3327 Feb 5, 2024
4dff93a
fix searchUser
jun3327 Feb 5, 2024
defb5ab
Merge pull request #12 from B612-TEAM2/main
jun3327 Feb 5, 2024
b81ee02
Merge pull request #12 from B612-TEAM2/main
jun3327 Feb 5, 2024
5791881
Merge pull request #13 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
2eec38d
Merge pull request #13 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
0552821
fix delete no usages Dto Classes
jun3327 Feb 5, 2024
ecc57b7
fix delete no usages Dto Classes
jun3327 Feb 5, 2024
f28631b
Merge pull request #14 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
dbe814a
Merge pull request #14 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
1f25b20
refactor userRepository -> userDataRepository
jun3327 Feb 5, 2024
1876039
refactor userRepository -> userDataRepository
jun3327 Feb 5, 2024
daf9c3b
Merge pull request #15 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
b8913ca
Merge pull request #15 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
870f132
fix 프로필 사진 업데이트 인자 수정
jun3327 Feb 5, 2024
e508d2a
fix 프로필 사진 업데이트 인자 수정
jun3327 Feb 5, 2024
2de234d
Merge pull request #16 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
31134b8
Merge pull request #16 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
edc9e5d
fix 친구 요청 관련 예외처리
jun3327 Feb 5, 2024
c34a75b
fix 친구 요청 관련 예외처리
jun3327 Feb 5, 2024
7d2fa87
Merge pull request #17 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
edd6e84
Merge pull request #17 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
438ec6c
refactor 변수 다듬기
jun3327 Feb 5, 2024
4f9ce24
refactor 변수 다듬기
jun3327 Feb 5, 2024
875d52b
Merge pull request #18 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
a6f50ca
Merge pull request #18 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
0fc77fd
refactor 변수 다듬기
jun3327 Feb 5, 2024
b8776cf
refactor 변수 다듬기
jun3327 Feb 5, 2024
e407140
Merge pull request #19 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
621970f
Merge pull request #19 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
f25f6f0
Merge pull request #20 from B612-TEAM2/main
jun3327 Feb 5, 2024
431c598
Merge pull request #20 from B612-TEAM2/main
jun3327 Feb 5, 2024
1fa8d32
refactor UserService
jun3327 Feb 5, 2024
fc6f799
refactor UserService
jun3327 Feb 5, 2024
b749508
Merge pull request #21 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
39e1de7
Merge pull request #21 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
df81313
refactor 소셜로그인 컨트롤러 수정
jun3327 Feb 5, 2024
342bb8f
refactor 소셜로그인 컨트롤러 수정
jun3327 Feb 5, 2024
d362fbe
Merge pull request #22 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
37e21b6
Merge pull request #22 from B612-TEAM2/KimHwanJun
jun3327 Feb 5, 2024
4464f67
commit
jun3327 Feb 5, 2024
2deab18
commit
jun3327 Feb 5, 2024
0ecc3d7
refactor friendshipService
jun3327 Feb 5, 2024
eab2898
refactor friendshipService
jun3327 Feb 5, 2024
4cd4bee
fix 게시글 저장
jun3327 Feb 6, 2024
2dbfd0e
fix 게시글 저장
jun3327 Feb 6, 2024
e599986
Merge pull request #23 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
a8d5e13
Merge pull request #23 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
3b59d81
Post수정
RyuJiye Feb 6, 2024
91f2823
Post수정
RyuJiye Feb 6, 2024
345b6fa
Post수정
RyuJiye Feb 6, 2024
f24bb6c
Post수정
RyuJiye Feb 6, 2024
352f809
Merge branch 'main' of https://github.com/B612-TEAM2/Backend
RyuJiye Feb 6, 2024
891dd91
Merge branch 'main' of https://github.com/B612-TEAM2/Backend
RyuJiye Feb 6, 2024
5ffe8ed
fix 게시글 목록
jun3327 Feb 6, 2024
aba939f
fix 게시글 목록
jun3327 Feb 6, 2024
84ec061
Merge branch 'main' into KimHwanJun
jun3327 Feb 6, 2024
cebe5f9
Merge branch 'main' into KimHwanJun
jun3327 Feb 6, 2024
a3e006d
Merge pull request #24 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
aea85da
Merge pull request #24 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
01757cb
commit
jun3327 Feb 6, 2024
ccb38e0
commit
jun3327 Feb 6, 2024
54be215
commit
jun3327 Feb 6, 2024
e9b2a0a
commit
jun3327 Feb 6, 2024
59bb82d
Merge pull request #25 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
5776b5e
Merge pull request #25 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
fd4fdad
refactor findUserByNickname
jun3327 Feb 6, 2024
0f26c48
refactor findUserByNickname
jun3327 Feb 6, 2024
40acdd0
Merge pull request #26 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
ef7bd17
Merge pull request #26 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
b95c130
post image 추가
RyuJiye Feb 6, 2024
da9d4a1
post image 추가
RyuJiye Feb 6, 2024
4494ad6
Merge remote-tracking branch 'origin/main'
RyuJiye Feb 6, 2024
dd2eb8e
Merge remote-tracking branch 'origin/main'
RyuJiye Feb 6, 2024
f21e2ce
commit
jun3327 Feb 6, 2024
3c81dc3
commit
jun3327 Feb 6, 2024
2d47049
Merge pull request #27 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
9cac011
Merge pull request #27 from B612-TEAM2/KimHwanJun
jun3327 Feb 6, 2024
e4271b4
commit
jun3327 Feb 6, 2024
a4e5e9e
commit
jun3327 Feb 6, 2024
401cb31
commit
jun3327 Feb 6, 2024
2ecfeda
commit
jun3327 Feb 6, 2024
1ff0db1
fix 친구 신청
jun3327 Feb 12, 2024
887badf
fix 친구 신청
jun3327 Feb 12, 2024
693952f
refactor findUserByNickname service
jun3327 Feb 12, 2024
f517bcb
refactor findUserByNickname service
jun3327 Feb 12, 2024
6822420
fix ㅕãUser 엔티티 Setter 삭제
jun3327 Feb 12, 2024
da9a312
fix ㅕãUser 엔티티 Setter 삭제
jun3327 Feb 12, 2024
6873dc8
Merge pull request #28 from B612-TEAM2/KimHwanJun
jun3327 Feb 12, 2024
269d55c
Merge pull request #28 from B612-TEAM2/KimHwanJun
jun3327 Feb 12, 2024
abca5e0
refactor 친구 정보 불러오기 서비스, ë도메인 수정
jun3327 Feb 12, 2024
2b04280
refactor 친구 정보 불러오기 서비스, ë도메인 수정
jun3327 Feb 12, 2024
c633d8a
refactor updateFriendship
jun3327 Feb 12, 2024
17c6264
refactor updateFriendship
jun3327 Feb 12, 2024
41aea82
refactor getUserProfileOfFriendship
jun3327 Feb 12, 2024
e96588a
refactor getUserProfileOfFriendship
jun3327 Feb 12, 2024
aef4d68
Merge pull request #29 from B612-TEAM2/KimHwanJun
jun3327 Feb 12, 2024
4f36c45
Merge pull request #29 from B612-TEAM2/KimHwanJun
jun3327 Feb 12, 2024
342f6d0
post friend, public 구현
RyuJiye Feb 13, 2024
26848b9
post friend, public 구현
RyuJiye Feb 13, 2024
14e90d1
Merge branch 'main' of https://github.com/B612-TEAM2/Backend
RyuJiye Feb 13, 2024
d1cfb36
Merge branch 'main' of https://github.com/B612-TEAM2/Backend
RyuJiye Feb 13, 2024
c9a9e90
Merge pull request #30 from B612-TEAM2/main
jun3327 Feb 13, 2024
6dd209c
Merge pull request #30 from B612-TEAM2/main
jun3327 Feb 13, 2024
787c736
commit
jun3327 Feb 13, 2024
07c825c
commit
jun3327 Feb 13, 2024
561e473
Merge branch 'KimHwanJun' of github.com:B612-TEAM2/Backend into KimHw…
jun3327 Feb 13, 2024
4f2ab87
Merge branch 'KimHwanJun' of github.com:B612-TEAM2/Backend into KimHw…
jun3327 Feb 13, 2024
73cfebb
Merge pull request #31 from B612-TEAM2/KimHwanJun
jun3327 Feb 13, 2024
44221ca
Merge pull request #31 from B612-TEAM2/KimHwanJun
jun3327 Feb 13, 2024
7f6d19e
C:/Program Files/Git/posts/home/store 컨트롤러 수정
jun3327 Feb 13, 2024
75fceb8
C:/Program Files/Git/posts/home/store 컨트롤러 수정
jun3327 Feb 13, 2024
16b03d1
C:/Program Files/Git/posts/home/store 수정
jun3327 Feb 13, 2024
2b87e9e
C:/Program Files/Git/posts/home/store 수정
jun3327 Feb 13, 2024
1c3b840
commit
jun3327 Feb 13, 2024
923e501
post public 위치 기반 검색 구현
RyuJiye Feb 13, 2024
99b756e
post public 위치 기반 검색 구현
RyuJiye Feb 13, 2024
d39fd63
post 삭제 구현
RyuJiye Feb 13, 2024
77f66e0
post 삭제 구현
RyuJiye Feb 13, 2024
4e78cbf
C:/Program Files/Git/posts/home/store 컨트롤러 수정
jun3327 Feb 13, 2024
b242347
Merge branch 'main' of github.com:B612-TEAM2/Backend
jun3327 Feb 13, 2024
c52da2f
postInfo Dto -> userId 필드 추가
RyuJiye Feb 13, 2024
32e41f9
postInfo Dto -> userId 필드 추가
RyuJiye Feb 13, 2024
3ea4cf8
fix
jun3327 Feb 13, 2024
c2800d0
commit
jun3327 Feb 13, 2024
f7a8cc7
merge
jun3327 Feb 13, 2024
850dc0f
Merge pull request #32 from B612-TEAM2/KimHwanJun
jun3327 Feb 13, 2024
68414b6
캐시 삭제
jun3327 Feb 20, 2024
0f7b5c5
캐시 삭제
jun3327 Feb 20, 2024
b19b1f3
Merge branch 'main' of github.com:B612-TEAM2/Backend
jun3327 Feb 20, 2024
6f1dca2
commit
jun3327 Feb 20, 2024
8608dfe
commit
jun3327 Feb 20, 2024
6610506
Update README.md
jun3327 Feb 22, 2024
107ec02
Update README.md
jun3327 Feb 22, 2024
a318394
Update README.md
jun3327 Feb 22, 2024
37ab6f5
Update README.md
jun3327 Feb 22, 2024
a7fe8a9
Update README.md
jun3327 Feb 22, 2024
55f7d47
Update README.md
jun3327 Feb 22, 2024
0777b32
Update README.md
jun3327 Feb 22, 2024
bd6c891
Update README.md
jun3327 Feb 22, 2024
8563a9f
Update README.md
jun3327 Feb 22, 2024
270466b
Update README.md
jun3327 Feb 22, 2024
3f77768
Merge branch 'main' into KimHwanJun
jun3327 Feb 22, 2024
2bd64cb
Merge branch 'main' into KimHwanJun
jun3327 Feb 22, 2024
d337ace
Merge pull request #33 from B612-TEAM2/KimHwanJun
jun3327 Feb 22, 2024
6b06fed
Merge pull request #33 from B612-TEAM2/KimHwanJun
jun3327 Feb 22, 2024
17a5ffe
commit
jun3327 Feb 22, 2024
1caab1f
commit
jun3327 Feb 22, 2024
4f12bf5
fix 내가 쓴글 목록 반환
jun3327 Feb 22, 2024
c4a3f6a
fix 내가 쓴글 목록 반환
jun3327 Feb 22, 2024
c889fc5
LikeToggle 수정
RyuJiye Feb 23, 2024
88db3d7
LikeToggle 수정
RyuJiye Feb 23, 2024
5153416
Merge branch 'main' of https://github.com/B612-TEAM2/Backend
RyuJiye Feb 23, 2024
bb2c60a
Merge branch 'main' of https://github.com/B612-TEAM2/Backend
RyuJiye Feb 23, 2024
9d7450a
feature NCP Object Storage Upload
jun3327 Feb 23, 2024
b99efde
feature NCP Object Storage Upload
jun3327 Feb 23, 2024
f1297a0
Merge branch 'main' of github.com:B612-TEAM2/Backend
jun3327 Feb 23, 2024
9d8f535
Merge branch 'main' of github.com:B612-TEAM2/Backend
jun3327 Feb 23, 2024
734a3b3
fixed untracked files
RyuJiye Feb 23, 2024
f02937d
fixed untracked files
RyuJiye Feb 23, 2024
2f4a304
feature NCP object storage
jun3327 Feb 23, 2024
2fd7ad8
feature NCP object storage
jun3327 Feb 23, 2024
dd753af
fixed untracked files
jun3327 Feb 23, 2024
7461abf
fixed untracked files
jun3327 Feb 23, 2024
00cb57b
controller postInfo 수정
RyuJiye Feb 23, 2024
08d918d
push
jun3327 Feb 23, 2024
5d0681d
postDto 수정. user nickname, profileImg 반환
RyuJiye Feb 23, 2024
eb90e31
Merge remote-tracking branch 'origin/main'
RyuJiye Feb 23, 2024
855ebd2
fix 글 작성 이미지 수정
jun3327 Feb 23, 2024
c354591
Merge branch 'main' of github.com:B612-TEAM2/Backend
jun3327 Feb 23, 2024
64b62e0
feature 글 공개 범위
jun3327 Feb 23, 2024
478b850
fix RequestParam에 value 추가
jun3327 Feb 23, 2024
16a5bd4
comit
jun3327 Feb 25, 2024
b32f391
pull origin main
jun3327 Feb 25, 2024
94947f6
fixed untracked files
jun3327 Feb 25, 2024
393d214
fixed untracked files
jun3327 Feb 25, 2024
ac58514
fix 글 수정 컨트롤러 수정
jun3327 Feb 25, 2024
90c82a9
fix
jun3327 Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.idea/
9 changes: 0 additions & 9 deletions .idea/Backend.iml

This file was deleted.

18 changes: 0 additions & 18 deletions .idea/gradle.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

70 changes: 0 additions & 70 deletions .idea/workspace.xml

This file was deleted.

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# Backend
TEAM2 백엔드 레포지토리입니다.

## 사용기술
- SpringBoot
- Spring Data JPA
- Spring Security
- MySQL
- JWT + OAuth2.0
- NCP Server
- NCP Object Storage

## 아키텍처
<img width="572" alt="프로젝트 아키텍처" src="https://github.com/B612-TEAM2/Backend/assets/121341289/326d2316-e5af-4afd-b598-d4db90ad9614">
6 changes: 4 additions & 2 deletions ping/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ build/
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
Expand All @@ -26,13 +25,16 @@ out/
!**/src/main/**/out/
!**/src/test/**/out/
application.yml
JwtProperties.java
OAuthProperties.java
NcpObjectStorageConfig.java

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

frontend/
### VS Code ###
.vscode/
11 changes: 11 additions & 0 deletions ping/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,24 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation group: 'com.auth0', name: 'java-jwt', version: '4.3.0'
implementation 'org.springframework.boot:spring-boot-devtools'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.6'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.fasterxml.jackson.core:jackson-databind'
}

tasks.named('test') {
useJUnitPlatform()
}

bootJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
6 changes: 6 additions & 0 deletions ping/src/main/java/com/b6122/ping/ImgPathProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.b6122.ping;

public interface ImgPathProperties {

String postImgPath = "C:\\ping\\post\\image";
}
9 changes: 9 additions & 0 deletions ping/src/main/java/com/b6122/ping/PingApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

@SpringBootApplication
@EnableJpaAuditing
public class PingApplication {

@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}

public static void main(String[] args) {
SpringApplication.run(PingApplication.class, args);
}
Expand Down
57 changes: 57 additions & 0 deletions ping/src/main/java/com/b6122/ping/auth/PrincipalDetails.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.b6122.ping.auth;

import com.b6122.ping.domain.User;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.ArrayList;
import java.util.Collection;

@Data
public class PrincipalDetails implements UserDetails {

private User user;

@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
Collection<GrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority(user.getRole().toString())); // Enum을 문자열로 변환하여 SimpleGrantedAuthority 생성
return authorities;
}

@Override
public String getPassword() {
return null;
}

@Override
public String getUsername() {
return null;
}

@Override
public boolean isAccountNonExpired() {
return true;
}

@Override
public boolean isAccountNonLocked() {
return true;
}

@Override
public boolean isCredentialsNonExpired() {
return true;
}

@Override
public boolean isEnabled() {
return true;
}

public PrincipalDetails(User user) {
this.user = user;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.b6122.ping.auth;

import com.b6122.ping.domain.User;
import com.b6122.ping.repository.datajpa.UserDataRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

// http://localhost:8080/login을 통해 로그인을 안함(disable 해놔서) 따라서 아래 서비스가 동작하기 위한
// 필터를 하나 만들어야 된다(JwtAuthenticationFilter)
// 근데 우리 서비스는 ~/login을 통해 요청할 일이 없기 때문에, JwtAuthenticationFilter도 사실상 필요가 없다
// jwt 토큰 발급 후 JwtAuthorizationFilter에서 시큐리티 세션에 Authentication 객체를 저장하여 권한 관리를 하고 있다.
@Service
@RequiredArgsConstructor
public class PrincipalDetailsService implements UserDetailsService {

private final UserDataRepository userDataRepository;

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User userEntity = userDataRepository.findByUsername(username).orElseThrow();
return new PrincipalDetails(userEntity);
}
}
25 changes: 25 additions & 0 deletions ping/src/main/java/com/b6122/ping/config/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.b6122.ping.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

@Configuration
public class CorsConfig {

@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true); // 내 서버가 응답을 할 때 json을 자바스크립트에서 처리할 수 있게 할지를 설정
// config.addAllowedOriginPattern("http://61.97.185.12");
config.addAllowedOriginPattern("http://localhost:3000");
config.addAllowedHeader("*"); // 모든 header에 응답을 허용
config.addAllowedMethod("*"); // 모든 http method를 허용
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);

}
}
54 changes: 54 additions & 0 deletions ping/src/main/java/com/b6122/ping/config/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.b6122.ping.config;

import com.b6122.ping.config.jwt.JwtAuthorizationFilter;
import com.b6122.ping.repository.datajpa.UserDataRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.SecurityFilterChain;


@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityConfig {

private final CorsConfig corsConfig;
private final UserDetailsService userDetailsService;
private final UserDataRepository userDataRepository;

@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {

//AuthenticaionManager 생성
AuthenticationManagerBuilder sharedObject = http.getSharedObject(AuthenticationManagerBuilder.class);
sharedObject.userDetailsService(this.userDetailsService); //이 userDetailsService와 PrincipalDetailsService에서 상속받는 인터페이스는 서로 같음.
AuthenticationManager authenticationManager = sharedObject.build();
http.authenticationManager(authenticationManager);
//세션 만들지 않기.
http
.addFilter(corsConfig.corsFilter())
.csrf(AbstractHttpConfigurer::disable)
.sessionManagement((sessionManagement) -> sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.formLogin((formLogin) -> formLogin.disable())
// .addFilter(new JwtAuthenticationFilter((authenticationManager)))
.addFilter((new JwtAuthorizationFilter(authenticationManager, userDataRepository)))
.httpBasic((httpBasic) -> httpBasic.disable()) //Bearer 방식을 사용하기 위해 basic 인증 비활성화
.authorizeHttpRequests((authorize) ->
authorize
.requestMatchers("/api/oauth/jwt/**").permitAll()
.requestMatchers("/admin/**").hasAnyRole("ADMIN")
.requestMatchers("/**").hasAnyRole("ADMIN", "USER")
.anyRequest().authenticated());


return http.build();
}
}
Loading