Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
refactor: 요청의 인증 정보를 컨트롤러에서 원하는 형태로 받을 수 있도록#171
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
86f4eec262f2a9c5c692ce017f677362f1cc98c996a47c9f5e064bed9f1ed607bc4f8323073a8215f9fac48b4127a43316c7160fb69d54087c27acf4c0c0f19b3481165932d6e182af478657895a0b99eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,6 +2,7 @@ | ||
| import com.example.solidconnection.auth.domain.TokenType; | ||
| import com.example.solidconnection.config.security.JwtProperties; | ||
| import com.example.solidconnection.siteuser.domain.SiteUser; | ||
| import io.jsonwebtoken.Claims; | ||
| import io.jsonwebtoken.Jwts; | ||
| import io.jsonwebtoken.SignatureAlgorithm; | ||
| @@ -12,8 +13,8 @@ | ||
| import java.util.Date; | ||
| import java.util.concurrent.TimeUnit; | ||
| import static com.example.solidconnection.util.JwtUtils.parseSubjectIgnoringExpiration; | ||
| import static com.example.solidconnection.util.JwtUtils.parseSubject; | ||
| import static com.example.solidconnection.util.JwtUtils.parseSubjectIgnoringExpiration; | ||
| @RequiredArgsConstructor | ||
| @Component | ||
| @@ -22,8 +23,13 @@ public class TokenProvider { | ||
| private final RedisTemplate<String, String> redisTemplate; | ||
| private final JwtProperties jwtProperties; | ||
| public String generateToken(String email, TokenType tokenType) { | ||
| Claims claims = Jwts.claims().setSubject(email); | ||
| public String generateToken(SiteUser siteUser, TokenType tokenType) { | ||
Member 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. 오버로딩을 하신건 아직 email을 사용하는 로직이 남아있어서 그런건가요? CollaboratorAuthor 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. 아뇨 가입 시 발급하는 토큰을 만들 때, String을 인자로 받아서 그랬습니다. 이 부분 헷갈릴 수 있으니 분리하는게 좋겠네요! 짚어주셔서 감사합니다😊 | ||
| String subject = siteUser.getId().toString(); | ||
| return generateToken(subject, tokenType); | ||
| } | ||
| public String generateToken(String string, TokenType tokenType) { | ||
| Claims claims = Jwts.claims().setSubject(string); | ||
| Date now = new Date(); | ||
| Date expiredDate = new Date(now.getTime() + tokenType.getExpireTime()); | ||
| return Jwts.builder() | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
이 PR에서는 SignUpService 나 SignInService 같은 코드들을 가입의 종류가 다양하도록 바꾸진 않았어요.
그래서 일단 카카오 인증만 다루면서 함수 이름이 signUp인 등.. 만족스럽지 않은 부분들이 있긴 한데,
이 부분은 다른 가입 방식을 추가하며 구현해보겠습니다.