Transfer JWT perms properly

This commit is contained in:
Melon 2024-02-14 21:35:50 +00:00
parent 70a64f2657
commit a86ae8b4d5
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -37,9 +37,11 @@ func (j *JWTAccessGenerate) Token(ctx context.Context, data *oauth2.GenerateBasi
beginCtx.Rollback()
ps := claims.ParsePermStorage(roles)
var out *claims.PermStorage
out := claims.NewPermStorage()
ForEachRole(data.Client.(interface{ UsePerms() string }).UsePerms(), func(role string) {
out = ps.Filter(strings.Split(role, " "))
for _, i := range ps.Filter(strings.Split(role, " ")).Dump() {
out.Set(i)
}
})
access, err = j.signer.GenerateJwt(data.UserID, "", jwt.ClaimStrings{data.TokenInfo.GetClientID()}, data.TokenInfo.GetAccessExpiresIn(), auth.AccessTokenClaims{