upstreamoidc

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package upstreamoidc implements an abstraction of upstream OIDC provider interactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type ProviderConfig

type ProviderConfig struct {
	Name                     string
	ResourceUID              types.UID
	UsernameClaim            string
	GroupsClaim              string
	Config                   *oauth2.Config
	Client                   *http.Client
	AllowPasswordGrant       bool
	AdditionalAuthcodeParams map[string]string
	RevocationURL            *url.URL // will commonly be nil: many providers do not offer this
	Provider                 interface {
		Verifier(*coreosoidc.Config) *coreosoidc.IDTokenVerifier
		Claims(v interface{}) error
		UserInfo(ctx context.Context, tokenSource oauth2.TokenSource) (*coreosoidc.UserInfo, error)
	}
}

ProviderConfig holds the active configuration of an upstream OIDC provider.

func (*ProviderConfig) AllowsPasswordGrant added in v0.37.0

func (p *ProviderConfig) AllowsPasswordGrant() bool

func (*ProviderConfig) ExchangeAuthcodeAndValidateTokens

func (p *ProviderConfig) ExchangeAuthcodeAndValidateTokens(ctx context.Context, authcode string, pkceCodeVerifier pkce.Code, expectedIDTokenNonce nonce.Nonce, redirectURI string) (*oidctypes.Token, error)

func (*ProviderConfig) GetAdditionalAuthcodeParams added in v0.37.0

func (p *ProviderConfig) GetAdditionalAuthcodeParams() map[string]string

func (*ProviderConfig) GetAuthorizationURL

func (p *ProviderConfig) GetAuthorizationURL() *url.URL

func (*ProviderConfig) GetClientID

func (p *ProviderConfig) GetClientID() string

func (*ProviderConfig) GetGroupsClaim

func (p *ProviderConfig) GetGroupsClaim() string

func (*ProviderConfig) GetName

func (p *ProviderConfig) GetName() string

func (*ProviderConfig) GetResourceUID added in v0.37.0

func (p *ProviderConfig) GetResourceUID() types.UID

func (*ProviderConfig) GetRevocationURL added in v0.37.0

func (p *ProviderConfig) GetRevocationURL() *url.URL

func (*ProviderConfig) GetScopes

func (p *ProviderConfig) GetScopes() []string

func (*ProviderConfig) GetUsernameClaim

func (p *ProviderConfig) GetUsernameClaim() string

func (*ProviderConfig) PasswordCredentialsGrantAndValidateTokens added in v0.37.0

func (p *ProviderConfig) PasswordCredentialsGrantAndValidateTokens(ctx context.Context, username, password string) (*oidctypes.Token, error)

func (*ProviderConfig) PerformRefresh added in v0.37.0

func (p *ProviderConfig) PerformRefresh(ctx context.Context, refreshToken string) (*oauth2.Token, error)

func (*ProviderConfig) RevokeRefreshToken added in v0.37.0

func (p *ProviderConfig) RevokeRefreshToken(ctx context.Context, refreshToken string) error

RevokeRefreshToken will attempt to revoke the given token, if the provider has a revocation endpoint.

func (*ProviderConfig) ValidateToken

func (p *ProviderConfig) ValidateToken(ctx context.Context, tok *oauth2.Token, expectedIDTokenNonce nonce.Nonce) (*oidctypes.Token, error)

ValidateToken will validate the ID token. It will also merge the claims from the userinfo endpoint response, if the provider offers the userinfo endpoint.

Jump to

Keyboard shortcuts

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