Documentation
¶
Overview ¶
Package oauth defines the OAuth provider boundary of Auth-All. Provider specific behavior belongs in a provider package, not in core.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrProviderRejected = errors.New("authall/oauth: the provider rejected the request")
ErrProviderRejected reports that the provider refused the exchange.
Functions ¶
This section is empty.
Types ¶
type AuthRequest ¶
type AuthRequest struct {
State string
RedirectURI string
// CodeChallenge is the S256 PKCE challenge. It is empty when the provider
// does not support PKCE.
CodeChallenge string
// Nonce is supplied for an OpenID Connect provider.
Nonce string
}
AuthRequest is the data core supplies to build an authorization URL.
type Claims ¶ added in v0.9.0
type Claims struct {
// contains filtered or unexported fields
}
Claims is the read-only set of the verified ID token claims. A number arrives as float64, and a list as []any, as encoding/json decodes them. Every method is safe on a nil value.
func (*Claims) Get ¶ added in v0.9.0
Get returns one claim. The second result is false when the token does not carry the claim.
type ExchangeRequest ¶
ExchangeRequest is the data core supplies to redeem an authorization code.
type Identity ¶
type Identity struct {
// ProviderAccountID is the stable identifier of the account at the
// provider. It is never an email address.
ProviderAccountID string
// Email is the address the provider reports. It can be empty.
Email string
// EmailVerified reports whether the provider states that it verified the
// address. Auth-All never links on an unverified address.
EmailVerified bool
DisplayName string
ImageURL string
// Username is the stable, human-readable account name at the provider,
// for example the GitHub login. It can be empty.
Username string
// Claims holds every claim of the verified ID token, for example groups.
// A provider that verifies no ID token leaves it nil. The field is a
// pointer, so Identity stays comparable.
Claims *Claims
}
Identity is the verified provider identity of one end user.
type Provider ¶
type Provider interface {
// ID returns the stable provider identifier used in routes and storage.
ID() string
// SupportsPKCE reports whether the provider accepts a PKCE challenge.
SupportsPKCE() bool
// AuthCodeURL returns the provider authorization URL.
AuthCodeURL(req AuthRequest) (string, error)
// Exchange redeems the authorization code and returns a verified identity.
Exchange(ctx context.Context, req ExchangeRequest) (*Identity, error)
}
Provider is one OAuth or OpenID Connect provider.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package github implements the GitHub OAuth provider for Auth-All.
|
Package github implements the GitHub OAuth provider for Auth-All. |
|
Package google implements the Google OpenID Connect provider for Auth-All.
|
Package google implements the Google OpenID Connect provider for Auth-All. |
|
Package oidc implements a generic OpenID Connect provider for Auth-All.
|
Package oidc implements a generic OpenID Connect provider for Auth-All. |