Documentation ¶
Overview ¶
Package oauth2x contains utilities for building OAuth 2 clients and servers.
Index ¶
Constants ¶
View Source
const (
// KeySize is the size of the encryption key.
KeySize = 32
)
Variables ¶
This section is empty.
Functions ¶
func BrowserTokenSource ¶
func BrowserTokenSource( conf *oauth2.Config, callbackHostPort netx.HostPort, opts *BrowserTokenSourceOptions, ) (oauth2.TokenSource, error)
A BrowserTokenSource retrieves tokens from an OAuth2 provider that presents a consent page in the local browser. Useful for acquiring credentials
func CachingTokenSource ¶
func CachingTokenSource( cache TokenCache, fallback oauth2.TokenSource, log *zap.Logger, clock clockwork.Clock, ) oauth2.TokenSource
A CachingTokenSource retrieves tokens from a cache, and if that fails triggers consults another token source.
Types ¶
type BrowserTokenSourceOptions ¶
type BrowserTokenSourceOptions struct { Log *zap.Logger SuccessTemplate string ErrorTemplate string Timeout time.Duration }
BrowserTokenSourceOptions are options to creating a BrowserTokenSource
type TokenCache ¶
A TokenCache is a cache for local tokens.
func EncryptTokenCache ¶
func EncryptTokenCache(cache TokenCache, key [KeySize]byte) TokenCache
EncryptTokenCache wraps a token cache with an encryption layer.
func NewFileTokenCache ¶
func NewFileTokenCache(filename string) TokenCache
NewFileTokenCache returns a TokenCache that writes to a file.
Click to show internal directories.
Click to hide internal directories.