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

Add json exp #699

Merged
merged 6 commits into from
Sep 18, 2024
Merged

Add json exp #699

merged 6 commits into from
Sep 18, 2024

Conversation

feiniks
Copy link
Contributor

@feiniks feiniks commented Sep 14, 2024

No description provided.

return nil
}

func GenJWTToken(repoID, user string, isInternal bool) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

从逻辑上说,seahub internal API 的 jwt 和 notification server 的 jwt 是没有关系的。所以应该分为两个函数比较清晰。Claims 数据结构也应该分开。


// seahub
SeahubURL string
PrivateKey string
Copy link
Member

Choose a reason for hiding this comment

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

这个改为 JWTPrivateKey


func GenNotifJWTToken(repoID, user string) (string, error) {
claims := new(MyClaims)
claims.Exp = time.Now().Add(time.Hour * 72).Unix()
Copy link
Member

Choose a reason for hiding this comment

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

这个超时应该可以用 300 秒吧。C 部分的也改一下。


func GenNotifJWTToken(repoID, user string, exp int64) (string, error) {
claims := new(MyClaims)
claims.Exp = time.Now().Add(time.Hour * 72).Unix()
Copy link
Member

Choose a reason for hiding this comment

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

这一行应该是多余的吧?

@killing killing merged commit 61126d1 into master Sep 18, 2024
6 checks passed
@killing killing deleted the add_exp branch September 18, 2024 09:59
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.

2 participants