config

package
v0.0.0-...-e440b92 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 17 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"
	CookiePrefix         = "cookie-prefix"
	CookieSameSite       = "cookie-same-site"
	EncryptionKey        = "encryption-key"
	Ingress              = "ingress"
	UpstreamAccessLogs   = "upstream-access-logs"
	UpstreamHost         = "upstream-host"
	UpstreamIP           = "upstream-ip"
	UpstreamPort         = "upstream-port"

	OpenIDACRValues             = "openid.acr-values"
	OpenIDAudiences             = "openid.audiences"
	OpenIDClientID              = "openid.client-id"
	OpenIDClientJWK             = "openid.client-jwk"
	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"

	OpenTelemetryEnabled     = "otel.enabled"
	OpenTelemetryServiceName = "otel.service-name"

	RedisAddress               = "redis.address"
	RedisPassword              = "redis.password"
	RedisTLS                   = "redis.tls"
	RedisUsername              = "redis.username"
	RedisURI                   = "redis.uri"
	RedisConnectionIdleTimeout = "redis.connection-idle-timeout"

	SessionInactivity        = "session.inactivity"
	SessionInactivityTimeout = "session.inactivity-timeout"
	SessionMaxLifetime       = "session.max-lifetime"
	SessionRefresh           = "session.refresh"
	SessionRefreshAuto       = "session.refresh-auto"

	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

func SameSiteAllStrings

func SameSiteAllStrings() []string

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"`
	CookiePrefix         string   `json:"cookie-prefix"`
	CookieSameSite       SameSite `json:"cookie-same-site"`
	EncryptionKey        string   `json:"encryption-key"`
	Ingresses            []string `json:"ingress"`
	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 OpenID

type OpenID struct {
	ACRValues             string   `json:"acr-values"`
	Audiences             []string `json:"audiences"`
	ClientID              string   `json:"client-id"`
	ClientJWK             string   `json:"client-jwk"`
	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

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 (in SSO) IsServer() bool

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 SameSiteAll

func SameSiteAll() []SameSite

func (SameSite) ToHttp

func (s SameSite) ToHttp() http.SameSite

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

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

Jump to

Keyboard shortcuts

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