mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AuthN: Add functions for fake (#65522)
This commit is contained in:
parent
7b92849508
commit
d4397fae25
@ -6,10 +6,32 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/authn"
|
"github.com/grafana/grafana/pkg/services/authn"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ authn.Service = new(FakeService)
|
||||||
|
|
||||||
type FakeService struct {
|
type FakeService struct {
|
||||||
authn.Service
|
ExpectedErr error
|
||||||
|
ExpectedRedirect *authn.Redirect
|
||||||
|
ExpectedIdentity *authn.Identity
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f FakeService) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error) {
|
||||||
|
return f.ExpectedIdentity, f.ExpectedErr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FakeService) RegisterPostAuthHook(hook authn.PostAuthHookFn, priority uint) {}
|
||||||
|
|
||||||
|
func (f FakeService) Login(ctx context.Context, client string, r *authn.Request) (*authn.Identity, error) {
|
||||||
|
return f.ExpectedIdentity, f.ExpectedErr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FakeService) RegisterPostLoginHook(hook authn.PostLoginHookFn, priority uint) {}
|
||||||
|
|
||||||
|
func (f FakeService) RedirectURL(ctx context.Context, client string, r *authn.Request) (*authn.Redirect, error) {
|
||||||
|
return f.ExpectedRedirect, f.ExpectedErr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FakeService) RegisterClient(c authn.Client) {}
|
||||||
|
|
||||||
var _ authn.ContextAwareClient = new(FakeClient)
|
var _ authn.ContextAwareClient = new(FakeClient)
|
||||||
|
|
||||||
type FakeClient struct {
|
type FakeClient struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user