-
Notifications
You must be signed in to change notification settings - Fork 5
[BE] feat: user security, 회원가입, 이메일 인증, 로그인 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
9a21b37
[BE] feat: user local db config 파일 추가 (#10)
bianbbc87 a7eeb38
[BE] refactor: user config mysql url, driver-class-name은 constant로 변경…
bianbbc87 7b6a59d
[BE] feat: user domain, entity 정의 (#10)
bianbbc87 ac9a31f
[BE] refactor: base entity, birth, name 필드 추가 (#10)
bianbbc87 1faba40
[BE] feat: stmp config 설정 (#10)
bianbbc87 8208486
[BE] refactor: jwt 만료 시간 config 추가 (#10)
bianbbc87 959d460
[BE] refactor: user server 접근 및 jwt 검증 설정 (#10)
bianbbc87 3ae032c
[BE] feat: security 설정 (#10)
bianbbc87 584cc40
[BE] feat: jwt, security, email dependency 추가 (#10)
bianbbc87 f2d12e7
[BE] feat: security no need url 확인용 controller 추가 (#10)
bianbbc87 f6267cc
[BE] feat: member repository 추가 (#10)
bianbbc87 e7ce36c
[BE] feat: bean 주입용 usecase 추가 (#10)
bianbbc87 8059ad8
[BE] feat: 임시 회원가입 메서드 구현 (#10)
bianbbc87 4ff3725
[BE] feat: 인증번호 인증 및 회원가입 메서드 구현 (#10)
bianbbc87 dd2418d
[BE] feat: 로그인 메서드 구현 (#10)
bianbbc87 a8d959a
[BE] refactor: apigateway user server path 정의 (#10)
bianbbc87 551bd0f
[BE] refactor: user controller 반환값 null -> string으로 변경 (#10)
bianbbc87 820a6b1
[BE] refactor: user controller request dto final 정의 (#10)
bianbbc87 ee5e886
[BE] refactor: usecase, service method final 정의, requestDto request로 …
bianbbc87 1d9d369
[BE] refactor: 이메일 중복 검사 api 분리 (#10)
bianbbc87 ce10e7d
[BE] refactor: id genertative 생성 어노테이션 제거 (#10)
bianbbc87 68d81b5
[BE] refactor: 비밀번호 중복 검사 BCryptPasswordEncoder로 변경 (#10)
bianbbc87 be0bd43
[BE] refactor: 생성자 public -> private으로 변경, domain redis 구분 제거 (#10)
bianbbc87 064fa72
[BE] refactor: failtype 500, 400 구분 리팩토링 (#10)
bianbbc87 86e67f4
[BE] refactor: discord용 템플릿으로 변경 (#10)
bianbbc87 54c363b
[BE] refactor: user details account non expired, account non locked, …
bianbbc87 a8204d3
[BE] refactor: jwon util 메서드 이름 간결하게 변경 (#10)
bianbbc87 ce2d4d7
[BE] fix: 이메일 중복 검사 usecase implements 누락 추가 (#10)
bianbbc87 03629cc
[BE] refactor: password encoder 추상화 빈으로 변경 (#10)
bianbbc87 ce856df
[BE] refactor: member repository OptimisticLockException catch문 제거 (#10)
bianbbc87 549452a
[BE] refactor: cors config 추가 (#10)
bianbbc87 433bc0f
[BE] feat: user details SimpleAuthority 권한 추가 (#10)
bianbbc87 07dbe18
[BE] refactor: base entity, time entity 분리 (#10)
bianbbc87 bd92624
[BE] refactor: AOP logging으로 변경 (#10)
bianbbc87 5ddcd4a
[BE] feat: user info update, user delete 메서드 구현 (#10)
bianbbc87 707323e
[BE] feat: default profile image config value 등록 (#10)
bianbbc87 1de812a
[BE] refactor: redis repository 역할 분리 (#10)
bianbbc87 30ab556
[BE] fix: delete user service 주입 안 되던 이슈 해결 (#10)
bianbbc87 29a1f9d
[BE] feat: 디바이스 토큰 업데이트 메서드 추가 (#10)
bianbbc87 3d9d2be
[BE] fix: delete user usecase final 주입 이슈 해결 (#10)
bianbbc87 5390143
[BE] feat: 유저 정보 업데이트 메서드 구현, 기본 프로필 이미지 설정 (#10)
bianbbc87 6e64977
[BE] refactor: 유저 서버 경로 user로 변경 (#10)
bianbbc87 b2a9784
[BE] feat: @MemberID 파싱용 resolver, webconfig 설정 (#10)
bianbbc87 fd8796e
[BE] refactor: response 출력 오류 해결, global exception handler 추가 (#10)
bianbbc87 b729ea7
[BE] feat: intelliJ http test code 추가 (#10)
bianbbc87 4016aae
[BE] refactor: apigateway filter 특정 url 제외 (#10)
bianbbc87 9d90de8
[BE] refactor: member delete soft delete로 변경 (#10)
bianbbc87 9c18ee3
[BE] refactor: api gateway server 유저 서버 filter 처리 (#10)
bianbbc87 8bbf079
[BE] refactor: userinfo http 수정, 디바이스 토큰 재발급 controller 정의 (#10)
bianbbc87 208bbc4
[BE] fix: jwt 생성 key base64 제거 (#10)
bianbbc87 2c9f9bd
[BE] feat: base entity config 추가 (#10)
bianbbc87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/backend/user-server/http/UserControllerHttpRequest.http
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| ### 0.0 health check | ||
| // @no-log | ||
| GET {{host_url}}/health | ||
|
|
||
| ### 1.0 임시 회원가입 | ||
| // @no-log | ||
| POST {{host_url}}/sign-up | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "email": "{{user.API_1_0_SIGNUP.email}}", | ||
| "password": "{{user.API_1_0_SIGNUP.password}}", | ||
| "name": "{{user.API_1_0_SIGNUP.name}}", | ||
| "nickname": "{{user.API_1_0_SIGNUP.nickname}}", | ||
| "birth": "{{user.API_1_0_SIGNUP.birth}}" | ||
| } | ||
|
|
||
|
|
||
| ### 1.1 로그인 | ||
| // @no-log | ||
| POST {{host_url}}/sign-in | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "email": "{{user.API_1_1_SIGNIN.email}}", | ||
| "password": "{{user.API_1_1_SIGNIN.password}}" | ||
| } | ||
|
|
||
| > {% | ||
| client.global.set("access_token", response.body.result.access_token); | ||
| %} | ||
|
|
||
|
|
||
| ### 1.2 인증코드 인증 | ||
| // @no-log | ||
| POST {{host_url}}/validation/authentication-code | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "email": "{{user.API_1_2_AUTHENTICATION_CODE.email}}", | ||
| "authentication_code": "{{user.API_1_2_AUTHENTICATION_CODE.authentication_code}}" | ||
| } | ||
|
|
||
| ### 1.3 이메일 중복 검사 | ||
| // @no-log | ||
| POST {{host_url}}/validation/email?email={{user.API_1_3_DUPLICATE_EMAIL.email}} | ||
|
|
||
| ### 1.4 디바이스 토큰 등록 | ||
| // @no-log | ||
| PATCH {{host_url}}/device-token | ||
| Authorization: Bearer {{access_token}} | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "device_token": "{{user.API_1_4_UPDATE_DEVICE_TOKEN.device_token}}" | ||
| } | ||
|
|
||
| ### 1.5 사용자 정보 수정 | ||
| // @no-log | ||
| PATCH {{host_url}}/info | ||
| Authorization: Bearer {{access_token}} | ||
| Content-Type: multipart/form-data; boundary=boundary | ||
|
|
||
| --boundary | ||
| Content-Disposition: form-data; name="profile_image"; filename="image.png" | ||
| Content-Type: image/png | ||
|
|
||
| < /Users/eunji/Desktop/profile2.png | ||
|
|
||
| --boundary | ||
| Content-Disposition: form-data; name="name" | ||
|
|
||
| {{user.API_1_5_UPDATE_USERINFO.name}} | ||
|
|
||
| --boundary | ||
| Content-Disposition: form-data; name="nickname" | ||
|
|
||
| {{user.API_1_5_UPDATE_USERINFO.nickname}} | ||
|
|
||
| --boundary-- | ||
|
|
||
|
|
||
| ### 1.6 회원 탈퇴 | ||
| // @no-log | ||
| DELETE {{host_url}}/auth | ||
| Authorization: Bearer {{access_token}} |
36 changes: 36 additions & 0 deletions
36
src/backend/user-server/src/main/java/com/asyncgate/user_server/config/BaseEntityConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package com.asyncgate.user_server.config; | ||
|
|
||
| import com.asyncgate.user_server.security.info.CustomUserPrincipal; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.data.domain.AuditorAware; | ||
| import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
| import org.springframework.security.core.Authentication; | ||
| import org.springframework.security.core.context.SecurityContextHolder; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| @EnableJpaAuditing | ||
| @Configuration | ||
| public class BaseEntityConfig { | ||
|
|
||
| @Bean("user-auditorProvider") | ||
| public AuditorAware<String> auditorProvider() { | ||
| return () -> { | ||
| Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
|
|
||
| if (authentication == null || !authentication.isAuthenticated()) { | ||
| return Optional.of("AnonymousNULL"); | ||
| } | ||
|
|
||
| Object principal = authentication.getPrincipal(); | ||
|
|
||
| if (principal instanceof CustomUserPrincipal) { | ||
| return Optional.of(((CustomUserPrincipal) principal).getId()); | ||
| } | ||
|
|
||
| return Optional.of("AnonymousNOT_TYPE"); | ||
| }; | ||
| } | ||
|
|
||
| } |
45 changes: 45 additions & 0 deletions
45
src/backend/user-server/src/main/java/com/asyncgate/user_server/config/CorsConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package com.asyncgate.user_server.config; | ||
|
|
||
| import lombok.AccessLevel; | ||
| import lombok.NoArgsConstructor; | ||
| import org.springframework.web.cors.CorsConfiguration; | ||
| import org.springframework.web.cors.CorsConfigurationSource; | ||
| import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
|
|
||
| @NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
| public class CorsConfig { | ||
|
|
||
| public static CorsConfigurationSource corsConfigurationSource() { | ||
| CorsConfiguration configuration = new CorsConfiguration(); | ||
|
|
||
| //리소스를 허용 | ||
| ArrayList<String> allowedOriginPatterns = new ArrayList<>(); | ||
| allowedOriginPatterns.add("http://localhost:5173"); // vite | ||
| allowedOriginPatterns.add("http://127.0.0.1:5173"); | ||
| configuration.setAllowedOrigins(allowedOriginPatterns); | ||
|
|
||
| //허용하는 HTTP METHOD | ||
| ArrayList<String> allowedHttpMethods = new ArrayList<>(); | ||
| allowedHttpMethods.add("GET"); | ||
| allowedHttpMethods.add("POST"); | ||
| allowedHttpMethods.add("PUT"); | ||
| allowedHttpMethods.add("PATCH"); | ||
| allowedHttpMethods.add("DELETE"); | ||
| allowedHttpMethods.add("OPTIONS"); | ||
| configuration.setAllowedMethods(allowedHttpMethods); | ||
|
|
||
| configuration.setAllowedHeaders(Collections.singletonList("*")); | ||
| // configuration.setAllowedHeaders(List.of(HttpHeaders.AUTHORIZATION, HttpHeaders.CONTENT_TYPE)); | ||
|
|
||
| //인증, 인가를 위한 credentials 를 TRUE로 설정 | ||
| configuration.setAllowCredentials(true); | ||
|
|
||
| UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
| source.registerCorsConfiguration("/**", configuration); | ||
|
|
||
| return source; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트할때 update로 두고 배포환경에서는 none 이나 validate가 좋을 것 같아요