mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AuthN: Refactor basic auth client to support multiple password auth (#61153)
* AuthN: add interface for password clients * AuthN: Extract grafana password client * AuthN: Rewrite basic client tests * AuthN: Add Ldap client and rename method of PasswordClient * AuthN: Configure multiple password clients * AuthN: create ldap service and add tests
This commit is contained in:
@@ -13,10 +13,9 @@ type FakeService struct {
|
||||
var _ authn.Client = new(FakeClient)
|
||||
|
||||
type FakeClient struct {
|
||||
ExpectedErr error
|
||||
ExpectedTest bool
|
||||
ExpectedIdentity *authn.Identity
|
||||
ExpectedClientParams *authn.ClientParams
|
||||
ExpectedErr error
|
||||
ExpectedTest bool
|
||||
ExpectedIdentity *authn.Identity
|
||||
}
|
||||
|
||||
func (f *FakeClient) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error) {
|
||||
@@ -26,3 +25,14 @@ func (f *FakeClient) Authenticate(ctx context.Context, r *authn.Request) (*authn
|
||||
func (f *FakeClient) Test(ctx context.Context, r *authn.Request) bool {
|
||||
return f.ExpectedTest
|
||||
}
|
||||
|
||||
var _ authn.PasswordClient = new(FakePasswordClient)
|
||||
|
||||
type FakePasswordClient struct {
|
||||
ExpectedErr error
|
||||
ExpectedIdentity *authn.Identity
|
||||
}
|
||||
|
||||
func (f FakePasswordClient) AuthenticatePassword(ctx context.Context, orgID int64, username, password string) (*authn.Identity, error) {
|
||||
return f.ExpectedIdentity, f.ExpectedErr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user