Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CtxWithCreds ¶
CtxWithCreds returns a context with default credentials for the user. Since this uses MustLoadDefaultCredentials, a lack of credentials will cause an os.Exit
func IsAuthenticated ¶
IsAuthenticated returns whether the user is currently authenticated. This includes whether they have existing credentials and whether those are actually valid.
func SaveRefreshToken ¶
func SaveRefreshToken(token *RefreshToken) error
SaveRefreshToken saves the refresh token in default spot.
Types ¶
type PixieCloudLogin ¶
type PixieCloudLogin struct {
ManualMode bool
CloudAddr string
// OrgID: Selection is only valid for "pixie.support", will be removed when RBAC is supported.
OrgID string
// UseAPIKey, if true then prompt user for API key to use for login.
UseAPIKey bool
// APIKey to use if specified. Otherwise, prompt for the key if UseAPIKey is true.
APIKey string
}
PixieCloudLogin performs login on the pixie cloud.
func (*PixieCloudLogin) Run ¶
func (p *PixieCloudLogin) Run() (*RefreshToken, error)
Run either launches the browser or prints out the URL for auth.
type RefreshToken ¶
type RefreshToken struct {
Token string `json:"token"`
ExpiresAt int64 `json:"expiresAt"`
OrgName string `json:"orgName,omitempty"`
OrgID string `json:"orgID,omitempty"`
}
RefreshToken is the format for the refresh token.
func LoadDefaultCredentials ¶
func LoadDefaultCredentials() (*RefreshToken, error)
LoadDefaultCredentials loads the default credentials for the user.
func MustLoadDefaultCredentials ¶
func MustLoadDefaultCredentials() *RefreshToken
MustLoadDefaultCredentials loads the default credentials for the user. An error will print to console and call os.Exit.