config

package
v0.6.0-alpha.1.pre.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultIdentityTraitsSchemaID                                   = "default"
	DefaultBrowserReturnURL                                         = "default_browser_return_url"
	DefaultSQLiteMemoryDSN                                          = dbal.SQLiteInMemory
	DefaultPasswordHashingAlgorithm                                 = "argon2"
	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"
	ViperKeySecretsDefault                                          = "secrets.default"
	ViperKeySecretsCookie                                           = "secrets.cookie"
	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"
	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"
	ViperKeySessionLifespan                                         = "session.lifespan"
	ViperKeySessionSameSite                                         = "session.cookie.same_site"
	ViperKeySessionDomain                                           = "session.cookie.domain"
	ViperKeySessionName                                             = "session.cookie.name"
	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"
	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"
	ViperKeyPasswordMaxBreaches                                     = "selfservice.methods.password.config.max_breaches"
	ViperKeyIgnoreNetworkErrors                                     = "selfservice.methods.password.config.ignore_network_errors"
	ViperKeyVersion                                                 = "version"
	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.

Variables

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

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, opts ...configx.OptionModifier) *Config

func New

func New(ctx context.Context, l *logrusx.Logger, 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) ConfigVersion

func (p *Config) ConfigVersion() string

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) 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) 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) 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) 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) 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) 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) Set

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

func (*Config) Source

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

func (*Config) Tracing

func (p *Config) Tracing() *tracing.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 {
	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