Skip to content

Commit

Permalink
Merge pull request #116 from 1223v/test
Browse files Browse the repository at this point in the history
Fix: 액세스 토큰 삭제 기능 추가
  • Loading branch information
1223v authored Dec 1, 2023
2 parents 35fda84 + d078a82 commit 17ced30
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ public class UserServiceImpl implements UserService {
private final UserMapper userMapper;
@Value("${jwt.refresh.cookie}")
private String refreshCookie;
@Value("${jwt.access.cookie}")
private String accessToken;
@Value("${service.app.admin.key}")
private String serviceAppAdminKey;
@Value("${jwt.access.cookie.domain}")
private String accessCookieDomain;
@Value("${jwt.refresh.cookie.domain}")
private String refreshCookieDomain;

@Override
public UserAuthRes getUserAuthByCustomUserDetails(CustomUserDetails userDetails) {
Expand Down Expand Up @@ -90,8 +96,14 @@ private void invalidateRefreshTokenCookie(HttpServletResponse response) {
Cookie refreshTokenCookie = new Cookie(refreshCookie, null); // 쿠키 이름을 동일하게 설정
refreshTokenCookie.setHttpOnly(true);
refreshTokenCookie.setPath("/api/v1/refresh/token"); // 기존과 동일한 경로 설정
refreshTokenCookie.setDomain(refreshCookieDomain);
refreshTokenCookie.setMaxAge(0); // 만료 시간을 0으로 설정하여 즉시 만료
response.addCookie(refreshTokenCookie);
Cookie accessTokenCookie = new Cookie(accessToken, null); // 쿠키 이름을 동일하게 설정
accessTokenCookie.setPath("/"); // 기존과 동일한 경로 설정
accessTokenCookie.setDomain(accessCookieDomain);
accessTokenCookie.setMaxAge(0); // 만료 시간을 0으로 설정하여 즉시 만료
response.addCookie(accessTokenCookie);
}

private UserInfo getUserInfo(Long id) {
Expand Down

0 comments on commit 17ced30

Please sign in to comment.