Skip to content
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: add jwt implement #99

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

SmilingSea
Copy link

@SmilingSea SmilingSea commented Nov 13, 2024

fix: #72

@SmilingSea SmilingSea mentioned this pull request Nov 13, 2024
@SmilingSea SmilingSea marked this pull request as ready for review November 26, 2024 13:55
@SmilingSea SmilingSea requested review from jiuxia211, ozline and a team as code owners November 26, 2024 13:55
@ozline
Copy link
Member

ozline commented Nov 26, 2024

pr 交上来后自查一下 pipeline 有没有过,比如你该改点 lint 了

@emptyOVO emptyOVO changed the title [WIP] feat: add jwt implement feat: add jwt implement Nov 27, 2024
Copy link
Contributor

@jiuxia211 jiuxia211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看完pr我还有一个疑问:claims 里的数据是怎么写入上下文context的?

idl/api.thrift Outdated Show resolved Hide resolved
api/middleware/jwt.go Outdated Show resolved Hide resolved
api/middleware/jwt.go Outdated Show resolved Hide resolved
api/middleware/jwt.go Outdated Show resolved Hide resolved
api/middleware/jwt.go Show resolved Hide resolved
@SmilingSea
Copy link
Author

SmilingSea commented Nov 29, 2024

看完pr我还有一个疑问:claims 里的数据是怎么写入上下文context的?

image
在源码里面LoginHandler方法中生成token的过程中会直接调用payloadFunc方法来将claims封装到token当中,随着LoginResponse将token返回出来,所以claims应该没有进入上下文

同时在拦截的中间件源码中是通过请求中获取到的token来解析出claims,并没有通过上下文来直接获取claims。
image
image
image

Copy link
Member

@SchwarzSail SchwarzSail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

服务端鉴权中间件设计
4 participants