|
|
|
@ -6,10 +6,32 @@ import ( |
|
|
|
|
"github.com/grafana/grafana/pkg/services/authn" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
var _ authn.Service = new(FakeService) |
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
|
|
type FakeClient struct { |
|
|
|
|