config

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WEBCHOOSER_ALIAS        = "WEBCHOOSER"
	OPKSSH_DEFAULT_ENVVAR   = "OPKSSH_DEFAULT"
	OPKSSH_PROVIDERS_ENVVAR = "OPKSSH_PROVIDERS"
)

Variables

View Source
var DefaultClientConfig []byte

Functions

func CreateDefaultClientConfig added in v0.10.0

func CreateDefaultClientConfig(configPath string, Fs afero.Fs) error

func CreateProvidersMap

func CreateProvidersMap(providerConfigList []ProviderConfig) (map[string]ProviderConfig, error)

func ResolveClientConfigPath added in v0.10.0

func ResolveClientConfigPath(configPath *string) error

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"`
	// Optional field to enable the use of non-localhost redirect URI.
	// This is an advanced option for embedding opkssh in server-side
	// logic and should not be specified most of the time.
	RemoteRedirectURI string `yaml:"remote_redirect_uri,omitempty"`
	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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL