oidc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 11 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(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)
}

type OIDC

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

func New

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

New returns a new OIDC Authenticator

func (*OIDC) AuthCodeURL

func (o *OIDC) AuthCodeURL(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

Jump to

Keyboard shortcuts

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