config

package
v0.0.0-...-7dca2e3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BindAddress              = "bind-address"
	LogFormat                = "log-format"
	LogLevel                 = "log-level"
	MetricsBindAddress       = "metrics-bind-address"
	ShutdownGracefulPeriod   = "shutdown-graceful-period"
	ShutdownWaitBeforePeriod = "shutdown-wait-before-period"

	AutoLogin            = "auto-login"
	AutoLoginIgnorePaths = "auto-login-ignore-paths"
	Ingress              = "ingress"
	UpstreamAccessLogs   = "upstream-access-logs"
	UpstreamHost         = "upstream-host"
	UpstreamIP           = "upstream-ip"
	UpstreamPort         = "upstream-port"
)
View Source
const (
	CookiePrefix   = "cookie.prefix"
	CookieSameSite = "cookie.same-site"
	CookieSecure   = "cookie.secure"
	EncryptionKey  = "encryption-key"
	LegacyCookie   = "legacy-cookie"
)
View Source
const (
	OpenIDACRValues             = "openid.acr-values"
	OpenIDAudiences             = "openid.audiences"
	OpenIDClientID              = "openid.client-id"
	OpenIDClientJWK             = "openid.client-jwk"
	OpenIDClientSecret          = "openid.client-secret"
	OpenIDIDTokenSigningAlg     = "openid.id-token-signing-alg"
	OpenIDPostLogoutRedirectURI = "openid.post-logout-redirect-uri"
	OpenIDProvider              = "openid.provider"
	OpenIDResourceIndicator     = "openid.resource-indicator"
	OpenIDScopes                = "openid.scopes"
	OpenIDUILocales             = "openid.ui-locales"
	OpenIDWellKnownURL          = "openid.well-known-url"
)
View Source
const (
	OpenTelemetryEnabled     = "otel.enabled"
	OpenTelemetryServiceName = "otel.service-name"
)
View Source
const (
	RedisAddress               = "redis.address"
	RedisPassword              = "redis.password"
	RedisTLS                   = "redis.tls"
	RedisUsername              = "redis.username"
	RedisURI                   = "redis.uri"
	RedisConnectionIdleTimeout = "redis.connection-idle-timeout"
)
View Source
const (
	SessionInactivity        = "session.inactivity"
	SessionInactivityTimeout = "session.inactivity-timeout"
	SessionMaxLifetime       = "session.max-lifetime"
	SessionRefresh           = "session.refresh"
	SessionRefreshAuto       = "session.refresh-auto"
)
View Source
const (
	SSOEnabled                  = "sso.enabled"
	SSODomain                   = "sso.domain"
	SSOModeFlag                 = "sso.mode"
	SSOServerDefaultRedirectURL = "sso.server-default-redirect-url"
	SSOSessionCookieName        = "sso.session-cookie-name"
	SSOServerURL                = "sso.server-url"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BindAddress              string        `json:"bind-address"`
	LogFormat                string        `json:"log-format"`
	LogLevel                 string        `json:"log-level"`
	MetricsBindAddress       string        `json:"metrics-bind-address"`
	ShutdownGracefulPeriod   time.Duration `json:"shutdown-graceful-period"`
	ShutdownWaitBeforePeriod time.Duration `json:"shutdown-wait-before-period"`
	Version                  string        `json:"version"`

	AutoLogin            bool     `json:"auto-login"`
	AutoLoginIgnorePaths []string `json:"auto-login-ignore-paths"`
	Cookie               Cookie   `json:"cookie"`
	EncryptionKey        string   `json:"encryption-key"`
	Ingresses            []string `json:"ingress"`
	LegacyCookie         bool     `json:"legacy-cookie"`
	UpstreamAccessLogs   bool     `json:"upstream-access-logs"`
	UpstreamHost         string   `json:"upstream-host"`
	UpstreamIP           string   `json:"upstream-ip"`
	UpstreamPort         int      `json:"upstream-port"`

	OpenTelemetry OpenTelemetry `json:"otel"`
	OpenID        OpenID        `json:"openid"`
	Redis         Redis         `json:"redis"`
	Session       Session       `json:"session"`
	SSO           SSO           `json:"sso"`
}

func Initialize

func Initialize() (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error
type Cookie struct {
	Prefix   string   `json:"prefix"`
	SameSite SameSite `json:"same-site"`
	Secure   bool     `json:"secure"`
}

func (*Cookie) Validate

func (c *Cookie) Validate(cfg *Config) error

type OpenID

type OpenID struct {
	ACRValues             string   `json:"acr-values"`
	Audiences             []string `json:"audiences"`
	ClientID              string   `json:"client-id"`
	ClientJWK             string   `json:"client-jwk"`
	ClientSecret          string   `json:"client-secret"`
	IDTokenSigningAlg     string   `json:"id-token-signing-alg"`
	PostLogoutRedirectURI string   `json:"post-logout-redirect-uri"`
	Provider              Provider `json:"provider"`
	ResourceIndicator     string   `json:"resource-indicator"`
	Scopes                []string `json:"scopes"`
	UILocales             string   `json:"ui-locales"`
	WellKnownURL          string   `json:"well-known-url"`
}

func (OpenID) TrustedAudiences

func (in OpenID) TrustedAudiences() map[string]bool

func (OpenID) Validate

func (in OpenID) Validate() error

type OpenTelemetry

type OpenTelemetry struct {
	Enabled     bool   `json:"enabled"`
	ServiceName string `json:"service-name"`
}

type Provider

type Provider string
const (
	ProviderAzure    Provider = "azure"
	ProviderIDPorten Provider = "idporten"
	ProviderOpenID   Provider = "openid"
)

type Redis

type Redis struct {
	Address               string `json:"address"`
	Username              string `json:"username"`
	Password              string `json:"password"`
	TLS                   bool   `json:"tls"`
	URI                   string `json:"uri"`
	ConnectionIdleTimeout int    `json:"connection-idle-timeout"`
}

func (*Redis) Client

func (r *Redis) Client() (*redis.Client, error)

type SSO

type SSO struct {
	Enabled                  bool    `json:"enabled"`
	Domain                   string  `json:"domain"`
	Mode                     SSOMode `json:"mode"`
	SessionCookieName        string  `json:"session-cookie-name"`
	ServerURL                string  `json:"server-url"`
	ServerDefaultRedirectURL string  `json:"server-default-redirect-url"`
}

func (SSO) IsServer

func (s SSO) IsServer() bool

func (SSO) Validate

func (s SSO) Validate(c *Config) error

type SSOMode

type SSOMode string
const (
	SSOModeServer SSOMode = "server"
	SSOModeProxy  SSOMode = "proxy"
)

type SameSite

type SameSite string
const (
	SameSiteLax    SameSite = "Lax"
	SameSiteNone   SameSite = "None"
	SameSiteStrict SameSite = "Strict"
)

func (SameSite) ToHttp

func (s SameSite) ToHttp() http.SameSite

ToHttp returns the equivalent http.SameSite value for the SameSite attribute.

func (SameSite) Validate

func (s SameSite) Validate() error

type Session

type Session struct {
	Inactivity        bool          `json:"inactivity"`
	InactivityTimeout time.Duration `json:"inactivity-timeout"`
	MaxLifetime       time.Duration `json:"max-lifetime"`
	Refresh           bool          `json:"refresh"`
	RefreshAuto       bool          `json:"refresh-auto"`
}

func (Session) Validate

func (s Session) Validate() error

Jump to

Keyboard shortcuts

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