Documentation ¶
Overview ¶
Package credentials provides interface for retrieving local user credentials.
The credentials are retrieved from different sources such as:
- Gravity local key store.
- Teleport local key store.
- Bolt database backend.
- Preconfigured set of credentials provided on the command line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalKeyStore ¶
GetLocalKeyStore opens a key store in the specified directory.
If the directory does not exist, it will be created. If the provided directory is empty, a default key store location is used.
func IsCredentialsNotFoundError ¶
IsCredentialsNotFoundError returns true if the provided error is the credentials not found.
Types ¶
type Config ¶
type Config struct { // LocalKeyStoreDir is the local Gravity key store directory (defaults to ~/.gravity). LocalKeyStoreDir string // TeleportKeyStoreDir is the local Teleport key store directory (defaults to ~/.tsh). TeleportKeyStoreDir string // Backend is the optional backend for login entries stored in database. Backend storage.Backend // Credentials is the preconfigured credentials entry. Credentials *Credentials }
Config is the credentials service configuration.
type Credentials ¶
type Credentials struct { // URL is the URL of the cluster the credentials are for. URL string // User is the credentials username. User string // Entry defines the login entry for username/password authentication. Entry users.LoginEntry // TLS defines the client configuration for mTLS authentication. TLS *tls.Config }
Credentials defines a set of user credentials.
func FromTokenAndHub ¶
func FromTokenAndHub(token, hub string) *Credentials
FromTokenAndHub creates new credentials from the provided token and address.
type Service ¶
type Service interface { // Current returns the currently active user credentials. Current() (*Credentials, error) // For returns user credentials for the specified cluster. For(clusterURL string) (*Credentials, error) // UpsertLoginEntry upserts login entry in the local key store. // // DEPRECATED: This method can removed when authentication via local // Gravity key store is no longer supported. UpsertLoginEntry(clusterURL, username, password string) error }
Service provides access to local user credentials.
Click to show internal directories.
Click to hide internal directories.