configuration

package
v0.5.5-alpha.1.pre.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ViperKeyDSN = "dsn"

	ViperKeyCourierSMTPURL       = "courier.smtp.connection_uri"
	ViperKeyCourierTemplatesPath = "courier.template_override_path"
	ViperKeyCourierSMTPFrom      = "courier.smtp.from_address"

	ViperKeySecretsDefault = "secrets.default"
	ViperKeySecretsCookie  = "secrets.cookie"

	ViperKeyPublicBaseURL = "serve.public.base_url"
	ViperKeyPublicPort    = "serve.public.port"
	ViperKeyPublicHost    = "serve.public.host"
	ViperKeyAdminBaseURL  = "serve.admin.base_url"
	ViperKeyAdminPort     = "serve.admin.port"
	ViperKeyAdminHost     = "serve.admin.host"

	ViperKeySessionLifespan         = "session.lifespan"
	ViperKeySessionSameSite         = "session.cookie.same_site"
	ViperKeySessionDomain           = "session.cookie.domain"
	ViperKeySessionPath             = "session.cookie.path"
	ViperKeySessionPersistentCookie = "session.cookie.persistent"

	ViperKeySelfServiceStrategyConfig = "selfservice.methods"

	ViperKeySelfServiceBrowserDefaultReturnTo = "selfservice." + DefaultBrowserReturnURL
	ViperKeyURLsWhitelistedReturnToDomains    = "selfservice.whitelisted_return_urls"

	ViperKeySelfServiceRegistrationUI              = "selfservice.flows.registration.ui_url"
	ViperKeySelfServiceRegistrationRequestLifespan = "selfservice.flows.registration.lifespan"
	ViperKeySelfServiceRegistrationAfter           = "selfservice.flows.registration.after"
	ViperKeySelfServiceRegistrationBeforeHooks     = "selfservice.flows.registration.before.hooks"

	ViperKeySelfServiceLoginUI              = "selfservice.flows.login.ui_url"
	ViperKeySelfServiceLoginRequestLifespan = "selfservice.flows.login.lifespan"
	ViperKeySelfServiceLoginAfter           = "selfservice.flows.login.after"
	ViperKeySelfServiceLoginBeforeHooks     = "selfservice.flows.login.before.hooks"

	ViperKeySelfServiceErrorUI = "selfservice.flows.error.ui_url"

	ViperKeySelfServiceLogoutBrowserDefaultReturnTo = "selfservice.flows.logout.after." + DefaultBrowserReturnURL

	ViperKeySelfServiceSettingsURL                           = "selfservice.flows.settings.ui_url"
	ViperKeySelfServiceSettingsAfter                         = "selfservice.flows.settings.after"
	ViperKeySelfServiceSettingsRequestLifespan               = "selfservice.flows.settings.lifespan"
	ViperKeySelfServiceSettingsPrivilegedAuthenticationAfter = "selfservice.flows.settings.privileged_session_max_age"

	ViperKeySelfServiceRecoveryEnabled                = "selfservice.flows.recovery.enabled"
	ViperKeySelfServiceRecoveryUI                     = "selfservice.flows.recovery.ui_url"
	ViperKeySelfServiceRecoveryRequestLifespan        = "selfservice.flows.recovery.lifespan"
	ViperKeySelfServiceRecoveryBrowserDefaultReturnTo = "selfservice.flows.recovery.after." + DefaultBrowserReturnURL

	ViperKeySelfServiceVerificationEnabled                = "selfservice.flows.verification.enabled"
	ViperKeySelfServiceVerificationUI                     = "selfservice.flows.verification.ui_url"
	ViperKeySelfServiceVerificationRequestLifespan        = "selfservice.flows.verification.lifespan"
	ViperKeySelfServiceVerificationBrowserDefaultReturnTo = "selfservice.flows.verification.after." + DefaultBrowserReturnURL

	ViperKeyDefaultIdentitySchemaURL = "identity.default_schema_url"
	ViperKeyIdentitySchemas          = "identity.schemas"

	ViperKeyHasherArgon2ConfigMemory      = "hashers.argon2.memory"
	ViperKeyHasherArgon2ConfigIterations  = "hashers.argon2.iterations"
	ViperKeyHasherArgon2ConfigParallelism = "hashers.argon2.parallelism"
	ViperKeyHasherArgon2ConfigSaltLength  = "hashers.argon2.salt_length"
	ViperKeyHasherArgon2ConfigKeyLength   = "hashers.argon2.key_length"

	ViperKeyVersion = "version"
)
View Source
const (
	Argon2DefaultMemory     uint32 = 4 * 1024 * 1024
	Argon2DefaultIterations uint32 = 4
	Argon2DefaultSaltLength uint32 = 16
	Argon2DefaultKeyLength  uint32 = 32
)
View Source
const DefaultBrowserReturnURL = "default_browser_return_url"
View Source
const DefaultIdentityTraitsSchemaID = "default"
View Source
const DefaultSQLiteMemoryDSN = "sqlite://:memory:?_fk=true"
View Source
const UnknownVersion = "unknown version"

