mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Authn: Only resolve org id once (#78811)
This commit is contained in:
parent
21f94c5b78
commit
687ffb4a0c
@ -191,6 +191,8 @@ func (s *Service) Authenticate(ctx context.Context, r *authn.Request) (*authn.Id
|
|||||||
ctx, span := s.tracer.Start(ctx, "authn.Authenticate")
|
ctx, span := s.tracer.Start(ctx, "authn.Authenticate")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
|
r.OrgID = orgIDFromRequest(r)
|
||||||
|
|
||||||
var authErr error
|
var authErr error
|
||||||
for _, item := range s.clientQueue.items {
|
for _, item := range s.clientQueue.items {
|
||||||
if item.v.Test(ctx, r) {
|
if item.v.Test(ctx, r) {
|
||||||
@ -223,7 +225,6 @@ func (s *Service) Authenticate(ctx context.Context, r *authn.Request) (*authn.Id
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) authenticate(ctx context.Context, c authn.Client, r *authn.Request) (*authn.Identity, error) {
|
func (s *Service) authenticate(ctx context.Context, c authn.Client, r *authn.Request) (*authn.Identity, error) {
|
||||||
r.OrgID = orgIDFromRequest(r)
|
|
||||||
identity, err := c.Authenticate(ctx, r)
|
identity, err := c.Authenticate(ctx, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.errorLogFunc(ctx, err)("Failed to authenticate request", "client", c.Name(), "error", err)
|
s.errorLogFunc(ctx, err)("Failed to authenticate request", "client", c.Name(), "error", err)
|
||||||
@ -268,6 +269,8 @@ func (s *Service) Login(ctx context.Context, client string, r *authn.Request) (i
|
|||||||
))
|
))
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
|
r.OrgID = orgIDFromRequest(r)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
for _, hook := range s.postLoginHooks.items {
|
for _, hook := range s.postLoginHooks.items {
|
||||||
hook.v(ctx, identity, r, err)
|
hook.v(ctx, identity, r, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user