Documentation
¶
Overview ¶
Package google implements the Google OpenID Connect provider for Auth-All.
Google is a conformant OpenID Connect issuer, so this package is a preset over the generic provider in oauth/oidc. One code path carries the identity token verification, so a defect is repaired one time.
Index ¶
Constants ¶
const ( DefaultAuthURL = "https://accounts.google.com/o/oauth2/v2/auth" DefaultTokenURL = "https://oauth2.googleapis.com/token" DefaultJWKSURL = "https://www.googleapis.com/oauth2/v3/certs" DefaultIssuer = "https://accounts.google.com" )
Default Google endpoints.
const ProviderID = "google"
ProviderID is the stable identifier of this provider.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Provider)
Option configures the provider.
func WithClientSecret ¶
WithClientSecret sets the OAuth client secret.
func WithEndpoints ¶
WithEndpoints overrides the provider endpoints and the expected issuer. Tests use it to point at a deterministic fake Google server.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client used for provider calls.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the Google OpenID Connect provider.
func New ¶
New returns a Google provider.
Google publishes a discovery document, and this preset names the endpoints directly. The endpoints are stable and documented, so the first sign-in needs no extra round trip.
func (*Provider) AuthCodeURL ¶
func (p *Provider) AuthCodeURL(req oauth.AuthRequest) (string, error)
AuthCodeURL implements oauth.Provider.
func (*Provider) Exchange ¶
func (p *Provider) Exchange(ctx context.Context, req oauth.ExchangeRequest) (*oauth.Identity, error)
Exchange implements oauth.Provider. It validates the issuer, the audience, the nonce, the expiry, and the signature of the identity token.
func (*Provider) SupportsPKCE ¶
SupportsPKCE implements oauth.Provider.