-
Notifications
You must be signed in to change notification settings - Fork 0
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
๐ ์๋น์ค ํํด ๊ธฐ๋ฅ #12
Merged
+53
โ7
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2cd8cea
add :: deleteByUser
ta2ye0n e952137
refactor :: transactional ์ด๋
ธํ
์ด์
์ญ์
ta2ye0n 94b6109
add :: CancelMembershipService
ta2ye0n 2d81f15
add :: endpoint
ta2ye0n 4a8bed0
refactor :: @Id ๋ณ๊ฒฝ
ta2ye0n 51be8ad
update :: refreshToken ์ญ์
ta2ye0n d96c313
refactor :: authenticated() -> permitAll()
ta2ye0n 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 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
5 changes: 5 additions & 0 deletions
5
src/main/java/com/gcms/v3/domain/auth/service/CancelMembershipService.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,5 @@ | ||
package com.gcms.v3.domain.auth.service; | ||
|
||
public interface CancelMembershipService { | ||
void execute(); | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/gcms/v3/domain/auth/service/impl/CancelMembershipServiceImpl.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,31 @@ | ||
package com.gcms.v3.domain.auth.service.impl; | ||
|
||
import com.gcms.v3.domain.auth.domain.repository.RefreshTokenRepository; | ||
import com.gcms.v3.domain.auth.service.CancelMembershipService; | ||
import com.gcms.v3.domain.user.domain.entity.User; | ||
import com.gcms.v3.domain.user.domain.repository.UserRepository; | ||
import com.gcms.v3.domain.user.domain.repository.UserRoleRepository; | ||
import com.gcms.v3.domain.user.util.UserUtil; | ||
import jakarta.transaction.Transactional; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional | ||
public class CancelMembershipServiceImpl implements CancelMembershipService { | ||
|
||
private final UserUtil userUtil; | ||
private final UserRepository userRepository; | ||
private final UserRoleRepository userRoleRepository; | ||
private final RefreshTokenRepository refreshTokenRepository; | ||
|
||
public void execute() { | ||
User user = userUtil.getCurrentUser(); | ||
|
||
refreshTokenRepository.deleteById(user.getEmail()); | ||
|
||
userRoleRepository.deleteByUser(user); | ||
userRepository.deleteById(user.getId()); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -42,9 +42,10 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti | |
|
||
.authorizeHttpRequests((authorizeRequests) -> | ||
authorizeRequests | ||
.requestMatchers(HttpMethod.POST, "/v3/auth").permitAll() | ||
.requestMatchers(HttpMethod.POST, "/v3/auth/reissueToken").authenticated() | ||
.requestMatchers(HttpMethod.DELETE, "/v3/auth/logout").authenticated() | ||
.requestMatchers(HttpMethod.POST, "/auth").permitAll() | ||
.requestMatchers(HttpMethod.POST, "/auth/reissueToken").authenticated() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๋ฆฌํ๋ ์ ํ ํฐ์ ์ฌ๋ฐ๊ธํ๋ ค๋ฉด ์ ๊ทผ ๊ถํ์ด permitAll์ด์ด์ผ ํ์ง ์์๊น ์ถ์ด์ |
||
.requestMatchers(HttpMethod.DELETE, "/auth/logout").authenticated() | ||
.requestMatchers(HttpMethod.DELETE, "/auth").authenticated() | ||
) | ||
|
||
.addFilterBefore(new ExceptionFilter(objectMapper), UsernamePasswordAuthenticationFilter.class) | ||
|
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.
๋ ๋์ค์ ์ ์ฅ๋๋ ๋ฆฌํ๋ ์ ํ ํฐ๋ ํจ๊ป ์ญ์ ํ๋ค๋ฉด ๋ ๊น๋ํ ํํด ์ฒ๋ฆฌ๊ฐ ๋ ๊ฒ ๊ฐ๋ค์