-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'BE/dev' into BE/feature/#681-db-refactor
- Loading branch information
Showing
94 changed files
with
1,790 additions
and
468 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: PULL REQUEST | ||
name: pull request | ||
|
||
on: | ||
pull_request: | ||
|
@@ -11,7 +11,7 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ vars.SLACK_BRANCH}} | ||
ref: ${{vars.SLACK_BRANCH}} | ||
|
||
- name: Install jq | ||
run: sudo apt-get install jq | ||
|
@@ -43,7 +43,7 @@ jobs: | |
id: pull_request_notify | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: ${{secrets.SLACK_FE_REVIEW_CHANNEL}} | ||
channel-id: ${{secrets.SLACK_BE_REVIEW_CHANNEL}} | ||
payload: | | ||
{ | ||
"text": "⌛PR왔다 리뷰해라⌛", | ||
|
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
backend/src/main/java/site/coduo/common/config/web/filter/AccessTokenCookieFilter.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 site.coduo.common.config.web.filter; | ||
|
||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.Objects; | ||
|
||
import jakarta.servlet.Filter; | ||
import jakarta.servlet.FilterChain; | ||
import jakarta.servlet.ServletException; | ||
import jakarta.servlet.ServletRequest; | ||
import jakarta.servlet.ServletResponse; | ||
import jakarta.servlet.http.Cookie; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import site.coduo.member.exception.AuthenticationException; | ||
import site.coduo.member.infrastructure.security.JwtProvider; | ||
|
||
@RequiredArgsConstructor | ||
public class AccessTokenCookieFilter implements Filter { | ||
|
||
public static final String TEMPORARY_ACCESS_TOKEN_COOKIE_NAME = "temp_access"; | ||
|
||
private final JwtProvider jwtProvider; | ||
|
||
@Override | ||
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) | ||
throws IOException, ServletException { | ||
final HttpServletRequest httpRequest = (HttpServletRequest) request; | ||
if (httpRequest.getMethod().equalsIgnoreCase("OPTIONS")) { | ||
chain.doFilter(request, response); | ||
return; | ||
} | ||
validate(parseSignInCookie(httpRequest)); | ||
chain.doFilter(request, response); | ||
} | ||
|
||
private Cookie parseSignInCookie(final HttpServletRequest request) { | ||
final Cookie[] cookies = request.getCookies(); | ||
if (Objects.isNull(cookies)) { | ||
throw new AuthenticationException("쿠키 값이 비어있습니다."); | ||
} | ||
|
||
return Arrays.stream(cookies) | ||
.filter(cookie -> cookie.getName().equals(TEMPORARY_ACCESS_TOKEN_COOKIE_NAME)) | ||
.findAny() | ||
.orElseThrow(() -> new AuthenticationException("임시 엑세스 토큰 쿠키를 찾을 수 없습니다.")); | ||
} | ||
|
||
private void validate(final Cookie cookie) { | ||
if (jwtProvider.isValid(cookie.getValue())) { | ||
return; | ||
} | ||
throw new AuthenticationException("임시 엑세스 토큰 쿠키 값이 유효하지 않습니다."); | ||
} | ||
} |
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
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
Oops, something went wrong.