AuthN: Add functions for fake (#65522)

pull/65531/head
Karl Persson 2 years ago committed by GitHub
parent 7b92849508
commit d4397fae25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      pkg/services/authn/authntest/fake.go

@ -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 {

Loading…
Cancel
Save