config

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultScopes = ScopeConfig{
		"profile": []ClaimConfig{
			{Claim: "name", Attribute: "displayName", Type: "string"},
			{Claim: "given_name", Attribute: "givenName", Type: "string"},
			{Claim: "family_name", Attribute: "sn", Type: "string"},
		},
		"email": []ClaimConfig{
			{Claim: "email", Attribute: "mail", Type: "string"},
		},
		"phone": []ClaimConfig{
			{Claim: "phone_number", Attribute: "telephoneNumber", Type: "string"},
		},
		"groups": []ClaimConfig{
			{Claim: "groups", Attribute: "memberOf", Type: "[]string"},
		},
	}
)

Functions

func BindFlags

func BindFlags(vip *viper.Viper, flags *pflag.FlagSet)

func GetDCByDN

func GetDCByDN(dn string) (string, error)

func MappingClaims

func MappingClaims(attrs map[string][]string, maps map[string]ClaimConfig) map[string]interface{}

func TakeOptions

func TakeOptions(prefix string, typ reflect.Type, result map[string]string)

Types

type ClaimConfig

type ClaimConfig struct {
	Claim     string `yaml:"claim"`
	Attribute string `yaml:"attribute"`
	Type      string `yaml:"type,omitempty"`
}

type ClientConfig

type ClientConfig map[string]struct {
	Secret      string     `yaml:"secret"`
	RedirectURI PatternSet `yaml:"redirect_uri"`
}

type Config

type Config struct {
	Issuer            *URL           `yaml:"issuer"             flag:"issuer"`
	Listen            *TCPAddr       `yaml:"listen,omitempty"   flag:"listen"`
	SignKey           string         `yaml:"sign_key,omitempty" flag:"sign-key"`
	TLS               TLSConfig      `yaml:"tls,omitempty"`
	LDAP              LDAPConfig     `yaml:"ldap"`
	Expire            ExpireConfig   `yaml:"expire"`
	Endpoints         EndpointConfig `yaml:"endpoint"`
	Scopes            ScopeConfig    `yaml:"scope,omitempty"`
	Clients           ClientConfig   `yaml:"client,omitempty"`
	Metrics           MetricsConfig  `yaml:"metrics"`
	Templates         TemplateConfig `yaml:"template,omitempty"`
	DisableClientAuth bool           `yaml:"disable_client_auth" flag:"disable-client-auth"`
	AllowImplicitFlow bool           `yaml:"allow_implicit_flow" flag:"allow-implicit-flow"`
}

func (*Config) AsYAML

func (c *Config) AsYAML() (string, error)

func (*Config) EndpointPaths

func (c *Config) EndpointPaths() ResolvedEndpointPaths

func (*Config) Load

func (c *Config) Load(file string, flags *pflag.FlagSet) error

func (*Config) OpenIDConfiguration

func (c *Config) OpenIDConfiguration() OpenIDConfiguration

func (*Config) ReadReader

func (c *Config) ReadReader(config io.Reader) error

func (*Config) Validate

func (c *Config) Validate() error

type Duration

type Duration time.Duration

func NewDuration

func NewDuration(t time.Duration) *Duration

func ParseDuration

func ParseDuration(text string) (*Duration, error)

func (Duration) IntSeconds

func (d Duration) IntSeconds() int64

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

func (*Duration) Set

func (d *Duration) Set(str string) error

func (Duration) StrSeconds

func (d Duration) StrSeconds() string

func (Duration) String

func (d Duration) String() string

func (Duration) Type

func (d Duration) Type() string

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type EndpointConfig

type EndpointConfig struct {
	Authz    string `yaml:"authorization" flag:"authz-endpoint"`
	Token    string `yaml:"token"         flag:"token-endpoint"`
	Userinfo string `yaml:"userinfo"      flag:"userinfo-endpoint"`
	Jwks     string `yaml:"jwks"          flag:"jwks-uri"`
}

type EnvReplacer

type EnvReplacer struct{}

func (EnvReplacer) Replace

func (r EnvReplacer) Replace(s string) string

type ExpireConfig

type ExpireConfig struct {
	Login   Duration `yaml:"login"   flag:"login-expire"`
	Code    Duration `yaml:"code"    flag:"code-expire"`
	Token   Duration `yaml:"token"   flag:"token-expire"`
	Refresh Duration `yaml:"refresh" flag:"refresh-expire"`
	SSO     Duration `yaml:"sso"     flag:"sso-expire"`
}

type LDAPConfig

