config

package
v0.8.0-alpha.1.pre.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultIdentityTraitsSchemaID                            = "default"
	DefaultBrowserReturnURL                                  = "default_browser_return_url"
	DefaultSQLiteMemoryDSN                                   = dbal.SQLiteInMemory
	DefaultPasswordHashingAlgorithm                          = "argon2"
	DefaultCipherAlgorithm                                   = "noop"
	UnknownVersion                                           = "unknown version"
	ViperKeyDSN                                              = "dsn"
	ViperKeyCourierSMTPURL                                   = "courier.smtp.connection_uri"
	ViperKeyCourierTemplatesPath                             = "courier.template_override_path"
	ViperKeyCourierSMTPFrom                                  = "courier.smtp.from_address"
	ViperKeyCourierSMTPFromName                              = "courier.smtp.from_name"
	ViperKeyCourierSMTPHeaders                               = "courier.smtp.headers"
	ViperKeySecretsDefault                                   = "secrets.default"
	ViperKeySecretsCookie                                    = "secrets.cookie"
	ViperKeySecretsCipher                                    = "secrets.cipher"
	ViperKeyPublicBaseURL                                    = "serve.public.base_url"
	ViperKeyPublicDomainAliases                              = "serve.public.domain_aliases"
	ViperKeyPublicPort                                       = "serve.public.port"
	ViperKeyPublicHost                                       = "serve.public.host"
	ViperKeyPublicSocketOwner                                = "serve.public.socket.owner"
	ViperKeyPublicSocketGroup                                = "serve.public.socket.group"
	ViperKeyPublicSocketMode                                 = "serve.public.socket.mode"
	ViperKeyPublicTLSCertBase64                              = "serve.public.tls.cert.base64"
	ViperKeyPublicTLSKeyBase64                               = "serve.public.tls.key.base64"
	ViperKeyPublicTLSCertPath                                = "serve.public.tls.cert.path"
	ViperKeyPublicTLSKeyPath                                 = "serve.public.tls.key.path"
	ViperKeyAdminBaseURL                                     = "serve.admin.base_url"
	ViperKeyAdminPort                                        = "serve.admin.port"
	ViperKeyAdminHost                                        = "serve.admin.host"
	ViperKeyAdminSocketOwner                                 = "serve.admin.socket.owner"
	ViperKeyAdminSocketGroup                                 = "serve.admin.socket.group"
	ViperKeyAdminSocketMode                                  = "serve.admin.socket.mode"
	ViperKeyAdminTLSCertBase64                               = "serve.admin.tls.cert.base64"
	ViperKeyAdminTLSKeyBase64                                = "serve.admin.tls.key.base64"
	ViperKeyAdminTLSCertPath                                 = "serve.admin.tls.cert.path"
	ViperKeyAdminTLSKeyPath                                  = "serve.admin.tls.key.path"
	ViperKeySessionLifespan                                  = "session.lifespan"
	ViperKeySessionSameSite                                  = "session.cookie.same_site"
	ViperKeySessionDomain                                    = "session.cookie.domain"
	ViperKeySessionName                                      = "session.cookie.name"
	ViperKeySessionPath                                      = "session.cookie.path"
	ViperKeySessionPersistentCookie                          = "session.cookie.persistent"
	ViperKeySessionWhoAmIAAL                                 = "session.whoami.required_aal"
	ViperKeyCookieSameSite                                   = "cookies.same_site"
	ViperKeyCookieDomain                                     = "cookies.domain"
	ViperKeyCookiePath                                       = "cookies.path"
	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"
	ViperKeySelfServiceSettingsRequiredAAL                   = "selfservice.flows.settings.required_aal"
	ViperKeySelfServiceRecoveryAfter                         = "selfservice.flows.recovery.after"
	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
	ViperKeySelfServiceVerificationAfter                     = "selfservice.flows.verification.after"
	ViperKeyDefaultIdentitySchemaURL                         = "identity.default_schema_url"
	ViperKeyIdentitySchemas                                  = "identity.schemas"
	ViperKeyHasherAlgorithm                                  = "hashers.algorithm"
	ViperKeyHasherArgon2ConfigMemory                         = "hashers.argon2.memory"
	ViperKeyHasherArgon2ConfigIterations                     = "hashers.argon2.iterations"
	ViperKeyHasherArgon2ConfigParallelism                    = "hashers.argon2.parallelism"
	ViperKeyHasherArgon2ConfigSaltLength                     = "hashers.argon2.salt_length"
	ViperKeyHasherArgon2ConfigKeyLength                      = "hashers.argon2.key_length"
	ViperKeyHasherArgon2ConfigExpectedDuration               = "hashers.argon2.expected_duration"
	ViperKeyHasherArgon2ConfigExpectedDeviation              = "hashers.argon2.expected_deviation"
	ViperKeyHasherArgon2ConfigDedicatedMemory                = "hashers.argon2.dedicated_memory"
	ViperKeyHasherBcryptCost                                 = "hashers.bcrypt.cost"
	ViperKeyCipherAlgorithm                                  = "ciphers.algorithm"
	ViperKeyLinkLifespan                                     = "selfservice.methods.link.config.lifespan"
	ViperKeyPasswordHaveIBeenPwnedHost                       = "selfservice.methods.password.config.haveibeenpwned_host"
	ViperKeyPasswordHaveIBeenPwnedEnabled                    = "selfservice.methods.password.config.haveibeenpwned_enabled"
	ViperKeyPasswordMaxBreaches                              = "selfservice.methods.password.config.max_breaches"
	ViperKeyIgnoreNetworkErrors                              = "selfservice.methods.password.config.ignore_network_errors"
	ViperKeyTOTPIssuer                                       = "selfservice.methods.totp.config.issuer"
	ViperKeyWebAuthnRPDisplayName                            = "selfservice.methods.webauthn.config.rp.display_name"
	ViperKeyWebAuthnRPID                                     = "selfservice.methods.webauthn.config.rp.id"
	ViperKeyWebAuthnRPOrigin                                 = "selfservice.methods.webauthn.config.rp.origin"
	ViperKeyWebAuthnRPIcon                                   = "selfservice.methods.webauthn.config.rp.issuer"
	ViperKeyVersion                                          = "version"
)
View Source
const (
	HighestAvailableAAL                 = "highest_available"
	Argon2DefaultMemory                 = 128 * bytesize.MB
	Argon2DefaultIterations      uint32 = 1
	Argon2DefaultSaltLength      uint32 = 16
	Argon2DefaultKeyLength       uint32 = 32
	Argon2DefaultDuration               = 500 * time.Millisecond
	Argon2DefaultDeviation              = 500 * time.Millisecond
	Argon2DefaultDedicatedMemory        = 1 * bytesize.GB
	BcryptDefaultCost            uint32 = 12
)
View Source
const DefaultSessionCookieName = "ory_kratos_session"

DefaultSessionCookieName returns the default cookie name for the kratos session.

View Source
const HookGlobal = "global"

Variables

View Source
var (
	Version = "master"
	Date    = "undefined"
	Commit  = "undefined"
)
View Source
var Argon2DefaultParallelism = uint8(runtime.NumCPU() * 2)

Functions

func HookStrategyKey

func HookStrategyKey(key, strategy string) string

Types

type Argon2

type Argon2 struct {
	Memory            bytesize.ByteSize `json:"memory"`
	Iterations        uint32            `json:"iterations"`
	Parallelism       uint8             `json:"parallelism"`
	SaltLength        uint32            `json:"salt_length"`
	KeyLength         uint32            `json:"key_length"`
	ExpectedDuration  time.Duration     `json:"expected_duration"`
	ExpectedDeviation time.Duration     `json:"expected_deviation"`
	DedicatedMemory   bytesize.ByteSize `json:"dedicated_memory"`
}

func (*Argon2) MarshalJSON

func (c *Argon2) MarshalJSON() ([]byte, error)

type Bcrypt

type Bcrypt struct {
	Cost uint32 `json:"cost"`
}

type Config

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

func MustNew

func MustNew(t *testing.T, l *logrusx.Logger, stdOutOrErr io.Writer, opts ...configx.OptionModifier) *Config

func New

func New(ctx context.Context, l *logrusx.Logger, stdOutOrErr io.Writer, opts ...configx.OptionModifier) (*Config, error)

func (*Config) AdminListenOn

func (p *Config) AdminListenOn() string

func (*Config) AdminSocketPermission

func (p *Config) AdminSocketPermission() *configx.UnixPermission

func (*Config) CORS

func (p *Config) CORS(iface string) (cors.Options, bool)

func (*Config) CipherAlgorithm

func (p *Config) CipherAlgorithm() string

func (*Config) ConfigVersion

func (p *Config) ConfigVersion() string

func (*Config) CookieDomain

func (p *Config) CookieDomain() string

func (*Config) CookiePath

func (p *Config) CookiePath() string

func (*Config) CookieSameSiteMode

func (p *Config) CookieSameSiteMode() http.SameSite

func (*Config) CourierExposeMetricsPort

func (p *Config) CourierExposeMetricsPort() int

func (*Config) CourierSMTPFrom

func (p *Config) CourierSMTPFrom() string

func (*Config) CourierSMTPFromName

func (p *Config) CourierSMTPFromName() string

func (*Config) CourierSMTPHeaders

func (p *Config) CourierSMTPHeaders() map[string]string

func (*Config) CourierSMTPURL

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

func (*Config) CourierTemplatesRoot

func (p *Config) CourierTemplatesRoot() string

func (*Config) DSN

func (p *Config) DSN() string

func (*Config) DefaultIdentityTraitsSchemaURL

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

func (*Config) DisableAPIFlowEnforcement

func (p *Config) DisableAPIFlowEnforcement() bool

func (*Config) GetTSLCertificatesForAdmin

func (p *Config) GetTSLCertificatesForAdmin() []tls.Certificate

func (*Config) GetTSLCertificatesForPublic

func (p *Config) GetTSLCertificatesForPublic() []tls.Certificate

func (*Config) HasherArgon2

func (p *Config) HasherArgon2() *Argon2

func (*Config) HasherBcrypt

func (p *Config) HasherBcrypt() *Bcrypt

func (*Config) HasherPasswordHashingAlgorithm

func (p *Config) HasherPasswordHashingAlgorithm() string

func (*Config) IdentityTraitsSchemas

func (p *Config) IdentityTraitsSchemas() Schemas

func (*Config) IsBackgroundCourierEnabled

func (p *Config) IsBackgroundCourierEnabled() bool

func (*Config) IsInsecureDevMode

func (p *Config) IsInsecureDevMode() bool

func (*Config) MetricsListenOn

func (p *Config) MetricsListenOn() string

func (*Config) MustSet

func (p *Config) MustSet(key string, value interface{})

func (*Config) ParseURIOrFail

func (p *Config) ParseURIOrFail(key string) *url.URL

func (*Config) PasswordPolicyConfig

func (p *Config) PasswordPolicyConfig() *PasswordPolicy

func (*Config) PublicListenOn

func (p *Config) PublicListenOn() string

func (*Config) PublicSocketPermission

func (p *Config) PublicSocketPermission() *configx.UnixPermission

func (*Config) SecretsCipher

func (p *Config) SecretsCipher() [][32]byte

func (*Config) SecretsDefault

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

func (*Config) SecretsSession

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

func (*Config) SelfAdminURL

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

func (*Config) SelfPublicURL

func (p *Config) SelfPublicURL(r *http.Request) *url.URL

func (*Config) SelfServiceBrowserDefaultReturnTo

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

func (*Config) SelfServiceBrowserWhitelistedReturnToDomains

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

func (*Config) SelfServiceFlowErrorURL

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

func (*Config) SelfServiceFlowLoginAfterHooks

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

func (*Config) SelfServiceFlowLoginBeforeHooks

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

func (*Config) SelfServiceFlowLoginRequestLifespan

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

func (*Config) SelfServiceFlowLoginReturnTo

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

func (*Config) SelfServiceFlowLoginUI

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

func (*Config) SelfServiceFlowLogoutRedirectURL

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

func (*Config) SelfServiceFlowRecoveryAfterHooks

func (p *Config) SelfServiceFlowRecoveryAfterHooks(strategy string) []SelfServiceHook

func (*Config) SelfServiceFlowRecoveryEnabled

func (p *Config) SelfServiceFlowRecoveryEnabled() bool

func (*Config) SelfServiceFlowRecoveryRequestLifespan

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

func (*Config) SelfServiceFlowRecoveryReturnTo

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

func (*Config) SelfServiceFlowRecoveryUI

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

func (*Config) SelfServiceFlowRegistrationAfterHooks

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

func (*Config) SelfServiceFlowRegistrationBeforeHooks

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

func (*Config) SelfServiceFlowRegistrationRequestLifespan

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

func (*Config) SelfServiceFlowRegistrationReturnTo

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

func (*Config) SelfServiceFlowRegistrationUI

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

func (*Config) SelfServiceFlowSettingsAfterHooks

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

func (*Config) SelfServiceFlowSettingsFlowLifespan

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

func (*Config) SelfServiceFlowSettingsPrivilegedSessionMaxAge

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

func (*Config) SelfServiceFlowSettingsReturnTo

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

func (*Config) SelfServiceFlowSettingsUI

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

func (*Config) SelfServiceFlowVerificationAfterHooks

func (p *Config) SelfServiceFlowVerificationAfterHooks(strategy string) []SelfServiceHook

func (*Config) SelfServiceFlowVerificationEnabled

func (p *Config) SelfServiceFlowVerificationEnabled() bool

func (*Config) SelfServiceFlowVerificationRequestLifespan

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

func (*Config) SelfServiceFlowVerificationReturnTo

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

func (*Config) SelfServiceFlowVerificationUI

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

func (*Config) SelfServiceLinkMethodLifespan

func (p *Config) SelfServiceLinkMethodLifespan() time.Duration

func (*Config) SelfServiceSettingsRequiredAAL

func (p *Config) SelfServiceSettingsRequiredAAL() string

func (*Config) SelfServiceStrategy

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

func (*Config) SessionDomain

func (p *Config) SessionDomain() string

func (*Config) SessionLifespan

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

SessionLifespan returns nil when the value is not set.

func (*Config) SessionName

func (p *Config) SessionName() string

func (*Config) SessionPath

func (p *Config) SessionPath() string

func (*Config) SessionPersistentCookie

func (p *Config) SessionPersistentCookie() bool

func (*Config) SessionSameSiteMode

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

func (*Config) SessionWhoAmIAAL

func (p *Config) SessionWhoAmIAAL() string

func (*Config) Set

func (p *Config) Set(key string, value interface{}) error

func (*Config) Source

func (p *Config) Source() *configx.Provider

func (*Config) TOTPIssuer

func (p *Config) TOTPIssuer() string

func (*Config) Tracing

func (p *Config) Tracing() *tracing.Config

func (*Config) WebAuthnConfig

func (p *Config) WebAuthnConfig() *webauthn.Config

type DomainAlias

type DomainAlias struct {
	BasePath    string `json:"base_path"`
	Scheme      string `json:"scheme"`
	MatchDomain string `json:"match_domain"`
}

type PasswordPolicy

type PasswordPolicy struct {
	HaveIBeenPwnedHost    string `json:"haveibeenpwned_host"`
	HaveIBeenPwnedEnabled bool   `json:"haveibeenpwned_enabled"`
	MaxBreaches           uint   `json:"max_breaches"`
	IgnoreNetworkErrors   bool   `json:"ignore_network_errors"`
}

type Provider

type Provider interface {
	Config(ctx context.Context) *Config
}

type Schema

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

type Schemas

type Schemas []Schema

func (Schemas) FindSchemaByID

func (s Schemas) FindSchemaByID(id string) (*Schema, 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"`
}

Jump to

Keyboard shortcuts

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