Documentation ¶
Index ¶
- func FormatToken(token, certFile string) (string, error)
- func GetHTTPClient(cacerts []byte) *http.Client
- func ParseUsernamePassword(token string) (string, string, bool)
- func WriteClientKubeConfig(destFile, url, serverCAFile, clientCertFile, clientKeyFile string) error
- type Info
- type OverrideURLCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatToken ¶ added in v1.21.9
func GetHTTPClient ¶
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 ¶
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
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 ¶
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
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.