oauth2

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package oauth2 is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var NewConfig = func(clientID, clientSecret, authURL, tokenURL string, scopes []string) ConfigInterface {
	return &oauth2Config{
		config: &oauth2.Config{
			ClientID:     clientID,
			ClientSecret: clientSecret,
			Endpoint: oauth2.Endpoint{
				AuthURL:   authURL,
				TokenURL:  tokenURL,
				AuthStyle: oauth2.AuthStyleInParams,
			},
			Scopes: scopes,
		},
	}
}

NewConfig creates a new oauth2 config object

Functions

This section is empty.

Types

type ConfigInterface

type ConfigInterface interface {
	AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
	PasswordCredentialsToken(ctx context.Context, username, password string) (*oauth2.Token, error)
	Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
	Client(ctx context.Context, t *oauth2.Token) *http.Client
	TokenSource(ctx context.Context, t *oauth2.Token) oauth2.TokenSource
}

ConfigInterface codifies the interface of an oauth2.Config object. This is relevant for testing purposes to mock the OAuth2 authentication flow.

type MockConfigInterface

type MockConfigInterface struct {
	// contains filtered or unexported fields
}

MockConfigInterface is a mock of ConfigInterface interface

func NewMockConfigInterface

func NewMockConfigInterface(ctrl *gomock.Controller) *MockConfigInterface

NewMockConfigInterface creates a new mock instance

func (*MockConfigInterface) AuthCodeURL

func (m *MockConfigInterface) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string

AuthCodeURL mocks base method

func (*MockConfigInterface) Client

Client mocks base method

func (*MockConfigInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockConfigInterface) Exchange

func (m *MockConfigInterface) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

Exchange mocks base method

func (*MockConfigInterface) PasswordCredentialsToken

func (m *MockConfigInterface) PasswordCredentialsToken(ctx context.Context, username, password string) (*oauth2.Token, error)

PasswordCredentialsToken mocks base method

func (*MockConfigInterface) TokenSource

TokenSource mocks base method

type MockConfigInterfaceMockRecorder

type MockConfigInterfaceMockRecorder struct {
	// contains filtered or unexported fields
}

MockConfigInterfaceMockRecorder is the mock recorder for MockConfigInterface

func (*MockConfigInterfaceMockRecorder) AuthCodeURL

func (mr *MockConfigInterfaceMockRecorder) AuthCodeURL(state interface{}, opts ...interface{}) *gomock.Call

AuthCodeURL indicates an expected call of AuthCodeURL

func (*MockConfigInterfaceMockRecorder) Client

func (mr *MockConfigInterfaceMockRecorder) Client(ctx, t interface{}) *gomock.Call

Client indicates an expected call of Client

func (*MockConfigInterfaceMockRecorder) Exchange

func (mr *MockConfigInterfaceMockRecorder) Exchange(ctx, code interface{}, opts ...interface{}) *gomock.Call

Exchange indicates an expected call of Exchange

func (*MockConfigInterfaceMockRecorder) PasswordCredentialsToken

func (mr *MockConfigInterfaceMockRecorder) PasswordCredentialsToken(ctx, username, password interface{}) *gomock.Call

PasswordCredentialsToken indicates an expected call of PasswordCredentialsToken

func (*MockConfigInterfaceMockRecorder) TokenSource

func (mr *MockConfigInterfaceMockRecorder) TokenSource(ctx, t interface{}) *gomock.Call

TokenSource indicates an expected call of TokenSource

Jump to

Keyboard shortcuts

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