Documentation
¶
Overview ¶
Package auth is a generated GoMock package.
Package auth is a generated GoMock package.
Index ¶
- type FileTokenSourceBuilder
- type MemoryTokenStoreBuilder
- type MockTokenSource
- type MockTokenSourceMockRecorder
- type MockTokenStore
- type MockTokenStoreMockRecorder
- type ScriptTokenSourceBuilder
- func (b *ScriptTokenSourceBuilder) Build() (result TokenSource, err error)
- func (b *ScriptTokenSourceBuilder) SetLogger(value *slog.Logger) *ScriptTokenSourceBuilder
- func (b *ScriptTokenSourceBuilder) SetScript(value string) *ScriptTokenSourceBuilder
- func (b *ScriptTokenSourceBuilder) SetStore(value TokenStore) *ScriptTokenSourceBuilder
- type StaticTokenSourceBuilder
- type Token
- type TokenCredentialsBuilder
- type TokenSource
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileTokenSourceBuilder ¶
type FileTokenSourceBuilder struct {
// contains filtered or unexported fields
}
FileTokenSourceBuilder contains the logic needed to create a token source that reads tokens from a file.
func NewFileTokenSource ¶
func NewFileTokenSource() *FileTokenSourceBuilder
NewFileTokenSource creates a builder that can then be used to configure and create a token source that reads tokens from a file. The token source will monitor the file's modification time and only reload the token when the file has changed.
func (*FileTokenSourceBuilder) Build ¶
func (b *FileTokenSourceBuilder) Build() (result TokenSource, err error)
Build uses the data stored in the builder to build a new file token source.
func (*FileTokenSourceBuilder) SetFile ¶
func (b *FileTokenSourceBuilder) SetFile(value string) *FileTokenSourceBuilder
SetFile sets the path to the file containing the access token. This is mandatory.
func (*FileTokenSourceBuilder) SetLogger ¶
func (b *FileTokenSourceBuilder) SetLogger(value *slog.Logger) *FileTokenSourceBuilder
SetLogger sets the logger. This is mandatory.
type MemoryTokenStoreBuilder ¶
type MemoryTokenStoreBuilder struct {
// contains filtered or unexported fields
}
MemoryTokenStoreBuilder contains the logic needed to create a token store that saves tokens in memory only.
func NewMemoryTokenStore ¶
func NewMemoryTokenStore() *MemoryTokenStoreBuilder
NewMemoryTokenStore creates a builder that can then be used to configure and create a memory token store.
func (*MemoryTokenStoreBuilder) Build ¶
func (b *MemoryTokenStoreBuilder) Build() (result TokenStore, err error)
Build uses the data stored in the builder to build a new memory token store.
func (*MemoryTokenStoreBuilder) SetLogger ¶
func (b *MemoryTokenStoreBuilder) SetLogger(value *slog.Logger) *MemoryTokenStoreBuilder
SetLogger sets the logger. This is mandatory.
type MockTokenSource ¶
type MockTokenSource struct {
// contains filtered or unexported fields
}
MockTokenSource is a mock of TokenSource interface.
func NewMockTokenSource ¶
func NewMockTokenSource(ctrl *gomock.Controller) *MockTokenSource
NewMockTokenSource creates a new mock instance.
func (*MockTokenSource) EXPECT ¶
func (m *MockTokenSource) EXPECT() *MockTokenSourceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockTokenSourceMockRecorder ¶
type MockTokenSourceMockRecorder struct {
// contains filtered or unexported fields
}
MockTokenSourceMockRecorder is the mock recorder for MockTokenSource.
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.
type ScriptTokenSourceBuilder ¶
type ScriptTokenSourceBuilder struct {
// contains filtered or unexported fields
}
ScriptTokenSourceBuilder contains the logic needed to create a token source that executes an external script to generate the token.
func NewScriptTokenSource ¶
func NewScriptTokenSource() *ScriptTokenSourceBuilder
NewScriptTokenSource creates a builder that can then be used to configure and create a token source that executes a script to generate the token.
func (*ScriptTokenSourceBuilder) Build ¶
func (b *ScriptTokenSourceBuilder) Build() (result TokenSource, err error)
Build uses the data stored in the builder to build a new script token source.
func (*ScriptTokenSourceBuilder) SetLogger ¶
func (b *ScriptTokenSourceBuilder) SetLogger(value *slog.Logger) *ScriptTokenSourceBuilder
SetLogger sets the logger. This is mandatory.
func (*ScriptTokenSourceBuilder) SetScript ¶
func (b *ScriptTokenSourceBuilder) SetScript(value string) *ScriptTokenSourceBuilder
SetScript sets script that will be used to generate new tokens. This is mandatory.
func (*ScriptTokenSourceBuilder) SetStore ¶
func (b *ScriptTokenSourceBuilder) SetStore(value TokenStore) *ScriptTokenSourceBuilder
SetStore sets the token store that will be used to load and save tokens. This is mandatory.
type StaticTokenSourceBuilder ¶
type StaticTokenSourceBuilder struct {
// contains filtered or unexported fields
}
StaticTokenSourceBuilder contains the logic needed to create a token source that always returns the same token.
func NewStaticTokenSource ¶
func NewStaticTokenSource() *StaticTokenSourceBuilder
NewStaticTokenSource creates a builder that can then be used to configure and create a token source that always returns the same static token.
func (*StaticTokenSourceBuilder) Build ¶
func (b *StaticTokenSourceBuilder) Build() (result TokenSource, err error)
Build uses the data stored in the builder to build a new static token source.
func (*StaticTokenSourceBuilder) SetLogger ¶
func (b *StaticTokenSourceBuilder) SetLogger(value *slog.Logger) *StaticTokenSourceBuilder
SetLogger sets the logger. This is mandatory.
func (*StaticTokenSourceBuilder) SetToken ¶
func (b *StaticTokenSourceBuilder) SetToken(value *Token) *StaticTokenSourceBuilder
SetToken sets the token that will be returned by this token source. This is mandatory.
type Token ¶
type Token struct {
// Access is the access token.
Access string
// Refresh is the refresh token.
Refresh string
// Expiry is the expiry time of the token.
Expiry time.Time
}
Token is a struct that represents a token that can be used to authenticate requests.
type TokenCredentialsBuilder ¶
type TokenCredentialsBuilder struct {
// contains filtered or unexported fields
}
TokenCredentialsBuilder contains the logic needed to create credentials that implement the gRPC PerRPCCredentials interface by delegating to our internal TokenSource interface.
func NewTokenCredentials ¶
func NewTokenCredentials() *TokenCredentialsBuilder
NewTokenCredentials creates a builder that can then be used to configure and create token credentials that implement the gRPC PerRPCCredentials interface.
func (*TokenCredentialsBuilder) Build ¶
func (b *TokenCredentialsBuilder) Build() (result credentials.PerRPCCredentials, err error)
Build uses the data stored in the builder to build new token credentials.
func (*TokenCredentialsBuilder) SetLogger ¶
func (b *TokenCredentialsBuilder) SetLogger(value *slog.Logger) *TokenCredentialsBuilder
SetLogger sets the logger. This is mandatory.
func (*TokenCredentialsBuilder) SetSource ¶
func (b *TokenCredentialsBuilder) SetSource(value TokenSource) *TokenCredentialsBuilder
SetSource sets the internal token source to delegate to. This is mandatory.
type TokenSource ¶
type TokenSource interface {
// Token returns the token for the token source.
Token(ctx context.Context) (result *Token, err error)
}
TokenSource is the interface that defines the methods that are common to all the token sources.
type TokenStore ¶
type TokenStore interface {
// Load loads the tokens from the store.
Load(ctx context.Context) (result *Token, err error)
// Save saves the tokens to the store.
Save(ctx context.Context, tokens *Token) error
}
TokenStore is the interface that defines the methods that are used to load/save tokens from/to persistent storage.