oidc

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package oidc contains utilities related to OIDC tokens.

Package oidc implements support for fetching OIDC tokens

Index

Constants

View Source
const (
	// PKCES256 is the SHA256 option required by the PKCE RFC
	PKCES256 = "S256"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IDToken

type IDToken struct {
	coreoidc.IDToken
}

IDToken is a structured representation of an OIDC IDToken.

type IDTokenSource

type IDTokenSource interface {
	// IDToken returns an ID token or an error.
	IDToken(context.Context) (*IDToken, error)
}

IDTokenSource provides `IDTokens`.

func InteractiveIDTokenSource

func InteractiveIDTokenSource(cfg oauth2.Config, oidp *coreoidc.Provider, extraAuthCodeOpts []oauth2.AuthCodeOption, allowBrowser bool) IDTokenSource

InteractiveIDTokenSource returns an `IDTokenSource` which performs an interactive Oauth token flow in order to retrieve an `IDToken`.

func StaticIDTokenSource

func StaticIDTokenSource(idt *IDToken) IDTokenSource

StaticIDTokenSource returns an `IDTokenSource` which always returns the given `IDToken`.

type PKCE

type PKCE struct {
	Challenge string
	Method    string
	Value     string
}

PKCE specifies the challenge and value pair required to fulfill RFC7636

func NewPKCE

func NewPKCE(provider *coreoidc.Provider) (*PKCE, error)

NewPKCE creates a new PKCE challenge for the specified provider per its supported methods (obtained through OIDC discovery endpoint)

func (*PKCE) AuthURLOpts

func (p *PKCE) AuthURLOpts() []oauth2.AuthCodeOption

AuthURLOpts returns the set of request parameters required during the initial exchange of the OAuth2 flow

func (*PKCE) TokenURLOpts

func (p *PKCE) TokenURLOpts() []oauth2.AuthCodeOption

TokenURLOpts returns the set of request parameters required during the token request exchange flow

Jump to

Keyboard shortcuts

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