oidc

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// DiscoveryURL is the discovery URL of the OIDC provider. If set, it
	// is used to discover the values of AuthEndpoint and TokenEndpoint.
	DiscoveryURL string
	// AuthEndpoint is the authorization endpoint. It must be set only if
	// DiscoveryURL is not set.
	AuthEndpoint string
	// Scopes is the list of scopes to request. The default list is:
	// openid, email.
	Scopes []string
	// TokenEndpoint is the token endpoint. It must be set only if
	// DiscoveryURL is not set.
	TokenEndpoint string
	// RedirectURL is the OAUTH2 redirect URL. It must be managed by the
	// proxy.
	RedirectURL string
	// ClientID is the Client ID.
	ClientID string
	// ClientSecret is the Client Secret.
	ClientSecret string
}

Config contains the parameters of an OIDC provider.

type CookieManager

type CookieManager interface {
	SetAuthTokenCookie(w http.ResponseWriter, userID, sessionID string, extraClaims map[string]string) error
	ClearCookies(w http.ResponseWriter) error
}

type EventRecorder

type EventRecorder interface {
	Record(string)
}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider handles the OIDC manual flow based on information from https://developers.google.com/identity/openid-connect/openid-connect and https://developers.facebook.com/docs/facebook-login/guides/advanced/oidc-token/

func New

func New(cfg Config, er EventRecorder, cm CookieManager) (*Provider, error)

func (*Provider) HandleCallback

func (p *Provider) HandleCallback(w http.ResponseWriter, req *http.Request)

func (*Provider) RequestLogin

func (p *Provider) RequestLogin(w http.ResponseWriter, req *http.Request, originalURL string)

Jump to

Keyboard shortcuts

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