tests

package
v1.50.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegistry

func NewRegistry(providers ...types.OAuth2Provider) *services.ProviderRegistry

NewRegistry returns a registry containing the provided providers.

Types

type MockProvider

type MockProvider struct {
	ProviderName string
	PKCE         bool
	UserInfo     *types.UserInfo
	UserInfoErr  error
	Token        *oauth2.Token
	ExchangeErr  error

	ExchangeCode string
	ExchangeOpts []oauth2.AuthCodeOption
	AuthOptions  []oauth2.AuthCodeOption
}

MockProvider is a configurable OAuth2 provider used by OAuth2 plugin tests.

func (*MockProvider) Exchange

func (p *MockProvider) Exchange(_ context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

func (*MockProvider) GetAuthURL

func (p *MockProvider) GetAuthURL(state string, opts ...oauth2.AuthCodeOption) string

func (*MockProvider) GetConfig

func (p *MockProvider) GetConfig() *oauth2.Config

func (*MockProvider) GetUserInfo

func (p *MockProvider) GetUserInfo(_ context.Context, _ *oauth2.Token) (*types.UserInfo, error)

func (*MockProvider) Name

func (p *MockProvider) Name() string

func (*MockProvider) RequiresPKCE

func (p *MockProvider) RequiresPKCE() bool

Jump to

Keyboard shortcuts

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