Documentation
¶
Index ¶
- Constants
- func Ctx(ctx context.Context, config IConfig) context.Context
- func FromContext[T any](ctx context.Context) *T
- func RedactSecret(secret string) string
- type Config
- type Environment
- func (env *Environment) ClearClientSecretFromSession() error
- func (env *Environment) GetClientSecretFromSession() (string, error)
- func (env *Environment) NewClientCredentialsFlow() (client_credentials.IClientCredentialsFlow, error)
- func (env *Environment) NewDeviceAuthorizationFlow() (authorization_code.IDeviceAuthorizationFlow, error)
- func (env *Environment) StoreClientSecretInSession(secret string) error
- type IConfig
- type IEnvironment
Constants ¶
View Source
const ( CLI_NAME = "kinde" USER_AGENT = "Kinde CLI" ConfigContextKey contextKey = "config" )
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
NewContext retrieves the Config instance from the context.
func RedactSecret ¶ added in v0.1.20
RedactSecret returns a redacted version of the secret for display purposes
Types ¶
type Config ¶
type Config struct {
CurrentEnvironment string `json:"current"`
Environments map[string]Environment `json:"environments"`
}
func (*Config) GetEnvironment ¶
func (i *Config) GetEnvironment() *Environment
GetEnvironment implements IConfig.
func (*Config) PersistConfig ¶
PersistConfig writes the current configuration to the config file.
func (*Config) SetEnvironment ¶
func (i *Config) SetEnvironment(f func(e *Environment)) error
func (*Config) SwitchEnvironment ¶
SwitchEnvironment sets the current environment to the specified value, creating it if it doesn't exist.
type Environment ¶
type Environment struct {
DomainName string `json:"domain_name"`
ClientID string `json:"client_id,omitempty"`
ClientSecret string `json:"client_secret,omitempty"`
}
func (*Environment) ClearClientSecretFromSession ¶ added in v0.1.20
func (env *Environment) ClearClientSecretFromSession() error
ClearClientSecretFromSession removes the client secret from the CLI session
func (*Environment) GetClientSecretFromSession ¶ added in v0.1.20
func (env *Environment) GetClientSecretFromSession() (string, error)
GetClientSecretFromSession retrieves the client secret from the CLI session
func (*Environment) NewClientCredentialsFlow ¶
func (env *Environment) NewClientCredentialsFlow() (client_credentials.IClientCredentialsFlow, error)
func (*Environment) NewDeviceAuthorizationFlow ¶
func (env *Environment) NewDeviceAuthorizationFlow() (authorization_code.IDeviceAuthorizationFlow, error)
NewDeviceAuthorizationFlow creates a new Device Authorization Flow with the given options.
func (*Environment) StoreClientSecretInSession ¶ added in v0.1.20
func (env *Environment) StoreClientSecretInSession(secret string) error
StoreClientSecretInSession stores the client secret in the CLI session
type IConfig ¶
type IConfig interface {
Validate() (error, bool)
SwitchEnvironment(val string) error
PersistConfig() error
GetEnvironment() *Environment
SetEnvironment(f func(e *Environment)) error
}
used for testing
type IEnvironment ¶
type IEnvironment interface {
NewDeviceAuthorizationFlow() (authorization_code.IDeviceAuthorizationFlow, error)
NewClientCredentialsFlow() (client_credentials.IClientCredentialsFlow, error)
}
Click to show internal directories.
Click to hide internal directories.