oauthtokentest

package
v0.0.0-testrgm6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockOauthTokenService

type MockOauthTokenService struct {
	GetCurrentOauthTokenFunc   func(ctx context.Context, usr *user.SignedInUser) *oauth2.Token
	IsOAuthPassThruEnabledFunc func(ds *datasources.DataSource) bool
	HasOAuthEntryFunc          func(ctx context.Context, usr *user.SignedInUser) (*login.UserAuth, bool, error)
	InvalidateOAuthTokensFunc  func(ctx context.Context, usr *login.UserAuth) error
	TryTokenRefreshFunc        func(ctx context.Context, usr *login.UserAuth) error
}

func (*MockOauthTokenService) GetCurrentOAuthToken

func (m *MockOauthTokenService) GetCurrentOAuthToken(ctx context.Context, usr *user.SignedInUser) *oauth2.Token

func (*MockOauthTokenService) HasOAuthEntry

func (m *MockOauthTokenService) HasOAuthEntry(ctx context.Context, usr *user.SignedInUser) (*login.UserAuth, bool, error)

func (*MockOauthTokenService) InvalidateOAuthTokens

func (m *MockOauthTokenService) InvalidateOAuthTokens(ctx context.Context, usr *login.UserAuth) error

func (*MockOauthTokenService) IsOAuthPassThruEnabled

func (m *MockOauthTokenService) IsOAuthPassThruEnabled(ds *datasources.DataSource) bool

func (*MockOauthTokenService) TryTokenRefresh

func (m *MockOauthTokenService) TryTokenRefresh(ctx context.Context, usr *login.UserAuth) error

type Service

type Service struct {
	Token *oauth2.Token
}

Service an OAuth token service suitable for tests.

func ProvideService

func ProvideService() *Service

ProvideService provides an OAuth token service suitable for tests.

func (*Service) GetCurrentOAuthToken

func (s *Service) GetCurrentOAuthToken(context.Context, *user.SignedInUser) *oauth2.Token

func (*Service) HasOAuthEntry

func (s *Service) HasOAuthEntry(context.Context, *user.SignedInUser) (*login.UserAuth, bool, error)

func (*Service) InvalidateOAuthTokens

func (s *Service) InvalidateOAuthTokens(context.Context, *login.UserAuth) error

func (*Service) IsOAuthPassThruEnabled

func (s *Service) IsOAuthPassThruEnabled(ds *datasources.DataSource) bool

func (*Service) TryTokenRefresh

func (s *Service) TryTokenRefresh(context.Context, *login.UserAuth) error

Jump to

Keyboard shortcuts

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