Documentation
¶
Index ¶
- Constants
- Variables
- func CreateDefaultClientConfig(configPath string, Fs afero.Fs) error
- func CreateProvidersMap(providerConfigList []ProviderConfig) (map[string]ProviderConfig, error)
- func ResolveClientConfigPath(configPath *string) error
- type ClientConfig
- type ProviderConfig
- func DefaultProviderConfig() ProviderConfig
- func GetProvidersConfigFromEnv() ([]ProviderConfig, error)
- func GitHubProviderConfig() ProviderConfig
- func NewProviderConfigFromString(configStr string, hasAlias bool) (ProviderConfig, error)
- func ProvidersConfigListFromStrings(providerList string) ([]ProviderConfig, error)
- type ServerConfig
Constants ¶
const ( WEBCHOOSER_ALIAS = "WEBCHOOSER" OPKSSH_DEFAULT_ENVVAR = "OPKSSH_DEFAULT" OPKSSH_PROVIDERS_ENVVAR = "OPKSSH_PROVIDERS" )
Variables ¶
var DefaultClientConfig []byte
Functions ¶
func CreateDefaultClientConfig ¶ added in v0.10.0
func CreateProvidersMap ¶
func CreateProvidersMap(providerConfigList []ProviderConfig) (map[string]ProviderConfig, error)
func ResolveClientConfigPath ¶ added in v0.10.0
Types ¶
type ClientConfig ¶
type ClientConfig struct {
DefaultProvider string `yaml:"default_provider"`
Providers []ProviderConfig `yaml:"providers"`
}
func GetClientConfigFromFile ¶ added in v0.10.0
func GetClientConfigFromFile(configPath string, Fs afero.Fs) (*ClientConfig, error)
GetClientConfigFromFile retrieves the client config from the configuration file at configPath. If configPath is not specified then the default configuration path is uses ~/.opk/config.yml
func NewClientConfig ¶
func NewClientConfig(c []byte) (*ClientConfig, error)
func (*ClientConfig) GetByIssuer ¶
func (c *ClientConfig) GetByIssuer(issuer string) (*ProviderConfig, bool)
GetByIssuer looks up an OpenID Provider by its issuer URL. If there are multiple providers with the same issuer, it returns the first one found.
func (*ClientConfig) GetProvidersMap ¶
func (c *ClientConfig) GetProvidersMap() (map[string]ProviderConfig, error)
type ProviderConfig ¶
type ProviderConfig struct {
AliasList []string `yaml:"alias"`
Issuer string `yaml:"issuer"`
ClientID string `yaml:"client_id"`
ClientSecret string `yaml:"client_secret,omitempty"`
Scopes []string `yaml:"scopes"`
AccessType string `yaml:"access_type,omitempty"`
Prompt string `yaml:"prompt,omitempty"`
RedirectURIs []string `yaml:"redirect_uris"`
SendAccessToken bool `yaml:"send_access_token,omitempty"`
}
func DefaultProviderConfig ¶
func DefaultProviderConfig() ProviderConfig
TODO: Move this into OpenPubkey providers package
func GetProvidersConfigFromEnv ¶
func GetProvidersConfigFromEnv() ([]ProviderConfig, error)
GetProvidersConfigFromEnv is a function to retrieve the config from the env variables OPKSSH_DEFAULT can be set to an alias OPKSSH_PROVIDERS is a ; separated list of providers of the format <alias>,<issuer>,<client_id>,<client_secret>,<scopes>;<alias>,<issuer>,<client_id>,<client_secret>,<scopes>
func GitHubProviderConfig ¶
func GitHubProviderConfig() ProviderConfig
func NewProviderConfigFromString ¶
func NewProviderConfigFromString(configStr string, hasAlias bool) (ProviderConfig, error)
NewProviderConfigFromString is a function to create the provider config from a string of the format {alias},{provider_url},{client_id},{client_secret},{scopes}
func ProvidersConfigListFromStrings ¶
func ProvidersConfigListFromStrings(providerList string) ([]ProviderConfig, error)
func (*ProviderConfig) ToProvider ¶
func (p *ProviderConfig) ToProvider(openBrowser bool) (providers.OpenIdProvider, error)
NewProviderFromConfig is a function to create the provider from the config
func (*ProviderConfig) UnmarshalYAML ¶
func (p *ProviderConfig) UnmarshalYAML(value *yaml.Node) error
type ServerConfig ¶
type ServerConfig struct {
EnvVars map[string]string `yaml:"env_vars"`
DenyUsers []string `yaml:"deny_users"`
DenyEmails []string `yaml:"deny_emails"`
}
ServerConfig struct to represent the /etc/opk/config.yml file that runs on the server that the user is SSHing into
func NewServerConfig ¶
func NewServerConfig(c []byte) (*ServerConfig, error)
func (*ServerConfig) SetEnvVars ¶
func (c *ServerConfig) SetEnvVars() error