authnmock

package
v0.0.0-...-9a5b211 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockAuthnStorage

type MockAuthnStorage struct {
	// mapping from provider -> user -> token
	Tokens map[string]map[string]*oauth2.Token
}

func NewMockStorage

func NewMockStorage() *MockAuthnStorage

func (MockAuthnStorage) Read

func (m MockAuthnStorage) Read(ctx context.Context, userID, provider string) (*oauth2.Token, error)

func (MockAuthnStorage) Store

func (m MockAuthnStorage) Store(ctx context.Context, userID, provider string, token *oauth2.Token) error

type MockIssuer

type MockIssuer struct {
	AllowRefresh bool
}

func (MockIssuer) CreateToken

func (MockIssuer) CreateToken(ctx context.Context, subject string, tokenType authnv1.CreateTokenRequest_TokenType, expiry *time.Duration) (token *oauth2.Token, err error)

func (MockIssuer) RefreshToken

func (m MockIssuer) RefreshToken(context.Context, *oauth2.Token) (*oauth2.Token, error)

type MockOIDCProviderServer

type MockOIDCProviderServer struct {
	Key *rsa.PrivateKey

	TokenCount int
	// contains filtered or unexported fields
}

func NewMockOIDCProviderServer

func NewMockOIDCProviderServer(email string, groups []string, customGroups []string) *MockOIDCProviderServer

func (*MockOIDCProviderServer) Client

func (m *MockOIDCProviderServer) Client() *http.Client

func (*MockOIDCProviderServer) Close

func (m *MockOIDCProviderServer) Close()

func (*MockOIDCProviderServer) SetCustomClaim

func (m *MockOIDCProviderServer) SetCustomClaim(customClaim string)

func (*MockOIDCProviderServer) SetCustomGroupClaim

func (m *MockOIDCProviderServer) SetCustomGroupClaim(customGroups []string)

func (*MockOIDCProviderServer) SetGroupClaim

func (m *MockOIDCProviderServer) SetGroupClaim(groups []string)

Jump to

Keyboard shortcuts

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