config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorConfigArgumentMissing = errors.New("configuration file argument missing. Please specify using -config argument. Aborting")
	ErrorConfigFile            = errors.New("failed to read or parse configuration file. Aborting")
)

Functions

func AuthRequestTimeout

func AuthRequestTimeout() time.Duration

func AuthorizationEndpoint

func AuthorizationEndpoint() string

func CorsAllowOrigin

func CorsAllowOrigin() string

func DropoffEndpointUrl

func DropoffEndpointUrl() string

func ErrorUrl added in v0.1.2

func ErrorUrl() string

func IsCorsDisabled

func IsCorsDisabled() bool

func LoadConfiguration

func LoadConfiguration(filename string) error

func LoggingSeverity

func LoggingSeverity() string

func OidcAccessTokenCookieName

func OidcAccessTokenCookieName() string

func OidcAllowedAudience

func OidcAllowedAudience() string

func OidcAllowedIssuer

func OidcAllowedIssuer() string

func OidcIdTokenCookieName

func OidcIdTokenCookieName() string

func OidcKeySet

func OidcKeySet() []*rsa.PublicKey

func OidcTokenIntrospectionURL

func OidcTokenIntrospectionURL() string

func OidcUserInfoCacheEnabled

func OidcUserInfoCacheEnabled() bool

func OidcUserInfoCacheRetentionTime

func OidcUserInfoCacheRetentionTime() time.Duration

func OidcUserInfoURL

func OidcUserInfoURL() string

func ParseAndOverwriteConfig

func ParseAndOverwriteConfig(yamlFile []byte) error

func ParseCommandLineFlags

func ParseCommandLineFlags()

ParseCommandLineFlags is exposed separately so you can skip it for tests

func RelevantGroups

func RelevantGroups() map[string][]string

func SendInsecureCookies

func SendInsecureCookies() bool

func SendNonHttpOnlyCookies

func SendNonHttpOnlyCookies() bool

func ServerAddr

func ServerAddr() string

func ServerIdleTimeout

func ServerIdleTimeout() time.Duration

func ServerReadTimeout

func ServerReadTimeout() time.Duration

func ServerWriteTimeout

func ServerWriteTimeout() time.Duration

func StartupLoadConfiguration

func StartupLoadConfiguration() error

func TokenEndpoint

func TokenEndpoint() string

func TokenRequestTimeout

func TokenRequestTimeout() time.Duration

func UseEcsLogging

func UseEcsLogging() bool

Types

type Application

type Application struct {
	Service            ServiceConfig                `yaml:"service"`
	Server             ServerConfig                 `yaml:"server"`
	Security           SecurityConfig               `yaml:"security"`
	Logging            LoggingConfig                `yaml:"logging"`
	IdentityProvider   IdentityProviderConfig       `yaml:"identity_provider"`
	ApplicationConfigs map[string]ApplicationConfig `yaml:"application_configs"`
}

Application is the root configuration type

type ApplicationConfig

type ApplicationConfig struct {
	DisplayName       string        `yaml:"display_name"`
	Scope             string        `yaml:"scope"` // the list of scopes, separated by spaces (?)
	ClientId          string        `yaml:"client_id"`
	ClientSecret      string        `yaml:"client_secret"`
	DefaultDropoffUrl string        `yaml:"default_dropoff_url"`
	DropoffUrlPattern string        `yaml:"dropoff_url_pattern"`
	CookieName        string        `yaml:"cookie_name"`
	CookieDomain      string        `yaml:"cookie_domain"`
	CookiePath        string        `yaml:"cookie_path"`
	CookieExpiry      time.Duration `yaml:"cookie_expiry"`
}

ApplicationConfig configures an OpenID Connect client.

func GetApplicationConfig

func GetApplicationConfig(applicationName string) (ApplicationConfig, error)

type CorsConfig

type CorsConfig struct {
	DisableCors            bool   `yaml:"disable"`
	AllowOrigin            string `yaml:"allow_origin"`
	InsecureCookies        bool   `yaml:"insecure_cookies"`
	DisableHttpOnlyCookies bool   `yaml:"disable_http_only_cookies"`
}

type IdentityProviderConfig

type IdentityProviderConfig struct {
	AuthorizationEndpoint string        `yaml:"authorization_endpoint"`
	TokenEndpoint         string        `yaml:"token_endpoint"`
	EndSessionEndpoint    string        `yaml:"end_session_endpoint"`
	UserInfoEndpoint      string        `yaml:"user_info_endpoint"`
	KeySetEndpoint        string        `yaml:"key_set_endpoint"`
	TokenRequestTimeout   time.Duration `yaml:"token_request_timeout"`
	AuthRequestTimeout    time.Duration `yaml:"auth_request_timeout"`
}

IdentityProviderConfig provides information about an OpenID Connect identity provider

type LoggingConfig

type LoggingConfig struct {
	Severity string `yaml:"severity"`
}

LoggingConfig configures logging

type OpenIdConnectConfig

type OpenIdConnectConfig struct {
	IdTokenCookieName     string              `yaml:"id_token_cookie_name"`     // optional, if set, the jwt token is also read from this cookie (useful for mixed web application setups, see reg-auth-service)
	AccessTokenCookieName string              `yaml:"access_token_cookie_name"` // optional, if set, we place the auth token in a second cookie (used for userinfo endpoint)
	RelevantGroups        map[string][]string `yaml:"relevant_groups"`          // key is IDP group id, value is list of allowed subjects (all allowed if value is empty list)
	TokenPublicKeysPEM    []string            `yaml:"token_public_keys_PEM"`    // a list of public RSA keys in PEM format, see https://github.com/Jumpy-Squirrel/jwks2pem for obtaining PEM from openid keyset endpoint
	UserInfoURL           string              `yaml:"user_info_url"`            // validation of admin accesses uses this endpoint to verify the token is still current and access has not been recently revoked
	TokenIntrospectionURL string              `yaml:"token_introspection_url"`  // validation of tokens uses this endpoint to obtain scopes and audiences
	UserInfoCacheSeconds  int                 `yaml:"user_info_cache_seconds"`  // leave at 0 to disable caching
	Audience              string              `yaml:"audience"`
	Issuer                string              `yaml:"issuer"`
}

type SecurityConfig

type SecurityConfig struct {
	Cors CorsConfig          `yaml:"cors"`
	Oidc OpenIdConnectConfig `yaml:"oidc"`
}

SecurityConfig configures everything related to security

type ServerConfig

type ServerConfig struct {
	Address      string `yaml:"address"`
	Port         string `yaml:"port"`
	ReadTimeout  int    `yaml:"read_timeout_seconds"`
	WriteTimeout int    `yaml:"write_timeout_seconds"`
	IdleTimeout  int    `yaml:"idle_timeout_seconds"`
}

ServerConfig contains all values for http configuration

type ServiceConfig

type ServiceConfig struct {
	Name               string `yaml:"name"`
	DropoffEndpointUrl string `yaml:"dropoff_endpoint_url"` // externally visible url to my "dropoff" endpoint
	ErrorUrl           string `yaml:"error_url"`            // externally visible default error url
}

ServiceConfig contains configuration values for service related tasks. E.g. URLs to downstream services

Jump to

Keyboard shortcuts

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