oauthmock

package
v0.0.0-...-b33ff70 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability struct {
	Provider *MockCapabilityProvider

	Config *oauth.Config
	Logger *logger.Logger
}

func (*Capability) GetConfigValidator

func (cap *Capability) GetConfigValidator() (v validator.Validator)

GetConfigValidator returns a validator interface that can be called to validate the capability config

func (*Capability) GetInitFuncName

func (cap *Capability) GetInitFuncName() (name string)

GetInitFuncName return the empty string as the mock capability doesn't use the plugin

func (*Capability) GetOAuthCapabilityEx

func (cap *Capability) GetOAuthCapabilityEx() (capEx oauth.CapabilityEx)

GetOAuthCapabilityEx returns the mock provider's interface to the capability functions

func (*Capability) InitProvider

func (cap *Capability) InitProvider(initFn plugin.Symbol)

InitProvider sets the capability provider to the local mock implementation

type MockCapabilityProvider

type MockCapabilityProvider struct {
	PerformAuthCodeExchangeRequest    *http.Request
	GetUserToken                      string
	ShouldFailGetLoginInfo            bool
	ShouldFailGetAccessTokenForDevice bool
	Username                          string
}

func (*MockCapabilityProvider) GetAccessTokenForDevice

func (mp *MockCapabilityProvider) GetAccessTokenForDevice(r *http.Request) (token string, username string, errInfo *oauth.DeviceAuthStatusErrorInfo, err error)

func (*MockCapabilityProvider) GetLoginInfo

func (mp *MockCapabilityProvider) GetLoginInfo() (loginInfo *oauth.LoginInfo, err error)

GetLoginInfo returns mock login info

func (*MockCapabilityProvider) GetLoginInfoForDevice

func (mp *MockCapabilityProvider) GetLoginInfoForDevice(r *http.Request) (loginInfo *oauth.DeviceLoginInfo, err error)

func (*MockCapabilityProvider) GetPermittedUser

func (mp *MockCapabilityProvider) GetPermittedUser(r *http.Request, token string) (username string, err error)

GetPermittedUser saves the token received and returns the configured mock username

func (*MockCapabilityProvider) GetPermittedUserForDevice

func (mp *MockCapabilityProvider) GetPermittedUserForDevice(t *http.Request, token string) (username string, err error)

func (*MockCapabilityProvider) PerformAuthCodeExchange

func (mp *MockCapabilityProvider) PerformAuthCodeExchange(r *http.Request) (token string, username string, err error)

PerformAuthCodeExchange saves the received request and returns a mock token

func (*MockCapabilityProvider) ValidateConfig

func (mp *MockCapabilityProvider) ValidateConfig() (err error)

ValidateConfig does nothing for the mock implementation

Jump to

Keyboard shortcuts

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