authtest

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.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 MockAuth

type MockAuth struct {
	StartDeviceAuthFunc                 func(ctx context.Context) (*auth.DeviceAuth, error)
	WaitForAuthFunc                     func(ctx context.Context, deviceCode string, interval time.Duration) (*auth.Result, error)
	IsAuthenticatedFunc                 func() bool
	GetAccessTokenFunc                  func(ctx context.Context) (string, error)
	GetUserIDFunc                       func(ctx context.Context) (string, error)
	ClearTokensFunc                     func() error
	RefreshTokenWithoutOrganizationFunc func(ctx context.Context) (string, error)
	RefreshTokenWithOrganizationFunc    func(ctx context.Context, workosOrgID domain.WorkosOrganizationID) (string, error)
}

MockAuth implements auth.Auth for testing.

func (*MockAuth) ClearTokens

func (m *MockAuth) ClearTokens() error

func (*MockAuth) GetAccessToken

func (m *MockAuth) GetAccessToken(ctx context.Context) (string, error)

func (*MockAuth) GetUserID

func (m *MockAuth) GetUserID(ctx context.Context) (string, error)

func (*MockAuth) IsAuthenticated

func (m *MockAuth) IsAuthenticated() bool

func (*MockAuth) RefreshTokenWithOrganization

func (m *MockAuth) RefreshTokenWithOrganization(ctx context.Context, workosOrgID domain.WorkosOrganizationID) (string, error)

func (*MockAuth) RefreshTokenWithoutOrganization

func (m *MockAuth) RefreshTokenWithoutOrganization(ctx context.Context) (string, error)

func (*MockAuth) StartDeviceAuth

func (m *MockAuth) StartDeviceAuth(ctx context.Context) (*auth.DeviceAuth, error)

func (*MockAuth) WaitForAuth

func (m *MockAuth) WaitForAuth(ctx context.Context, deviceCode string, interval time.Duration) (*auth.Result, error)

type MockOAuthProvider

type MockOAuthProvider struct {
	AuthorizeDeviceFunc              func(ctx context.Context) (*auth.DeviceAuthResponse, error)
	PollAuthenticationFunc           func(ctx context.Context, deviceCode string) (*auth.AuthenticationResponse, error)
	RefreshTokenFunc                 func(ctx context.Context, refreshToken string) (*auth.RefreshResponse, error)
	RefreshTokenWithOrganizationFunc func(ctx context.Context, refreshToken string, organizationID domain.WorkosOrganizationID) (*auth.RefreshResponse, error)
}

MockOAuthProvider is a test double for auth.OAuthProvider.

func (*MockOAuthProvider) AuthorizeDevice

func (m *MockOAuthProvider) AuthorizeDevice(ctx context.Context) (*auth.DeviceAuthResponse, error)

func (*MockOAuthProvider) PollAuthentication

func (m *MockOAuthProvider) PollAuthentication(ctx context.Context, deviceCode string) (*auth.AuthenticationResponse, error)

func (*MockOAuthProvider) RefreshToken

func (m *MockOAuthProvider) RefreshToken(ctx context.Context, refreshToken string) (*auth.RefreshResponse, error)

func (*MockOAuthProvider) RefreshTokenWithOrganization

func (m *MockOAuthProvider) RefreshTokenWithOrganization(ctx context.Context, refreshToken string, organizationID domain.WorkosOrganizationID) (*auth.RefreshResponse, error)

type MockSecureStorage

type MockSecureStorage struct {
	GetFunc    func(key string) (string, error)
	SetFunc    func(key string, value string) error
	DeleteFunc func(key string) error
}

MockSecureStorage is a test double for auth.SecureStorage.

func (*MockSecureStorage) Delete

func (m *MockSecureStorage) Delete(key string) error

func (*MockSecureStorage) Get

func (m *MockSecureStorage) Get(key string) (string, error)

func (*MockSecureStorage) Set

func (m *MockSecureStorage) Set(key string, value string) error

Jump to

Keyboard shortcuts

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