Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Keys = []string{"oidc_issuer", "oidc_client_id", "api_url"}
Keys are all of the allowed keys in the Context section.
Functions ¶
func IsConfigured ¶
func IsConfigured() bool
IsConfigured returns true if a Common Fate config file exists and contains a non-empty current context.
config.Load() is called to load the config file.
func ListContexts ¶
func SwitchContext ¶
Types ¶
type Config ¶
type Config struct { CurrentContext string `toml:"current_context" json:"current_context"` // Contexts allows multiple Common Fate tenancies to be switched between easily. // We don't have official support for this yet in the CLI, // but the config structure supports it so that it can be easily added in future. Contexts map[string]Context `toml:"context" json:"context"` }
type Context ¶
type Context struct { APIURL string `toml:"api_url,omitempty" json:"api_url,omitempty"` AccessURL string `toml:"access_url,omitempty" json:"access_url,omitempty"` AuthzURL string `toml:"authz_url,omitempty" json:"authz_url,omitempty"` OIDCIssuer string `toml:"oidc_issuer,omitempty" json:"oidc_issuer,omitempty"` OIDCClientID string `toml:"oidc_client_id,omitempty" json:"oidc_client_id,omitempty"` // OIDCClientSecret, if specified, will cause the client to use machine-to-machine OIDC authentication. OIDCClientSecret *string `toml:"oidc_client_secret,omitempty" json:"oidc_client_secret,omitempty"` // HTTPClient is filled in by calling Initialize() HTTPClient *http.Client // OIDCProvider is filled in by calling Initialize() OIDCProvider rp.RelyingParty TokenSource oauth2.TokenSource TokenStore TokenStore // contains filtered or unexported fields }
func LoadDefault ¶
LoadDefault is a shorthand function which calls Load() to load the configuration, and then calls cfg.Current() to get the current API context. It returns an error if either method fails.
func NewServerContext ¶
NewServerContext requires all option to be passed and does not attempt to read from the local config file it also uses an in memory token store to avoid keychain access
func (*Context) Initialize ¶
func (c *Context) Initialize(ctx context.Context, opts InitializeOpts) error
type InitializeOpts ¶
type InitializeOpts struct {
TokenStore TokenStore
}
Click to show internal directories.
Click to hide internal directories.