authntest

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 4 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]any
}

func (*FakeClient) Authenticate

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

func (FakeClient) IsEnabled

func (f FakeClient) IsEnabled() bool

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]any, 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) IsEnabled

func (f FakeRedirectClient) IsEnabled() bool

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) IsClientEnabled

func (f *FakeService) IsClientEnabled(name string) bool

func (*FakeService) Login

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

func (*FakeService) Logout

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) RegisterPreLogoutHook

func (f *FakeService) RegisterPreLogoutHook(hook authn.PreLogoutHookFn, priority uint)

func (*FakeService) ResolveIdentity

func (f *FakeService) ResolveIdentity(ctx context.Context, orgID int64, namespaceID authn.NamespaceID) (*authn.Identity, error)

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
	LogoutFunc          func(ctx context.Context, user identity.Requester) (*authn.Redirect, bool)
	NamespaceFunc       func() string
	ResolveIdentityFunc func(ctx context.Context, orgID int64, namespaceID authn.NamespaceID) (*authn.Identity, 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) IsEnabled

func (m MockClient) IsEnabled() bool

func (*MockClient) Logout

func (m *MockClient) Logout(ctx context.Context, user identity.Requester) (*authn.Redirect, bool)

func (MockClient) Name

func (m MockClient) Name() string

func (*MockClient) Namespace

func (m *MockClient) Namespace() string

func (MockClient) Priority

func (m MockClient) Priority() uint

func (*MockClient) ResolveIdentity

func (m *MockClient) ResolveIdentity(ctx context.Context, orgID int64, namespaceID authn.NamespaceID) (*authn.Identity, error)

ResolveIdentity implements authn.IdentityResolverClient.

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
	RegisterPostAuthHookFunc func(hook authn.PostAuthHookFn, priority uint)
}

func (*MockService) Authenticate

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

func (*MockService) IsClientEnabled

func (m *MockService) IsClientEnabled(name string) bool

func (*MockService) Login

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

func (*MockService) Logout

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) RegisterPreLogoutHook

func (m *MockService) RegisterPreLogoutHook(hook authn.PreLogoutHookFn, priority uint)

func (*MockService) ResolveIdentity

func (m *MockService) ResolveIdentity(ctx context.Context, orgID int64, namespaceID authn.NamespaceID) (*authn.Identity, error)

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