mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Auth: Do not search for the user twice
Previously `initContextWithBasicAuth` did not use `LoginUserQuery`, doing
`GetUserByLoginQuery` only i.e. looking user in DB only, things changed when
this function started to check LDAP provider via `LoginUserQuery` (#6940),
however, this request was placed after `GetUserByLoginQuery`, so we first
looking in DB then in the LDAP - if LDAP user hasn't logged in we will
not find it in DB, so `LoginUserQuery` will never be reached.
`LoginUserQuery` request already performs `GetUserByLoginQuery`
request in correct sequence. So we can just remove redundant request.
* Correct sequence execution during authentification &
introduce tests for it
* Move basic auth tests to separate test file, since main test file already
pretty large
* Introduce `testing.go` for the middleware module
* Remove redundant test helper function
* Make handler names more explicit
Ref
|
||
---|---|---|
.. | ||
auth_proxy | ||
auth_proxy.go | ||
auth_test.go | ||
auth.go | ||
dashboard_redirect_test.go | ||
dashboard_redirect.go | ||
headers.go | ||
logger.go | ||
middleware_basic_auth_test.go | ||
middleware_test.go | ||
middleware.go | ||
org_redirect_test.go | ||
org_redirect.go | ||
perf.go | ||
quota_test.go | ||
quota.go | ||
recovery_test.go | ||
recovery.go | ||
render_auth.go | ||
request_metrics.go | ||
request_tracing.go | ||
testing.go | ||
util.go | ||
validate_host.go |