Ensure $auth.scope is preset on auth variable
This commit is contained in:
parent
2406256417
commit
3ca8fb3acc
1 changed files with 4 additions and 2 deletions
|
@ -140,15 +140,17 @@ func auth() fibre.MiddlewareFunc {
|
||||||
|
|
||||||
if nok && dok && sok && tok {
|
if nok && dok && sok && tok {
|
||||||
|
|
||||||
|
scp := mem.GetNS(nsv).GetDB(dbv).GetSC(scv)
|
||||||
|
auth.Data["scope"] = scp.Name
|
||||||
|
|
||||||
if tkv != "default" {
|
if tkv != "default" {
|
||||||
key := mem.GetNS(nsv).GetDB(dbv).GetSC(scv).GetTK(tkv)
|
key := scp.GetTK(tkv)
|
||||||
if token.Header["alg"] != key.Type {
|
if token.Header["alg"] != key.Type {
|
||||||
return nil, fmt.Errorf("Unexpected signing method")
|
return nil, fmt.Errorf("Unexpected signing method")
|
||||||
}
|
}
|
||||||
auth.Kind = sql.AuthSC
|
auth.Kind = sql.AuthSC
|
||||||
return key.Code, nil
|
return key.Code, nil
|
||||||
} else {
|
} else {
|
||||||
scp := mem.GetNS(nsv).GetDB(dbv).GetSC(scv)
|
|
||||||
auth.Kind = sql.AuthSC
|
auth.Kind = sql.AuthSC
|
||||||
return scp.Code, nil
|
return scp.Code, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue