42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package api
|
|
|
|
type AuthStorageConfig struct {
|
|
AccountsCollection string `yaml:"accounts_collection"`
|
|
RefreshTokensCollection string `yaml:"refresh_tokens_collection"`
|
|
ClientsCollection string `yaml:"clients_collection"`
|
|
VerificationTokensCollection string `yaml:"verification_tokens_collection"`
|
|
LoginAttemptsCollection string `yaml:"login_attempts_collection"`
|
|
VerificationRateLimitsCollection string `yaml:"verification_rate_limits_collection"`
|
|
}
|
|
|
|
func (c *AuthStorageConfig) WithDefaults() AuthStorageConfig {
|
|
if c == nil {
|
|
c = &AuthStorageConfig{}
|
|
}
|
|
res := *c
|
|
if res.AccountsCollection == "" {
|
|
res.AccountsCollection = "accounts"
|
|
}
|
|
if res.RefreshTokensCollection == "" {
|
|
res.RefreshTokensCollection = "refresh_tokens"
|
|
}
|
|
if res.ClientsCollection == "" {
|
|
res.ClientsCollection = "clients"
|
|
}
|
|
if res.VerificationTokensCollection == "" {
|
|
res.VerificationTokensCollection = "verification_tokens"
|
|
}
|
|
if res.LoginAttemptsCollection == "" {
|
|
res.LoginAttemptsCollection = "login_attempts"
|
|
}
|
|
if res.VerificationRateLimitsCollection == "" {
|
|
res.VerificationRateLimitsCollection = "verification_rate_limits"
|
|
}
|
|
return res
|
|
}
|
|
|
|
type VerificationConfig struct {
|
|
AllowedPurposes []string `yaml:"allowed_purposes"`
|
|
RateLimits *VerificationRateLimitsConfig `yaml:"rate_limits"`
|
|
}
|