Documentation ¶
Overview ¶
Package auth is a generated GoMock package.
Index ¶
- Constants
- Variables
- func WithClient(c *http.Client) func(*Auth)
- func WithEnv(env Env) func(*Auth)
- type APITokenError
- type Auth
- type Authorizer
- type DiskStorage
- type Env
- type MockAuthorizer
- func (m *MockAuthorizer) EXPECT() *MockAuthorizerMockRecorder
- func (m *MockAuthorizer) GetFreshToken(arg0 context.Context) (string, error)
- func (m *MockAuthorizer) GetToken(arg0 context.Context) (string, error)
- func (m *MockAuthorizer) GetTokenPath() (string, error)
- func (m *MockAuthorizer) Login(arg0 context.Context) error
- func (m *MockAuthorizer) Logout() error
- type MockAuthorizerMockRecorder
- func (mr *MockAuthorizerMockRecorder) GetFreshToken(arg0 interface{}) *gomock.Call
- func (mr *MockAuthorizerMockRecorder) GetToken(arg0 interface{}) *gomock.Call
- func (mr *MockAuthorizerMockRecorder) GetTokenPath() *gomock.Call
- func (mr *MockAuthorizerMockRecorder) Login(arg0 interface{}) *gomock.Call
- func (mr *MockAuthorizerMockRecorder) Logout() *gomock.Call
- type Opts
- type Storage
- type TerminalEnv
- type TestEnv
- type Token
- type TokenProvider
Constants ¶
const APIAuthEndpoint = "/auth/cli/runme"
Variables ¶
var ErrNotFound = errors.New("value not found")
Functions ¶
func WithClient ¶
Types ¶
type APITokenError ¶
type APITokenError struct {
// contains filtered or unexported fields
}
func NewAPITokenError ¶
func NewAPITokenError(msg string) *APITokenError
func (*APITokenError) Error ¶
func (e *APITokenError) Error() string
type Auth ¶
type Auth struct { // OAuthConfig describes OAuth flow. OAuthConfig oauth2.Config // APIBaseURL is Stateful API address. // It is used to obtain Stateful's JWT token. APIBaseURL string // Storage is responsible for storing and retrieving token. Storage Storage // contains filtered or unexported fields }
Auth provides an authentication and authorization method for the CLI. It relies on a browser and known web application to do it securely.
func (*Auth) GetFreshToken ¶
GetFreshToken is similar to GetToken but it always returns a new API token.
func (*Auth) GetToken ¶
GetToken returns an API token to access the Stateful API. If the token exists and is valid for at least 15 seconds, it is returned immediately. Otherwise, it's fetched using a never-expiring GitHub token.
func (*Auth) GetTokenPath ¶
type Authorizer ¶
type Authorizer interface { TokenProvider Login(context.Context) error Logout() error }
type DiskStorage ¶
type DiskStorage struct { // Location is a directory where data will be stored. Location string // contains filtered or unexported fields }
func (*DiskStorage) Delete ¶
func (s *DiskStorage) Delete(key string) error
func (*DiskStorage) Load ¶
func (s *DiskStorage) Load(key string, val interface{}) error
func (*DiskStorage) Path ¶
func (s *DiskStorage) Path(key string) string
func (*DiskStorage) Save ¶
func (s *DiskStorage) Save(key string, val interface{}) error
type MockAuthorizer ¶
type MockAuthorizer struct {
// contains filtered or unexported fields
}
MockAuthorizer is a mock of Authorizer interface.
func NewMockAuthorizer ¶
func NewMockAuthorizer(ctrl *gomock.Controller) *MockAuthorizer
NewMockAuthorizer creates a new mock instance.
func (*MockAuthorizer) EXPECT ¶
func (m *MockAuthorizer) EXPECT() *MockAuthorizerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockAuthorizer) GetFreshToken ¶
func (m *MockAuthorizer) GetFreshToken(arg0 context.Context) (string, error)
GetFreshToken mocks base method.
func (*MockAuthorizer) GetToken ¶
func (m *MockAuthorizer) GetToken(arg0 context.Context) (string, error)
GetToken mocks base method.
func (*MockAuthorizer) GetTokenPath ¶
func (m *MockAuthorizer) GetTokenPath() (string, error)
GetTokenPath mocks base method.
type MockAuthorizerMockRecorder ¶
type MockAuthorizerMockRecorder struct {
// contains filtered or unexported fields
}
MockAuthorizerMockRecorder is the mock recorder for MockAuthorizer.
func (*MockAuthorizerMockRecorder) GetFreshToken ¶
func (mr *MockAuthorizerMockRecorder) GetFreshToken(arg0 interface{}) *gomock.Call
GetFreshToken indicates an expected call of GetFreshToken.
func (*MockAuthorizerMockRecorder) GetToken ¶
func (mr *MockAuthorizerMockRecorder) GetToken(arg0 interface{}) *gomock.Call
GetToken indicates an expected call of GetToken.
func (*MockAuthorizerMockRecorder) GetTokenPath ¶
func (mr *MockAuthorizerMockRecorder) GetTokenPath() *gomock.Call
GetTokenPath indicates an expected call of GetTokenPath.
func (*MockAuthorizerMockRecorder) Login ¶
func (mr *MockAuthorizerMockRecorder) Login(arg0 interface{}) *gomock.Call
Login indicates an expected call of Login.
func (*MockAuthorizerMockRecorder) Logout ¶
func (mr *MockAuthorizerMockRecorder) Logout() *gomock.Call
Logout indicates an expected call of Logout.
type TerminalEnv ¶
func (TerminalEnv) IsAutonomous ¶
func (TerminalEnv) IsAutonomous() bool
func (*TerminalEnv) RequestCode ¶
func (e *TerminalEnv) RequestCode(url, state string) (err error)
func (*TerminalEnv) WaitForCodeAndState ¶
type TestEnv ¶
type TestEnv struct { Autonomous bool // contains filtered or unexported fields }