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
This commit is contained in:
Karl Persson
2022-12-02 15:10:03 +01:00
committed by GitHub
parent c52d4e2a64
commit 22be025284
12 changed files with 313 additions and 8 deletions
+16 -1
View File
@@ -1,7 +1,22 @@
package authntest
import "github.com/grafana/grafana/pkg/services/authn"
import (
"context"
"github.com/grafana/grafana/pkg/services/authn"
)
type FakeService struct {
authn.Service
}
var _ authn.Client = new(FakeClient)
type FakeClient struct {
ExpectedErr error
ExpectedIdentity *authn.Identity
}
func (f *FakeClient) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error) {
return f.ExpectedIdentity, f.ExpectedErr
}