authntest

package
v0.0.0-...-fb7f86c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeClient

type FakeClient struct {
	ExpectedName     string
	ExpectedErr      error
	ExpectedTest     bool
	ExpectedPriority uint
	ExpectedIdentity *authn.Identity
	ExpectedStats    map[string]interface{}
}

func (*FakeClient) Authenticate

func (f *FakeClient) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error)

func (*FakeClient) Name

func (f *FakeClient) Name() string

func (*FakeClient) Priority

func (f *FakeClient) Priority() uint

func (*FakeClient) Test

func (f *FakeClient) Test(ctx context.Context, r *authn.Request) bool

func (*FakeClient) UsageStatFn

func (f *FakeClient) UsageStatFn(ctx context.Context) (map[string]interface{}, error)

type FakePasswordClient

type FakePasswordClient struct {
	ExpectedErr      error
	ExpectedIdentity *authn.Identity
}

func (FakePasswordClient) AuthenticatePassword

func (f FakePasswordClient) AuthenticatePassword(ctx context.Context, r *authn.Request, username, password string) (*authn.Identity, error)

type FakeRedirectClient

type FakeRedirectClient struct {
	ExpectedErr      error
	ExpectedURL      string
	ExpectedName     string
	ExpectedOK       bool
	ExpectedRedirect *authn.Redirect
	ExpectedIdentity *authn.Identity
}

func (FakeRedirectClient) Authenticate

func (f FakeRedirectClient) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error)

func (FakeRedirectClient) Name

func (f FakeRedirectClient) Name() string

func (FakeRedirectClient) RedirectURL

func (f FakeRedirectClient) RedirectURL(ctx context.Context, r *authn.Request) (*authn.Redirect, error)

func (FakeRedirectClient) Test

type FakeService

type FakeService struct {
	ExpectedErr        error
	ExpectedRedirect   *authn.Redirect
	ExpectedIdentity   *authn.Identity
	ExpectedErrs       []error
	ExpectedIdentities []*authn.Identity
	CurrentIndex       int
}

func (*FakeService) Authenticate

func (f *FakeService) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error)

func (*FakeService) Login

func (f *FakeService) Login(ctx context.Context, client string, r *authn.Request) (*authn.Identity, error)

func (*FakeService) RedirectURL

func (f *FakeService) RedirectURL(ctx context.Context, client string, r *authn.Request) (*authn.Redirect, error)

func (*FakeService) RegisterClient

func (f *FakeService) RegisterClient(c authn.Client)

func (*FakeService) RegisterPostAuthHook

func (f *FakeService) RegisterPostAuthHook(hook authn.PostAuthHookFn, priority uint)

func (*FakeService) RegisterPostLoginHook

func (f *FakeService) RegisterPostLoginHook(hook authn.PostLoginHookFn, priority uint)

func (*FakeService) SyncIdentity

func (f *FakeService) SyncIdentity(ctx context.Context, identity *authn.Identity) error

type MockClient

type MockClient struct {
	NameFunc         func() string
	AuthenticateFunc func(ctx context.Context, r *authn.Request) (*authn.Identity, error)
	TestFunc         func(ctx context.Context, r *authn.Request) bool
	PriorityFunc     func() uint
	HookFunc         func(ctx context.Context, identity *authn.Identity, r *authn.Request) error
}

func (MockClient) Authenticate

func (m MockClient) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error)

func (MockClient) Hook

func (m MockClient) Hook(ctx context.Context, identity *authn.Identity, r *authn.Request) error

func (MockClient) Name

func (m MockClient) Name() string

func (MockClient) Priority

func (m MockClient) Priority() uint

func (MockClient) Test

func (m MockClient) Test(ctx context.Context, r *authn.Request) bool

type MockProxyClient

type MockProxyClient struct {
	AuthenticateProxyFunc func(ctx context.Context, r *authn.Request, username string, additional map[string]string) (*authn.Identity, error)
}

func (MockProxyClient) AuthenticateProxy

func (m MockProxyClient) AuthenticateProxy(ctx context.Context, r *authn.Request, username string, additional map[string]string) (*authn.Identity, error)

type MockService

type MockService struct {
	SyncIdentityFunc func(ctx context.Context, identity *authn.Identity) error
}

func (*MockService) Authenticate

func (m *MockService) Authenticate(ctx context.Context, r *authn.Request) (*authn.Identity, error)

func (*MockService) Login

func (m *MockService) Login(ctx context.Context, client string, r *authn.Request) (*authn.Identity, error)

func (*MockService) RedirectURL

func (m *MockService) RedirectURL(ctx context.Context, client string, r *authn.Request) (*authn.Redirect, error)

func (*MockService) RegisterClient

func (m *MockService) RegisterClient(c authn.Client)

func (*MockService) RegisterPostAuthHook

func (m *MockService) RegisterPostAuthHook(hook authn.PostAuthHookFn, priority uint)

func (*MockService) RegisterPostLoginHook

func (m *MockService) RegisterPostLoginHook(hook authn.PostLoginHookFn, priority uint)

func (*MockService) SyncIdentity

func (m *MockService) SyncIdentity(ctx context.Context, identity *authn.Identity) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL