Documentation
¶
Index ¶
- Constants
- Variables
- type AuthCodeURLConfig
- type AuthCodeURLConfigBuilder
- type ConformingAuthCodeURLConfigBuilder
- type ExchangeConfig
- type ExchangeConfigBuilder
- type FactoryFunc
- type OptionError
- type Provider
- type Registry
- func (r *Registry) MustRegister(name string, factory FactoryFunc)
- func (r *Registry) New(ctx context.Context, name string, opts map[string]string) (Provider, error)
- func (r *Registry) NewAt(ctx context.Context, name string, vsn int, opts map[string]string) (Provider, error)
- func (r *Registry) Register(name string, factory FactoryFunc) error
- type Token
Constants ¶
View Source
const VersionLatest = -1
Variables ¶
View Source
var ( ErrNoSuchProvider = errors.New("provider: no provider with the given name") ErrNoProviderWithVersion = errors.New("provider: version not supported") ErrNoOptions = errors.New("provider: options provided but none accepted") )
View Source
var ( ErrOIDCMissingIDToken = errors.New("provider: oidc: missing ID token in response") ErrOIDCNonceMismatch = errors.New("provider: oidc: nonce does not match") )
View Source
var GlobalRegistry = NewRegistry()
Functions ¶
This section is empty.
Types ¶
type AuthCodeURLConfig ¶
type AuthCodeURLConfig interface {
AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
}
AuthCodeURLConfig is the component of *oauth2.Config required for generating authorization code URLs.
type AuthCodeURLConfigBuilder ¶
type AuthCodeURLConfigBuilder interface {
// WithRedirectURL sets the redirect URL for the config.
WithRedirectURL(redirectURL string) AuthCodeURLConfigBuilder
// WithScopes sets the scopes for the config.
WithScopes(scopes ...string) AuthCodeURLConfigBuilder
// Build creates an AuthCodeURLConfig from the current configuration.
Build() AuthCodeURLConfig
}
AuthCodeURLConfigBuilder creates AuthCodeURLConfigs.
type ConformingAuthCodeURLConfigBuilder ¶ added in v1.8.0
type ConformingAuthCodeURLConfigBuilder struct {
// contains filtered or unexported fields
}
func NewConformingAuthCodeURLConfigBuilder ¶ added in v1.8.0
func NewConformingAuthCodeURLConfigBuilder(endpoint oauth2.Endpoint, clientID string) *ConformingAuthCodeURLConfigBuilder
func (*ConformingAuthCodeURLConfigBuilder) Build ¶ added in v1.8.0
func (cb *ConformingAuthCodeURLConfigBuilder) Build() AuthCodeURLConfig
func (*ConformingAuthCodeURLConfigBuilder) WithRedirectURL ¶ added in v1.8.0
func (cb *ConformingAuthCodeURLConfigBuilder) WithRedirectURL(redirectURL string) AuthCodeURLConfigBuilder
func (*ConformingAuthCodeURLConfigBuilder) WithScopes ¶ added in v1.8.0
func (cb *ConformingAuthCodeURLConfigBuilder) WithScopes(scopes ...string) AuthCodeURLConfigBuilder
type ExchangeConfig ¶
type ExchangeConfig interface {
Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*Token, error)
Refresh(ctx context.Context, t *Token) (*Token, error)
}
ExchangeConfig is the component of *oauth2.Config required to exchange an authorization code for a token.
type ExchangeConfigBuilder ¶
type ExchangeConfigBuilder interface {
// WithOption sets an exchange-specific option for this provider. If the
// provider does not support the given option, it is ignored.
WithOption(name, value string) ExchangeConfigBuilder
// WithRedirectURL sets the redirect URL for the config.
WithRedirectURL(redirectURL string) ExchangeConfigBuilder
// Build creates an ExchangeConfig from the current configuration.
Build() ExchangeConfig
}
ExchangeConfigBuilder creates ExchangeConfigs.
type FactoryFunc ¶
func BasicFactory ¶ added in v1.8.0
func BasicFactory(endpoint oauth2.Endpoint) FactoryFunc
type OptionError ¶
func (*OptionError) Error ¶
func (oe *OptionError) Error() string
type Provider ¶
type Provider interface {
// Version is the revision of this provider vis-a-vis the options it
// supports.
Version() int
// NewAuthCodeURLConfigBuilder creates a config builder automatically scoped
// to this provider with the specified options.
NewAuthCodeURLConfigBuilder(clientID string) AuthCodeURLConfigBuilder
// NewExchangeConfigBuilder creates a new config builder for token exchange.
NewExchangeConfigBuilder(clientID, clientSecret string) ExchangeConfigBuilder
}
Provider represents an integration with a particular OAuth provider using the authorization code grant.
func AzureADFactory ¶ added in v1.8.0
func CustomFactory ¶ added in v1.8.0
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) MustRegister ¶
func (r *Registry) MustRegister(name string, factory FactoryFunc)
func (*Registry) New ¶
New looks up a provider with the given name and configures it according to the specified options.
Click to show internal directories.
Click to hide internal directories.