login

package module
v0.0.0-...-10c0159 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTokenCachePath = ".kube/cache/oidc-login"
	IssuerURLArg          = "--issuer-url="
	ClientIDArg           = "--client-id="
	UsePKCEArg            = "--use-pkce"
	CustomersPrefix       = "/Customers/"
)

Variables

This section is empty.

Functions

func GetToken

func GetToken(ctx context.Context, issuerURL, clientID string, usePKCE bool, out io.Writer) error

GetToken executes the OIDC login flow using the kubelogin with the provided OIDC parameters writes the raw JSON ExecCredential result to out.

func GetTokenFromConfig

func GetTokenFromConfig(ctx context.Context, cfg *rest.Config) (string, error)

GetTokenFromConfig takes a rest.Config and returns a valid OIDC access token or the static bearer token if it's set in the config.

func GetTokenFromExecConfig

func GetTokenFromExecConfig(ctx context.Context, execConfig *api.ExecConfig) (string, error)

GetTokenFromExecConfig takes the provided execConfig, parses out the args and gets the token by executing the login flow.

Types

type DefaultTokenGetter

type DefaultTokenGetter struct{}

func (*DefaultTokenGetter) GetTokenString

func (t *DefaultTokenGetter) GetTokenString(ctx context.Context, issuerURL, clientID string, usePKCE bool) (string, error)

type TokenGetter

type TokenGetter interface {
	GetTokenString(ctx context.Context, issuerURL, clientID string, usePKCE bool) (string, error)
}

type UserInfo

type UserInfo struct {
	User string
	Orgs []string
}

func GetUserInfoFromToken

func GetUserInfoFromToken(tokenString string) (*UserInfo, error)

Jump to

Keyboard shortcuts

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