-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
548 additions
and
429 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/favoriteplace/app/member/controller/dto/TokenInfoDto.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,15 @@ | ||
package com.favoriteplace.app.member.controller.dto; | ||
|
||
|
||
public record TokenInfoDto( | ||
String grantType, | ||
String accessToken, | ||
String refreshToken | ||
) { | ||
public static TokenInfoDto of( | ||
final String accessToken, | ||
final String refreshToken | ||
) { | ||
return new TokenInfoDto("Bearer", accessToken, refreshToken); | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...ce/global/security/CustomUserDetails.java → ...eplace/global/auth/CustomUserDetails.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
54 changes: 54 additions & 0 deletions
54
src/main/java/com/favoriteplace/global/auth/JwtAuthenticationNeededPath.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,54 @@ | ||
package com.favoriteplace.global.auth; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.regex.Pattern; | ||
|
||
@RequiredArgsConstructor | ||
public class JwtAuthenticationNeededPath { | ||
private final String pathPattern; | ||
private final String method; | ||
|
||
public boolean matches(String requestURI, String method) { | ||
String regex = pathPattern.replaceAll("\\*\\*", ".*"); | ||
return Pattern.matches(regex, requestURI) && this.method.equalsIgnoreCase(method); | ||
} | ||
|
||
public static final List<JwtAuthenticationNeededPath> NEEDED_JWT_AUTHENTICATION_PATHS = Arrays.asList( | ||
new JwtAuthenticationNeededPath("/auth/logout", "POST"), | ||
new JwtAuthenticationNeededPath("/pilgrimage/**", "POST"), | ||
new JwtAuthenticationNeededPath("/pilgrimage/**", "DELETE"), | ||
new JwtAuthenticationNeededPath("/posts/free/my-posts", "GET"), | ||
new JwtAuthenticationNeededPath("/posts/free/my-comments", "GET"), | ||
new JwtAuthenticationNeededPath("/posts/free", "POST"), | ||
new JwtAuthenticationNeededPath("/posts/free/**", "DELETE"), | ||
new JwtAuthenticationNeededPath("/posts/free/**", "POST"), | ||
new JwtAuthenticationNeededPath("/posts/free/**", "PUT"), | ||
new JwtAuthenticationNeededPath("/posts/free/**", "PATCH"), | ||
new JwtAuthenticationNeededPath("/posts/guestbooks/my-comments", "GET"), | ||
new JwtAuthenticationNeededPath("/posts/guestbooks/my-posts", "GET"), | ||
new JwtAuthenticationNeededPath("/my", "GET"), | ||
new JwtAuthenticationNeededPath("/my/**", "GET"), | ||
new JwtAuthenticationNeededPath("/my/**", "PUT"), | ||
new JwtAuthenticationNeededPath("/my/**", "PATCH"), | ||
new JwtAuthenticationNeededPath("/posts/guestbooks/**", "PATCH"), | ||
new JwtAuthenticationNeededPath("/posts/guestbooks/**", "DELETE"), | ||
new JwtAuthenticationNeededPath("/posts/guestbooks/**", "POST"), | ||
new JwtAuthenticationNeededPath("/my/blocks/**", "POST"), | ||
new JwtAuthenticationNeededPath("/posts/free/comments/**", "PUT"), | ||
new JwtAuthenticationNeededPath("/posts/free/comments/**", "DELETE"), | ||
new JwtAuthenticationNeededPath("/posts/guestbooks/comments/**", "PUT"), | ||
new JwtAuthenticationNeededPath("/posts/guestbooks/comments/**", "DELETE"), | ||
new JwtAuthenticationNeededPath("/shop/purchase/**", "POST"), | ||
new JwtAuthenticationNeededPath("/notifications", "PATCH"), | ||
new JwtAuthenticationNeededPath("/notifications", "GET"), | ||
new JwtAuthenticationNeededPath("/notifications/**", "PATCH"), | ||
new JwtAuthenticationNeededPath("/notifications/**", "DELETE") | ||
); | ||
|
||
public static List<JwtAuthenticationNeededPath> getNeededPaths() { | ||
return NEEDED_JWT_AUTHENTICATION_PATHS; | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...e/global/security/config/EmailConfig.java → ...place/global/auth/config/EmailConfig.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
2 changes: 1 addition & 1 deletion
2
...al/security/config/FeignClientConfig.java → ...global/auth/config/FeignClientConfig.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
2 changes: 1 addition & 1 deletion
2
...global/security/config/JacksonConfig.java → ...ace/global/auth/config/JacksonConfig.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
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.