tokenexchange

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExchangeToken

func ExchangeToken(
	te TokenExchanger,
	SubjectToken string,
	SubjectTokenType oidc.TokenType,
	ActorToken string,
	ActorTokenType oidc.TokenType,
	Resource []string,
	Audience []string,
	Scopes []string,
	RequestedTokenType oidc.TokenType,
) (*oidc.TokenExchangeResponse, error)

ExchangeToken sends a token exchange request (rfc 8693) to te's token endpoint. SubjectToken and SubjectTokenType are required parameters.

func WithHTTPClient

func WithHTTPClient(client *http.Client) func(*OAuthTokenExchange)

func WithStaticTokenEndpoint

func WithStaticTokenEndpoint(issuer, tokenEndpoint string) func(*OAuthTokenExchange)

Types

type OAuthTokenExchange

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

func (*OAuthTokenExchange) AuthFn

func (te *OAuthTokenExchange) AuthFn() (any, error)

func (*OAuthTokenExchange) HttpClient

func (te *OAuthTokenExchange) HttpClient() *http.Client

func (*OAuthTokenExchange) TokenEndpoint

func (te *OAuthTokenExchange) TokenEndpoint() string

type TokenExchanger

type TokenExchanger interface {
	TokenEndpoint() string
	HttpClient() *http.Client
	AuthFn() (any, error)
}

func NewTokenExchanger

func NewTokenExchanger(issuer string, options ...func(source *OAuthTokenExchange)) (TokenExchanger, error)

func NewTokenExchangerClientCredentials

func NewTokenExchangerClientCredentials(issuer, clientID, clientSecret string, options ...func(source *OAuthTokenExchange)) (TokenExchanger, error)

Jump to

Keyboard shortcuts

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