clientaccess

package
v1.21.9 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 15 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatToken added in v1.21.9

func FormatToken(token, certFile string) (string, error)

func GetHTTPClient

func GetHTTPClient(cacerts []byte) *http.Client

GetHTTPClient returns a http client that validates TLS server certificates using the provided CA bundle. If the CA bundle is empty, it validates using the default http client using the OS CA bundle. If the CA bundle is not empty but does not contain any valid certs, it validates using an empty CA bundle (which will always fail).

func ParseUsernamePassword

func ParseUsernamePassword(token string) (string, string, bool)

ParseUsernamePassword returns the username and password portion of a token string, along with a bool indicating if the token was successfully parsed.

func WriteClientKubeConfig added in v1.21.9

func WriteClientKubeConfig(destFile, url, serverCAFile, clientCertFile, clientKeyFile string) error

WriteClientKubeConfig generates a kubeconfig at destFile that can be used to connect to a server at url with the given certs and keys

Types

type Info

type Info struct {
	CACerts  []byte `json:"cacerts,omitempty"`
	BaseURL  string `json:"baseurl,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	// contains filtered or unexported fields
}

func ParseAndValidateToken

func ParseAndValidateToken(server string, token string) (*Info, error)

ParseAndValidateToken parses a token, downloads and validates the server's CA bundle, and validates it according to the caHash from the token if set.

func ParseAndValidateTokenForUser added in v1.21.9

func ParseAndValidateTokenForUser(server, token, username string) (*Info, error)

ParseAndValidateToken parses a token with user override, downloads and validates the server's CA bundle, and validates it according to the caHash from the token if set.

func (*Info) Get added in v1.21.9

func (i *Info) Get(path string) ([]byte, error)

Get makes a request to a subpath of info's BaseURL

func (*Info) Put added in v1.21.9

func (i *Info) Put(path string, body []byte) error

Put makes a request to a subpath of info's BaseURL

func (*Info) String added in v1.21.9

func (i *Info) String() string

String returns the token data, templated according to the token format

type OverrideURLCallback

type OverrideURLCallback func(config []byte) (*url.URL, error)

Jump to

Keyboard shortcuts

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