* 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 5777f65d Fixes #18329 * Auth: address review comment
Name |
Last commit
|
Last Update |
---|---|---|
.. | ||
auth_proxy | Loading commit data... | |
auth.go | Loading commit data... | |
auth_proxy.go | Loading commit data... | |
auth_test.go | Loading commit data... | |
dashboard_redirect.go | Loading commit data... | |
dashboard_redirect_test.go | Loading commit data... | |
headers.go | Loading commit data... | |
logger.go | Loading commit data... | |
middleware.go | Loading commit data... | |
middleware_basic_auth_test.go | Loading commit data... | |
middleware_test.go | Loading commit data... | |
org_redirect.go | Loading commit data... | |
org_redirect_test.go | Loading commit data... | |
perf.go | Loading commit data... | |
quota.go | Loading commit data... | |
quota_test.go | Loading commit data... | |
recovery.go | Loading commit data... | |
recovery_test.go | Loading commit data... | |
render_auth.go | Loading commit data... | |
request_metrics.go | Loading commit data... | |
request_tracing.go | Loading commit data... | |
testing.go | Loading commit data... | |
util.go | Loading commit data... | |
validate_host.go | Loading commit data... |