{"modulePath":"github.com/TinyStac/tinystack","version":"v0.0.0-20221021101514-ca78c080174d","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package clientaccess\n\n## Functions\n\n```go\nfunc FormatToken(token, certFile string) (string, error)\n```\n\n```go\nfunc GetHTTPClient(cacerts []byte) *http.Client\n```\nGetHTTPClient 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).\n\n```go\nfunc ParseUsernamePassword(token string) (string, string, bool)\n```\nParseUsernamePassword returns the username and password portion of a token string, along with a bool indicating if the token was successfully parsed.\n\n```go\nfunc WriteClientKubeConfig(destFile, url, serverCAFile, clientCertFile, clientKeyFile string) error\n```\nWriteClientKubeConfig generates a kubeconfig at destFile that can be used to connect to a server at url with the given certs and keys\n\n## Types\n\n```go\ntype Info struct {\n\tCACerts  []byte `json:\"cacerts,omitempty\"`\n\tBaseURL  string `json:\"baseurl,omitempty\"`\n\tUsername string `json:\"username,omitempty\"`\n\tPassword string `json:\"password,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc ParseAndValidateToken(server string, token string) (*Info, error)\n```\nParseAndValidateToken parses a token, downloads and validates the server's CA bundle, and validates it according to the caHash from the token if set.\n\n```go\nfunc ParseAndValidateTokenForUser(server, token, username string) (*Info, error)\n```\nParseAndValidateToken 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.\n\n```go\nfunc (i *Info) Get(path string) ([]byte, error)\n```\nGet makes a request to a subpath of info's BaseURL\n\n```go\nfunc (i *Info) Put(path string, body []byte) error\n```\nPut makes a request to a subpath of info's BaseURL\n\n```go\nfunc (i *Info) String() string\n```\nString returns the token data, templated according to the token format\n\n```go\ntype OverrideURLCallback func(config []byte) (*url.URL, error)\n```\n\n","path":"github.com/TinyStac/tinystack/pkg/clientaccess","name":"clientaccess","synopsis":"","isRedistributable":true}
