-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature/#39 add logout #40
Conversation
backend/src/main/java/org/mapleleaf/backend/exception/JwtAuthenticationEntryPoint.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/org/mapleleaf/backend/jwt/JwtAuthenticationFilter.java
Outdated
Show resolved
Hide resolved
public Long getExpiration(String token) { | ||
Date expiration = Jwts.parser().setSigningKey(Base64.getEncoder().encodeToString(secretKey.getBytes())) | ||
.parseClaimsJws(token).getBody().getExpiration(); | ||
|
||
Long now = new Date().getTime(); | ||
return (expiration.getTime() - now); | ||
} |
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.
함수 이름을 보면 expiration을 줄 것 같지만 실제 구현은 그렇지 않네요, 메서드 이름을 변경하거나 반환하는 로직을 변경해야 할 것 같아요.
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.
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.
만료 기간 그대로 반환하는것이 아니고 계산해서 반환해주니 후자 getExpirationTime
이 좋을 것 같아요
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.
수정했습니다 ! 😄 반환 값에 맞는 함수명이 맞는지 더 신경쓰면서 코드 작성하겠습니답 ~!
public boolean isTokenLogout(String token) { | ||
String isLogout = (String) redisTemplate.opsForValue().get(token); | ||
if (StringUtils.hasText(isLogout)) throw new LoggedOutTokenException(); | ||
return true; | ||
} |
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.
public boolean isTokenLogout(String token) { | |
String isLogout = (String) redisTemplate.opsForValue().get(token); | |
if (StringUtils.hasText(isLogout)) throw new LoggedOutTokenException(); | |
return true; | |
} | |
public boolean isTokenLogout(String token) { | |
String isLogout = (String) redisTemplate.opsForValue().get(token); | |
return !StringUtils.hasText(isLogout); | |
} |
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.
요건 그대로인데 어떻게 하기로 결정하셨나요?
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.
이것은 제가 주말에 다시 고민해보고 수정해도 괜찮을까요?
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.
요건 만약에 진행하신다면 별도 이슈를 만들어서 하시죠~
backend/src/main/java/org/mapleleaf/backend/exception/JwtAuthenticationEntryPoint.java
Outdated
Show resolved
Hide resolved
public boolean isTokenLogout(String token) { | ||
String isLogout = (String) redisTemplate.opsForValue().get(token); | ||
if (StringUtils.hasText(isLogout)) throw new LoggedOutTokenException(); | ||
return true; | ||
} |
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.
요건 그대로인데 어떻게 하기로 결정하셨나요?
403: 권한 없음, 401: 인증 실패
로그인 성공 후 answer 조회

토큰과 함께 로그아웃 요청

로그아웃 시 사용한 토큰으로 answer 조회
