oidc

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

oidc contains the app-specific methods related to auth via Open ID Connect (OIDC)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// AuthCodeURL returns the URL to redirect to in order to initiate the OIDC authentication process
	AuthCodeURL(ctx context.Context, w http.ResponseWriter, returnURL string) (string, error)

	// Verify performs the necessary verification and processing of the OIDC callback request.
	// It populates 'claims' with the ID Token's claims and returns:
	//		- the URL to redirect to following successful authentication
	//		- the 'sid' value from the session_state query parameter
	Verify(ctx context.Context, w http.ResponseWriter, r *http.Request, claims any) (returnURL, oidcSID string, err error)

	// LoginURL returns the URL to redirect to when an error occurs during the OIDC authentication process
	LoginURL() string
}

type OIDC

type OIDC struct {
	loader.Loader
	// contains filtered or unexported fields
}

func New

func New(s *securecookie.SecureCookie, issuerURL, clientID, clientSecret, redirectURL string) *OIDC

New returns a new OIDC Authenticator

func (*OIDC) AuthCodeURL

func (o *OIDC) AuthCodeURL(ctx context.Context, w http.ResponseWriter, returnURL string) (string, error)

AuthCodeURL returns the URL to redirect to in order to initiate the OIDC authentication process

func (*OIDC) Verify

func (o *OIDC) Verify(ctx context.Context, w http.ResponseWriter, r *http.Request, claims any) (returnURL, sid string, err error)

Verify performs the necessary verification and processing of the OIDC callback request. It populates 'claims' with the ID Token's claims and returns:

  • the URL to redirect to following successful authentication
  • the 'sid' value from the session_state query parameter

Directories

Path Synopsis
provider contains interfaces for safely accessing an OIDC Provider
provider contains interfaces for safely accessing an OIDC Provider

Jump to

Keyboard shortcuts

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