Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateState() (string, error)
- func NewConfig(provider ConfigProvider) *oauth2.Config
- func ValidateState(expected string, received string) bool
- type AuthResult
- type ConfigProvider
- type DBTokenSource
- func (s *DBTokenSource) ExpiresWithin(ctx context.Context, d time.Duration) (bool, error)
- func (s *DBTokenSource) HasToken(ctx context.Context) (bool, error)
- func (s *DBTokenSource) RefreshIfNeeded(ctx context.Context, threshold time.Duration) (*oauth2.Token, error)
- func (s *DBTokenSource) Token() (*oauth2.Token, error)
- type DirectFlow
- type ErrorCode
- type Flow
- type ProxyTokenSource
- func (s *ProxyTokenSource) ExpiresWithin(ctx context.Context, d time.Duration) (bool, error)
- func (s *ProxyTokenSource) HasToken(ctx context.Context) (bool, error)
- func (s *ProxyTokenSource) RefreshIfNeeded(ctx context.Context, threshold time.Duration) (*oauth2.Token, error)
- func (s *ProxyTokenSource) Token() (*oauth2.Token, error)
- type ServerFlow
- type TokenChecker
- type TokenSource
Constants ¶
View Source
const ( ParamError = "error" ParamErrorDescription = "error_description" ParamMinVersion = "min_version" ParamClientVersion = "client_version" ParamLocalPort = "local_port" )
Variables ¶
View Source
var ( ErrInvalidState = errors.New("invalid state parameter") ErrMissingAuthCode = errors.New("missing authorization code") ErrMissingAccessToken = errors.New("missing access_token") )
View Source
var ( ErrNoToken = errors.New("no token found - please authenticate first") ErrTokenExpired = errors.New("token expired and no refresh token available") )
Functions ¶
func GenerateState ¶
func NewConfig ¶
func NewConfig(provider ConfigProvider) *oauth2.Config
func ValidateState ¶
Types ¶
type AuthResult ¶
type ConfigProvider ¶
type DBTokenSource ¶
type DBTokenSource struct {
// contains filtered or unexported fields
}
func NewDBTokenSource ¶
func NewDBTokenSource(config *oauth2.Config, querier sqlitec.Querier) *DBTokenSource
func (*DBTokenSource) ExpiresWithin ¶
func (*DBTokenSource) HasToken ¶
func (s *DBTokenSource) HasToken(ctx context.Context) (bool, error)
func (*DBTokenSource) RefreshIfNeeded ¶
type DirectFlow ¶
type DirectFlow struct {
// contains filtered or unexported fields
}
func NewDirectFlow ¶
func (*DirectFlow) Run ¶
func (f *DirectFlow) Run(ctx context.Context) (*AuthResult, error)
type ProxyTokenSource ¶
type ProxyTokenSource struct {
// contains filtered or unexported fields
}
ProxyTokenSource implements oauth2.TokenSource and TokenChecker, refreshing tokens via the server's /auth/refresh endpoint.
func NewProxyTokenSource ¶
func NewProxyTokenSource(serverURL string, querier sqlitec.Querier) *ProxyTokenSource
func (*ProxyTokenSource) ExpiresWithin ¶
func (*ProxyTokenSource) HasToken ¶
func (s *ProxyTokenSource) HasToken(ctx context.Context) (bool, error)
func (*ProxyTokenSource) RefreshIfNeeded ¶
type ServerFlow ¶
type ServerFlow struct {
// contains filtered or unexported fields
}
func NewServerFlow ¶
func NewServerFlow(serverURL string, querier sqlitec.Querier) *ServerFlow
func (*ServerFlow) Run ¶
func (f *ServerFlow) Run(ctx context.Context) (*AuthResult, error)
type TokenSource ¶
type TokenSource interface {
oauth2.TokenSource
TokenChecker
RefreshIfNeeded(ctx context.Context, threshold time.Duration) (*oauth2.Token, error)
}
TokenSource combines oauth2.TokenSource with token management capabilities.
Click to show internal directories.
Click to hide internal directories.