Documentation
¶
Overview ¶
Package auth is a generated GoMock package.
Index ¶
Constants ¶
const ( EnvProduction Env = "production" EnvDevelopment = "development" EnvSandbox = "sandbox" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authorization ¶
Authorization provides features that help the authorization process and managing tokens, such as getting tokens from the data sources and persisting refreshed tokens. Most users will use golang.org/x/oauth2 package.
func NewAuthorization ¶
func NewAuthorization(cnf *oauth2.Config, ts TokenStore) *Authorization
func (*Authorization) AuthCodeURL ¶
func (a *Authorization) AuthCodeURL(state string) string
func (*Authorization) AuthorizeCLI ¶
func (a *Authorization) AuthorizeCLI(state string) error
func (*Authorization) AuthorizeFromCode ¶
func (a *Authorization) AuthorizeFromCode(ctx context.Context, code string) error
type FileTokenStore ¶
type FileTokenStore struct {
Path string
}
FileTokenStore is a data source managing tokens.
func NewFileTokenStore ¶
func NewFileTokenStore(path string) *FileTokenStore
type MockTokenStore ¶
type MockTokenStore struct {
// contains filtered or unexported fields
}
MockTokenStore is a mock of TokenStore interface.
func NewMockTokenStore ¶
func NewMockTokenStore(ctrl *gomock.Controller) *MockTokenStore
NewMockTokenStore creates a new mock instance.
func (*MockTokenStore) EXPECT ¶
func (m *MockTokenStore) EXPECT() *MockTokenStoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockTokenStoreMockRecorder ¶
type MockTokenStoreMockRecorder struct {
// contains filtered or unexported fields
}
MockTokenStoreMockRecorder is the mock recorder for MockTokenStore.
func (*MockTokenStoreMockRecorder) Get ¶
func (mr *MockTokenStoreMockRecorder) Get() *gomock.Call
Get indicates an expected call of Get.
func (*MockTokenStoreMockRecorder) Save ¶
func (mr *MockTokenStoreMockRecorder) Save(arg0 interface{}) *gomock.Call
Save indicates an expected call of Save.
type TokenStore ¶
type TokenStore interface { // Get returns the persisted token from some data source. Get() (*oauth2.Token, error) // Store persists the token into some data source. Save(*oauth2.Token) error }
TokenStore is anything that can get token and store token, with any datasource. (e.g. cache, database)