From 3ca8fb3accb5665e889fce60147b1c577b4616f5 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 22 Nov 2016 19:12:19 +0000 Subject: [PATCH] Ensure $auth.scope is preset on auth variable --- web/auth.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/auth.go b/web/auth.go index 4b32aa5c..3e753464 100644 --- a/web/auth.go +++ b/web/auth.go @@ -140,15 +140,17 @@ func auth() fibre.MiddlewareFunc { if nok && dok && sok && tok { + scp := mem.GetNS(nsv).GetDB(dbv).GetSC(scv) + auth.Data["scope"] = scp.Name + if tkv != "default" { - key := mem.GetNS(nsv).GetDB(dbv).GetSC(scv).GetTK(tkv) + key := scp.GetTK(tkv) if token.Header["alg"] != key.Type { return nil, fmt.Errorf("Unexpected signing method") } auth.Kind = sql.AuthSC return key.Code, nil } else { - scp := mem.GetNS(nsv).GetDB(dbv).GetSC(scv) auth.Kind = sql.AuthSC return scp.Code, nil }