-
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
Feat/bsmOauth #82
Feat/bsmOauth #82
Conversation
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 ๊ด๋ จ ์ด์ BSM OAuthย #66 ์ ์ฝ์ด๋ณด์๊ณ ๋น ์ง ๋ถ๋ถ ๋ณด์ํด์ฃผ์ธ์ฉ(BSM ์ฐ๋, BSM service link ๊บผ๋ด์ค๊ธฐ ๋ฑ๋ฑ)
- CI details ํ์ธ ํ failed ๊ณ ์ณ์ฃผ์ธ์
- ์๋น์ค๋ ๋ค ๋ถ๋ฆฌํด์ ์์ฑํด์ฃผ์ธ์(BSM Service ํ๋์ ๋ค ๋ฐํ์์)
ํข ๋ง
- ์ ์ฒด์ ์ผ๋ก ์ฝ๋๋ฅผ ๊ฐ์ ์์ผ์ ๊ฒ ๊ฐ์๋ฐ ์ด๋ฐ ์ฌ์ํ ์ฌ์ํ ๋ณ๊ฒฝ๋ค ๊ณค๋ํฉ๋๋ค (์ฌ์ฒญ์ด๋ ์ด๋ฏธ ์๋น์ค์ค์ด๋ผ์, ํ๋ก ํธ์์ ์ฌ์ํ ๋ณ๊ฒฝ์ ์ ๋ค ๊ณ ์น๊ธฐ ํ๋ญ๋๋ค)
~~์ ํ์ จ๋์?
๊ฐ์ ๋ฆฌ๋ทฐ๋ ๊ณ ์น๋ผ๋ ๋ป์ด ์๋๋๋ค. ์ง์ง ๊ถ๊ธํด์ ๋ฌผ์ด๋ณด๋๊น ๋ต๋ณํด์ฃผ์ธ์ฉ
package com.soogung.simblue.domain.auth.domain; | ||
|
||
|
||
import lombok.*; |
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.
wildcard ์ฌ์ฉ์ ์ง์ํฉ๋๋ค
๊ด๋ จ ๊ธ ์ฝ์ด๋ณด์๊ณ ์์ ํด์ฃผ์ธ์
์ด๊ณณ๋ง๊ณ ๋ค๋ฅธ ๊ณณ๋!~
public RefreshToken update(final String refreshToken, final long ttl) { | ||
this.refreshToken = refreshToken; | ||
this.ttl = ttl; | ||
return this; |
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.
refresh token์ด ์์ ๋์ด์ผ ํ๋ ์ด์ ๋?
@Id | ||
private String token; | ||
private String id; | ||
|
||
private String refreshToken; |
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.
๊ตณ์ด id๋ฅผ ๋ฐ๋ก ๋๋ ์ด์ ๋ ๋ฌด์์ธ๊ฐ์? refresh token๋ ์ถฉ๋ถํ uniqueํ ํ ๋ฐ์ฉ
|
||
private String refreshToken; | ||
|
||
private String role; |
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.
role์ ์ ์ฅํ๋ ์ด์ ๋ ๋ญ๊ฐ์?
public BsmTokenResponse userSignup(HttpServletRequest request) throws IOException { | ||
return loginService.execute(request.getHeader("authCode")); |
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.
ํค๋๋ฅผ ๊บผ๋ด์ค๊ณ ์ถ์ ๊ฑฐ๋ฉด @RequestHeader
annotation์ ์ฌ์ฉํด์ ๊ฐ์ ธ์ฌ ์ ์๋ ๊ฑธ๋ก ์๊ณ ์์ต๋๋น
@Getter | ||
@ConstructorBinding | ||
@ConfigurationProperties(prefix = "jwt") | ||
public class JwtProperties { | ||
private final String header; | ||
private final String secret; | ||
private final Long accessExp; | ||
private final Long refreshExp; | ||
private final String prefix; | ||
|
||
public JwtProperties(String header, String secret, Long accessExp, Long refreshExp, String prefix) { | ||
this.header = header; | ||
this.secret = secret; | ||
this.accessExp = accessExp; | ||
this.refreshExp = refreshExp; | ||
this.prefix = prefix; | ||
} | ||
|
||
} | ||
|
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 String createAccessToken(String email) { | ||
return createToken(email, jwtProperties.getAccessTime()); | ||
return jwtProperties.getPrefix() + EMPTY.getMessage() + generateToken(authId, role, ACCESS_KEY.getMessage() ,jwtProperties.getAccessExp()); |
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.
prefix๋ฅผ ์ ๋ถ์ฌ์ ์ฃผ๋์ง
secret: ${JWT_SECRET} | ||
accessExp: 3600000 | ||
refreshExp: 2592000000 | ||
prefix: Bearer | ||
|
||
|
||
# refresh-time: 2592000000 # 30์ผ | ||
# access-time: 3600000 # 1์๊ฐ | ||
# prefix: Bearer | ||
# header: Authorization | ||
# secret-key: ${JWT_SECRET} |
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.
์๋ ๊ฑธ ์ ๋ฐ๊พธ๋์ง?
jpa: | ||
hibernate: | ||
ddl-auto: validate |
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.
validate๋ localํ๊ฒฝ์์ ์ฌ์ฉํ์ง ์ใด์ต๋๋ค
|
||
@Override | ||
protected void doFilterInternal(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { |
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.
request์ response์ null์ด ๋ค์ด์ค๋ ๊ฒฝ์ฐ๊ฐ ์๋์?
๐ Summary
๐จ Tasks
๐๐ป More
Google Oauth ๋ก๊ทธ์ธ ๋ฐ ํ์๊ฐ์ ๋ก์ง ์์