-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/JNU-econovation/econo-error
- Loading branch information
Showing
162 changed files
with
4,914 additions
and
788 deletions.
There are no files selected for viewing
This file contains 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,23 @@ | ||
name: deploy | ||
on: | ||
push: | ||
branches: [ 'main' ] | ||
workflow_dispathch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
SSH: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run scripts in server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
key: ${{ secrets.FRONT_EC2_SSH_KEY }} | ||
host: ${{ secrets.FRONT_EC2_HOST }} | ||
username: ${{ secrets.FRONT_EC2_USER }} | ||
script: | | ||
pwd | ||
This file contains 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,22 @@ | ||
name: deploy | ||
on: | ||
push: | ||
branches: [ 'main' ] | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
SSH: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run scripts in server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
key: ${{ secrets.FRONT_EC2_SSH_KEY }} | ||
host: ${{ secrets.FRONT_EC2_HOST }} | ||
username: ${{ secrets.FRONT_EC2_USER }} | ||
script: | | ||
pwd | ||
./frontCDScript.sh | ||
This file contains 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 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 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 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
56 changes: 56 additions & 0 deletions
56
BE/error/src/main/java/com/example/demo/auth/application/config/LoginConfig.java
This file contains 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,56 @@ | ||
package com.example.demo.auth.application.config; | ||
|
||
|
||
import com.example.demo.auth.application.model.token.TokenResolver; | ||
import com.example.demo.auth.application.support.CookieTokenExtractor; | ||
import com.example.demo.auth.application.support.HeaderTokenExtractor; | ||
import com.example.demo.auth.application.support.MemberArgumentResolver; | ||
import com.example.demo.auth.presentation.interceptor.AuthInterceptor; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.method.support.HandlerMethodArgumentResolver; | ||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
import java.util.List; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class LoginConfig implements WebMvcConfigurer { | ||
private final MemberArgumentResolver memberArgumentResolver; | ||
private final TokenResolver tokenResolver; | ||
|
||
@Override | ||
public void addInterceptors(InterceptorRegistry registry) { | ||
registry | ||
.addInterceptor(memberAuthInterceptor()) | ||
.addPathPatterns("/api/**") | ||
.excludePathPatterns("/api/auth/**", "/api/calendar/public/**", "/api/filter", "/api/filter/**", "/api/calendar", "/api/calendar/**"); | ||
registry | ||
.addInterceptor(reissueAuthInterceptor()) | ||
.addPathPatterns("/auth/reissue") | ||
.excludePathPatterns("/api/auth/**"); | ||
} | ||
|
||
@Override | ||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { | ||
resolvers.add(memberArgumentResolver); | ||
} | ||
|
||
@Bean | ||
public AuthInterceptor memberAuthInterceptor() { | ||
return AuthInterceptor.builder() | ||
.tokenExtractor(new HeaderTokenExtractor()) | ||
.tokenResolver(tokenResolver) | ||
.build(); | ||
} | ||
|
||
@Bean | ||
public AuthInterceptor reissueAuthInterceptor() { | ||
return AuthInterceptor.builder() | ||
.tokenExtractor(new CookieTokenExtractor()) | ||
.tokenResolver(tokenResolver) | ||
.build(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
BE/error/src/main/java/com/example/demo/auth/application/dto/TokenResponse.java
This file contains 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,18 @@ | ||
package com.example.demo.auth.application.dto; | ||
|
||
import com.example.demo.common.support.dto.AbstractDto; | ||
import com.example.demo.common.support.dto.AbstractResponseDto; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class TokenResponse implements AbstractResponseDto { | ||
private String accessToken; | ||
private Long accessExpiredTime; | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
BE/error/src/main/java/com/example/demo/auth/application/event/DeletedMemberEvent.java
This file contains 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,25 @@ | ||
package com.example.demo.auth.application.event; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class DeletedMemberEvent { | ||
private final Long memberId; | ||
private final String token; | ||
|
||
private DeletedMemberEvent(Long memberId, String token) { | ||
this.memberId = memberId; | ||
this.token = token; | ||
} | ||
|
||
/** | ||
* 멤버 탈퇴 이벤트를 발행한다. | ||
* | ||
* @param memberId 회원 탈퇴를 원하는 멤버 id | ||
* @param token 회원 탈퇴 시 사용한 토큰 | ||
* @return | ||
*/ | ||
public static DeletedMemberEvent of(Long memberId, String token) { | ||
return new DeletedMemberEvent(memberId, token); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ror/src/main/java/com/example/demo/auth/application/exception/AuthorizationException.java
This file contains 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,10 @@ | ||
package com.example.demo.auth.application.exception; | ||
|
||
import com.example.demo.common.exception.BusinessException; | ||
import org.springframework.http.HttpStatus; | ||
|
||
public class AuthorizationException extends BusinessException { | ||
public AuthorizationException(String code, HttpStatus httpStatus) { | ||
super(code, httpStatus); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...src/main/java/com/example/demo/auth/application/exception/InvalidNameFormatException.java
This file contains 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,20 @@ | ||
package com.example.demo.auth.application.exception; | ||
|
||
import com.example.demo.common.exception.BusinessException; | ||
import org.springframework.http.HttpStatus; | ||
|
||
/** 멤버의 이름 형식이 올바르지 않을 떄 발생하는 예외 */ | ||
public class InvalidNameFormatException extends BusinessException { | ||
private static final String FAIL_CODE = "4006"; | ||
private final String name; | ||
|
||
public InvalidNameFormatException(String name) { | ||
super(FAIL_CODE, HttpStatus.BAD_REQUEST); | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return String.format("%s 멤버의 이름이 형식과 일치하지 않습니다.", name); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...rror/src/main/java/com/example/demo/auth/application/exception/InvalidTokenException.java
This file contains 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,18 @@ | ||
package com.example.demo.auth.application.exception; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
||
/** 토큰이 유효하지 않을 때 발생하는 예외 */ | ||
public class InvalidTokenException extends AuthorizationException { | ||
private static final String FAIL_CODE = "4003"; | ||
|
||
public InvalidTokenException() { | ||
super(FAIL_CODE, HttpStatus.UNAUTHORIZED); | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return "유효하지 않은 토큰입니다."; | ||
} | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
...or/src/main/java/com/example/demo/auth/application/exception/NotFoundCookieException.java
This file contains 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,19 @@ | ||
package com.example.demo.auth.application.exception; | ||
|
||
import com.example.demo.common.exception.BusinessException; | ||
import org.springframework.http.HttpStatus; | ||
|
||
/** 토큰이 쿠키에 존재하지 않을 때 발생하는 예외 */ | ||
public class NotFoundCookieException extends BusinessException { | ||
private static final String FAIL_CODE = "4004"; | ||
|
||
public NotFoundCookieException() { | ||
super(FAIL_CODE, HttpStatus.UNAUTHORIZED); | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return "리프레시 토큰이 존재하지 않습니다."; | ||
} | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
...c/main/java/com/example/demo/auth/application/exception/NotFoundHeaderTokenException.java
This file contains 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,18 @@ | ||
package com.example.demo.auth.application.exception; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
||
/** 토큰이 헤더에 존재하지 않을 때 발생하는 예외 */ | ||
public class NotFoundHeaderTokenException extends AuthorizationException { | ||
private static final String FAIL_CODE = "4000"; | ||
|
||
public NotFoundHeaderTokenException() { | ||
super(FAIL_CODE, HttpStatus.UNAUTHORIZED); | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return "엑세스 토큰이 존재하지 않습니다."; | ||
} | ||
} | ||
|
Oops, something went wrong.