Variables

View Source
var Argon2DefaultParallelism = uint8(runtime.NumCPU() * 2)

Functions

func HookStrategyKey

func HookStrategyKey(key, strategy string) string

Types

type HasherArgon2Config

type HasherArgon2Config struct {
	Memory      uint32 `json:"memory"`
	Iterations  uint32 `json:"iterations"`
	Parallelism uint8  `json:"parallelism"`
	SaltLength  uint32 `json:"salt_length"`
	KeyLength   uint32 `json:"key_length"`
}

type Provider

type Provider interface {
	IsInsecureDevMode() bool
	DisableAPIFlowEnforcement() bool

	DSN() string

	AdminListenOn() string
	PublicListenOn() string

	SelfServiceBrowserDefaultReturnTo() *url.URL
	SelfServiceBrowserWhitelistedReturnToDomains() []url.URL

	SelfPublicURL() *url.URL
	SelfAdminURL() *url.URL

	SecretsDefault() [][]byte
	SecretsSession() [][]byte
	SessionLifespan() time.Duration
	SessionPersistentCookie() bool
	SessionSameSiteMode() http.SameSite
	SessionDomain() string
	SessionPath() string

	SelfServiceStrategy(strategy string) *SelfServiceStrategy

	SelfServiceFlowLoginUI() *url.URL
	SelfServiceFlowLoginBeforeHooks() []SelfServiceHook
	SelfServiceFlowLoginAfterHooks(strategy string) []SelfServiceHook
	SelfServiceFlowLoginReturnTo(strategy string) *url.URL
	SelfServiceFlowLoginRequestLifespan() time.Duration

	SelfServiceFlowRegistrationUI() *url.URL
	SelfServiceFlowRegistrationBeforeHooks() []SelfServiceHook
	SelfServiceFlowRegistrationAfterHooks(strategy string) []SelfServiceHook
	SelfServiceFlowRegistrationReturnTo(strategy string) *url.URL
	SelfServiceFlowRegistrationRequestLifespan() time.Duration

	SelfServiceFlowSettingsUI() *url.URL
	SelfServiceFlowSettingsPrivilegedSessionMaxAge() time.Duration
	SelfServiceFlowSettingsAfterHooks(strategy string) []SelfServiceHook
	SelfServiceFlowSettingsReturnTo(strategy string, defaultReturnTo *url.URL) *url.URL
	SelfServiceFlowSettingsFlowLifespan() time.Duration

	SelfServiceFlowVerificationEnabled() bool
	SelfServiceFlowVerificationUI() *url.URL
	SelfServiceFlowVerificationReturnTo(defaultReturnTo *url.URL) *url.URL
	SelfServiceFlowVerificationRequestLifespan() time.Duration

	SelfServiceFlowRecoveryEnabled() bool
	SelfServiceFlowRecoveryUI() *url.URL
	SelfServiceFlowRecoveryRequestLifespan() time.Duration

	SelfServiceFlowErrorURL() *url.URL

	SelfServiceFlowLogoutRedirectURL() *url.URL

	CourierSMTPFrom() string
	CourierSMTPURL() *url.URL
	CourierTemplatesRoot() string

	DefaultIdentityTraitsSchemaURL() *url.URL
	IdentityTraitsSchemas() SchemaConfigs

	HasherArgon2() *HasherArgon2Config

	TracingServiceName() string
	TracingProvider() string
	TracingJaegerConfig() *tracing.JaegerConfig

	ConfigVersion() string
}

type SchemaConfig

type SchemaConfig struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

type SchemaConfigs

type SchemaConfigs []SchemaConfig

func (SchemaConfigs) FindSchemaByID

func (s SchemaConfigs) FindSchemaByID(id string) (*SchemaConfig, error)

type SelfServiceHook

type SelfServiceHook struct {
	Name   string          `json:"hook"`
	Config json.RawMessage `json:"config"`
}

type SelfServiceStrategy

type SelfServiceStrategy struct {
	Enabled bool            `json:"enabled"`
	Config  json.RawMessage `json:"config"`
}

type ViperProvider

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

func NewViperProvider

func NewViperProvider(l *logrusx.Logger, dev bool) *ViperProvider

func (*ViperProvider) AdminListenOn

func (p *ViperProvider) AdminListenOn() string

func (*ViperProvider) ConfigVersion

func (p *ViperProvider) ConfigVersion() string

func (*ViperProvider) CourierSMTPFrom

func (p *ViperProvider) CourierSMTPFrom() string

func (*ViperProvider) CourierSMTPURL

func (p *ViperProvider) CourierSMTPURL() *url.URL

func (*ViperProvider) CourierTemplatesRoot

func (p *ViperProvider) CourierTemplatesRoot() string

func (*ViperProvider) DSN

func (p *ViperProvider) DSN() string

func (*ViperProvider) DefaultIdentityTraitsSchemaURL

func (p *ViperProvider) DefaultIdentityTraitsSchemaURL() *url.URL

func (*ViperProvider) DisableAPIFlowEnforcement

func (p *ViperProvider) DisableAPIFlowEnforcement() bool

func (*ViperProvider) HasherArgon2

func (p *ViperProvider) HasherArgon2() *HasherArgon2Config

func (*ViperProvider) IdentityTraitsSchemas

func (p *ViperProvider) IdentityTraitsSchemas() SchemaConfigs

func (*ViperProvider) IsInsecureDevMode

func (p *ViperProvider) IsInsecureDevMode() bool

func (*ViperProvider) PublicListenOn

func (p *ViperProvider) PublicListenOn() string

func (*ViperProvider) SecretsDefault

func (p *ViperProvider) SecretsDefault() [][]byte

func (*ViperProvider) SecretsSession

func (p *ViperProvider) SecretsSession() [][]byte

func (*ViperProvider) SelfAdminURL

func (p *ViperProvider) SelfAdminURL() *url.URL

func (*ViperProvider) SelfPublicURL

func (p *ViperProvider) SelfPublicURL() *url.URL

func (*ViperProvider) SelfServiceBrowserDefaultReturnTo

func (p *ViperProvider) SelfServiceBrowserDefaultReturnTo() *url.URL

func (*ViperProvider) SelfServiceBrowserWhitelistedReturnToDomains

func (p *ViperProvider) SelfServiceBrowserWhitelistedReturnToDomains() (us []url.URL)

func (*ViperProvider) SelfServiceFlowErrorURL

func (p *ViperProvider) SelfServiceFlowErrorURL() *url.URL

func (*ViperProvider) SelfServiceFlowLoginAfterHooks

func (p *ViperProvider) SelfServiceFlowLoginAfterHooks(strategy string) []SelfServiceHook

func (*ViperProvider) SelfServiceFlowLoginBeforeHooks

func (p *ViperProvider) SelfServiceFlowLoginBeforeHooks() []SelfServiceHook

func (*ViperProvider) SelfServiceFlowLoginRequestLifespan

func (p *ViperProvider) SelfServiceFlowLoginRequestLifespan() time.Duration

func (*ViperProvider) SelfServiceFlowLoginReturnTo

func (p *ViperProvider) SelfServiceFlowLoginReturnTo(strategy string) *url.URL

func (*ViperProvider) SelfServiceFlowLoginUI

func (p *ViperProvider) SelfServiceFlowLoginUI() *url.URL

func (*ViperProvider) SelfServiceFlowLogoutRedirectURL

func (p *ViperProvider) SelfServiceFlowLogoutRedirectURL() *url.URL

func (*ViperProvider) SelfServiceFlowRecoveryEnabled

