mirror of
https://github.com/1f349/lavender.git
synced 2024-11-13 23:21:38 +00:00
Transfer JWT perms properly
This commit is contained in:
parent
70a64f2657
commit
a86ae8b4d5
@ -37,9 +37,11 @@ func (j *JWTAccessGenerate) Token(ctx context.Context, data *oauth2.GenerateBasi
|
|||||||
beginCtx.Rollback()
|
beginCtx.Rollback()
|
||||||
|
|
||||||
ps := claims.ParsePermStorage(roles)
|
ps := claims.ParsePermStorage(roles)
|
||||||
var out *claims.PermStorage
|
out := claims.NewPermStorage()
|
||||||
ForEachRole(data.Client.(interface{ UsePerms() string }).UsePerms(), func(role string) {
|
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{
|
access, err = j.signer.GenerateJwt(data.UserID, "", jwt.ClaimStrings{data.TokenInfo.GetClientID()}, data.TokenInfo.GetAccessExpiresIn(), auth.AccessTokenClaims{
|
||||||
|
Loading…
Reference in New Issue
Block a user