config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 6 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 CreateProvidersMap

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

Types

type ClientConfig

type ClientConfig struct {
	DefaultProvider string           `yaml:"default_provider"`
	Providers       []ProviderConfig `yaml:"providers"`
}

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

Jump to

Keyboard shortcuts

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