Commit Graph

7 Commits

Author SHA1 Message Date
Karl Persson
95ea4bad6f
AuthN: Rebuild Authenticate so we only have to call it once in context handler (#61705)
* API: Add reqSignedIn to router groups

* AuthN: Add fall through in context handler

* AuthN: Add IsAnonymous field

* AuthN: add priority to context aware clients

* ContextHandler: Add comment

* AuthN: Add a simple priority queue

* AuthN: Add Name to client interface

* AuthN: register clients with function

* AuthN: update mock and fake to implement interface

* AuthN: rewrite test without reflection

* AuthN: add comment

* AuthN: fix queue insert

* AuthN: rewrite tests

* AuthN: make the queue generic so we can reuse it for hooks

* ContextHandler: Add fixme for auth headers

* AuthN: remove unused variable

* AuthN: use multierror

* AuthN: write proper tests for queue

* AuthN: Add queue item that can store the value and priority

Co-authored-by: Jo <joao.guerreiro@grafana.com>
2023-01-26 10:50:44 +01:00
Karl Persson
50608db59a
AuthN: Add interface and function to operate on clients that supports redirects (#61905) 2023-01-23 11:54:38 +01:00
Karl Persson
0d572ff2ce
AuthN: Add check for disabled identities (#61382)
* AuthN: return error if identity is disabled

* AuthN: Remove isDisabled check in client

* AuthN: Format imports
2023-01-13 10:28:50 +01:00
Karl Persson
2de72c1c39
AuthN: Login (#61225)
* AuthN: Add function to login auth request
2023-01-10 14:55:27 +01:00
Karl Persson
c4b4baea2a
AuthN: set org id for authentication request in service (#60528)
* AuthN: Replicate functionallity to get org id for request

* Authn: parse org id for the request and populate the auth request with
it

* AuthN: add simple mock for client to use in test

* AuthN: add tests to verify that authentication is called with correct
org id

* AuthN: Add ClientParams to mock

* AuthN: Fix flaky org id selection
2022-12-20 21:18:48 +01:00
Karl Persson
2e53a58bc3
Authn: Add client for api keys (#60339)
* AuthN: Add functionallity to test if auth client should be used

* AuthN: Add bolierplate client for api keys and register it

* AuthN: Add tests for api key client

* Inject service

* AuthN: Update client names

* ContextHandler: Set authn service

* AuthN: Implement authentication for api key client

* ContextHandler: Use authn service for api keys if flag is enabled

* AuthN: refactor authentication method to return additional value to
indicate if client could perform authentication

* update prefixes

* Add namespaced id to identity

* AuthN: Expand the Identity struct to include required fields from signed
in user

* Add error for disabled service account

* Add function to write error response based on errutil.Error

* Add error to log

* Return errors based on errutil.Error

* pass error

* update log message

* Fix namespaced ids

* Add tests

* Lint
2022-12-19 09:22:11 +01:00
Karl Persson
22be025284
Auth: Add anonymous authn client (#59637)
* Authn: Add Client interface and Reqeust and Identity structures

* Authn: Implement Authenticate method in service

* Authn: Add tracing

* Authn: Add logger

* AuthN: Implement Anonymous client
2022-12-02 15:10:03 +01:00