oauth

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 2 Imported by: 0

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

View Source
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 ExchangeRequest

type ExchangeRequest struct {
	Code         string
	RedirectURI  string
	CodeVerifier string
	Nonce        string
}

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
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL