config

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

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

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) 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"`
}

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 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

Jump to

Keyboard shortcuts

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