type LDAPConfig struct {
	Server      *URL   `yaml:"server"       flag:"ldap"`
	User        string `yaml:"user"         flag:"ldap-user"`
	Password    string `yaml:"password"     flag:"ldap-password"`
	BaseDN      string `yaml:"base_dn"      flag:"ldap-base-dn"`
	IDAttribute string `yaml:"id_attribute" flag:"ldap-id-attribute"`
	DisableTLS  bool   `yaml:"disable_tls"  flag:"ldap-disable-tls"`
}

type MetricsConfig

type MetricsConfig struct {
	Path     string `yaml:"path"               flag:"metrics-path"`
	Username string `yaml:"username,omitempty" flag:"metrics-username"`
	Password string `yaml:"password,omitempty" flag:"metrics-password"`
}

type OpenIDConfiguration

type OpenIDConfiguration struct {
	Issuer                            string   `json:"issuer"`
	AuthorizationEndpoint             string   `json:"authorization_endpoint"`
	TokenEndpoint                     string   `json:"token_endpoint"`
	UserinfoEndpoint                  string   `json:"userinfo_endpoint"`
	JwksEndpoint                      string   `json:"jwks_uri"`
	ScopesSupported                   []string `json:"scopes_supported"`
	ResponseTypesSupported            []string `json:"response_types_supported"`
	ResponseModesSupported            []string `json:"response_modes_supported"`
	GrantTypesSupported               []string `json:"grant_types_supported"`
	SubjectTypesSupported             []string `json:"subject_types_supported"`
	IDTokenSigningAlgValuesSupported  []string `json:"id_token_signing_alg_values_supported"`
	TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
	DisplayValuesSupported            []string `json:"display_values_supported"`
	ClaimsSupported                   []string `json:"claims_supported"`
	RequestURIParameterSupported      bool     `json:"request_uri_parameter_supported"`
}

type ParseErrorSet

type ParseErrorSet []error

func (ParseErrorSet) Error

func (es ParseErrorSet) Error() string

type Pattern

type Pattern struct {
	// contains filtered or unexported fields
}

func (Pattern) MarshalText

func (p Pattern) MarshalText() ([]byte, error)

func (Pattern) Match

func (p Pattern) Match(url string) bool

func (Pattern) String

func (p Pattern) String() string

func (*Pattern) UnmarshalText

func (p *Pattern) UnmarshalText(text []byte) error

type PatternSet

type PatternSet []Pattern

func (PatternSet) Match

func (ps PatternSet) Match(url string) bool

type ResolvedEndpointPaths

type ResolvedEndpointPaths struct {
	OpenIDConfiguration string
	Authz               string
	Token               string
	Userinfo            string
	Jwks                string
}

type ScopeConfig

type ScopeConfig map[string][]ClaimConfig

func (ScopeConfig) AllClaims

func (sc ScopeConfig) AllClaims() []string

func (ScopeConfig) AttributesFor

func (sc ScopeConfig) AttributesFor(scopes []string) []string

func (ScopeConfig) ClaimMapFor

func (sc ScopeConfig) ClaimMapFor(scopes []string) map[string]ClaimConfig

func (ScopeConfig) ScopeNames

func (sc ScopeConfig) ScopeNames() []string

type TCPAddr

type TCPAddr net.TCPAddr

func DecideListenAddress

func DecideListenAddress(issuer *URL, listen *TCPAddr) *TCPAddr

func (*TCPAddr) MarshalText

func (a *TCPAddr) MarshalText() ([]byte, error)

func (*TCPAddr) Set

func (a *TCPAddr) Set(str string) error

func (*TCPAddr) String

func (a *TCPAddr) String() string

func (*TCPAddr) Type

func (a *TCPAddr) Type() string

func (*TCPAddr) UnmarshalText

func (a *TCPAddr) UnmarshalText(text []byte) error

type TLSConfig

type TLSConfig struct {
	Cert string `yaml:"cert,omitempty" flag:"tls-cert"`
	Key  string `yaml:"key,omitempty"  flag:"tls-key"`
}

type TemplateConfig

type TemplateConfig struct {
	LoginPage string `yaml:"login_page,omitempty" flag:"login-page"`
	ErrorPage string `yaml:"error_page,omitempty" flag:"error-page"`
}

type URL

type URL url.URL

func (*URL) MarshalText

func (u *URL) MarshalText() ([]byte, error)

func (*URL) Set

func (u *URL) Set(str string) error

func (*URL) String

func (u *URL) String() string

func (*URL) Type

func (u *URL) Type() string

func (*URL) UnmarshalText

func (u *URL) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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