func (p *ViperProvider) SelfServiceFlowRecoveryEnabled() bool

func (*ViperProvider) SelfServiceFlowRecoveryRequestLifespan

func (p *ViperProvider) SelfServiceFlowRecoveryRequestLifespan() time.Duration

func (*ViperProvider) SelfServiceFlowRecoveryReturnTo

func (p *ViperProvider) SelfServiceFlowRecoveryReturnTo() *url.URL

func (*ViperProvider) SelfServiceFlowRecoveryUI

func (p *ViperProvider) SelfServiceFlowRecoveryUI() *url.URL

func (*ViperProvider) SelfServiceFlowRegistrationAfterHooks

func (p *ViperProvider) SelfServiceFlowRegistrationAfterHooks(strategy string) []SelfServiceHook

func (*ViperProvider) SelfServiceFlowRegistrationBeforeHooks

func (p *ViperProvider) SelfServiceFlowRegistrationBeforeHooks() []SelfServiceHook

func (*ViperProvider) SelfServiceFlowRegistrationRequestLifespan

func (p *ViperProvider) SelfServiceFlowRegistrationRequestLifespan() time.Duration

func (*ViperProvider) SelfServiceFlowRegistrationReturnTo

func (p *ViperProvider) SelfServiceFlowRegistrationReturnTo(strategy string) *url.URL

func (*ViperProvider) SelfServiceFlowRegistrationUI

func (p *ViperProvider) SelfServiceFlowRegistrationUI() *url.URL

func (*ViperProvider) SelfServiceFlowSettingsAfterHooks

func (p *ViperProvider) SelfServiceFlowSettingsAfterHooks(strategy string) []SelfServiceHook

func (*ViperProvider) SelfServiceFlowSettingsFlowLifespan

func (p *ViperProvider) SelfServiceFlowSettingsFlowLifespan() time.Duration

func (*ViperProvider) SelfServiceFlowSettingsPrivilegedSessionMaxAge

func (p *ViperProvider) SelfServiceFlowSettingsPrivilegedSessionMaxAge() time.Duration

func (*ViperProvider) SelfServiceFlowSettingsReturnTo

func (p *ViperProvider) SelfServiceFlowSettingsReturnTo(strategy string, defaultReturnTo *url.URL) *url.URL

func (*ViperProvider) SelfServiceFlowSettingsUI

func (p *ViperProvider) SelfServiceFlowSettingsUI() *url.URL

func (*ViperProvider) SelfServiceFlowVerificationEnabled

func (p *ViperProvider) SelfServiceFlowVerificationEnabled() bool

func (*ViperProvider) SelfServiceFlowVerificationRequestLifespan

func (p *ViperProvider) SelfServiceFlowVerificationRequestLifespan() time.Duration

func (*ViperProvider) SelfServiceFlowVerificationReturnTo

func (p *ViperProvider) SelfServiceFlowVerificationReturnTo(defaultReturnTo *url.URL) *url.URL

func (*ViperProvider) SelfServiceFlowVerificationUI

func (p *ViperProvider) SelfServiceFlowVerificationUI() *url.URL

func (*ViperProvider) SelfServiceStrategy

func (p *ViperProvider) SelfServiceStrategy(strategy string) *SelfServiceStrategy

func (*ViperProvider) SessionDomain

func (p *ViperProvider) SessionDomain() string

func (*ViperProvider) SessionLifespan

func (p *ViperProvider) SessionLifespan() time.Duration

SessionLifespan returns nil when the value is not set.

func (*ViperProvider) SessionPath

func (p *ViperProvider) SessionPath() string

func (*ViperProvider) SessionPersistentCookie

func (p *ViperProvider) SessionPersistentCookie() bool

func (*ViperProvider) SessionSameSiteMode

func (p *ViperProvider) SessionSameSiteMode() http.SameSite

func (*ViperProvider) TracingJaegerConfig

func (p *ViperProvider) TracingJaegerConfig() *tracing.JaegerConfig

func (*ViperProvider) TracingProvider

func (p *ViperProvider) TracingProvider() string

func (*ViperProvider) TracingServiceName

func (p *ViperProvider) TracingServiceName() string

Jump to

Keyboard shortcuts

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