2021-01-04 14:52:13 +01:00
|
|
|
package domain
|
|
|
|
|
2022-02-21 16:05:02 +01:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
|
|
|
)
|
2021-01-05 09:33:45 +01:00
|
|
|
|
|
|
|
type LoginPolicy struct {
|
|
|
|
models.ObjectRoot
|
|
|
|
|
2022-02-21 16:05:02 +01:00
|
|
|
Default bool
|
|
|
|
AllowUsernamePassword bool
|
|
|
|
AllowRegister bool
|
|
|
|
AllowExternalIDP bool
|
|
|
|
IDPProviders []*IDPProvider
|
|
|
|
ForceMFA bool
|
|
|
|
SecondFactors []SecondFactorType
|
|
|
|
MultiFactors []MultiFactorType
|
|
|
|
PasswordlessType PasswordlessType
|
|
|
|
HidePasswordReset bool
|
|
|
|
PasswordCheckLifetime time.Duration
|
|
|
|
ExternalLoginCheckLifetime time.Duration
|
|
|
|
MFAInitSkipLifetime time.Duration
|
|
|
|
SecondFactorCheckLifetime time.Duration
|
|
|
|
MultiFactorCheckLifetime time.Duration
|
2021-01-05 09:33:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type IDPProvider struct {
|
|
|
|
models.ObjectRoot
|
|
|
|
Type IdentityProviderType
|
|
|
|
IDPConfigID string
|
2021-02-08 11:30:30 +01:00
|
|
|
|
|
|
|
Name string
|
|
|
|
StylingType IDPConfigStylingType
|
|
|
|
IDPConfigType IDPConfigType
|
|
|
|
IDPState IDPConfigState
|
2021-01-05 09:33:45 +01:00
|
|
|
}
|
|
|
|
|
2021-03-19 11:12:56 +01:00
|
|
|
func (p IDPProvider) IsValid() bool {
|
|
|
|
return p.IDPConfigID != ""
|
|
|
|
}
|
|
|
|
|
2021-01-04 14:52:13 +01:00
|
|
|
type PasswordlessType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
PasswordlessTypeNotAllowed PasswordlessType = iota
|
|
|
|
PasswordlessTypeAllowed
|
|
|
|
|
|
|
|
passwordlessCount
|
|
|
|
)
|
|
|
|
|
|
|
|
func (f PasswordlessType) Valid() bool {
|
|
|
|
return f >= 0 && f < passwordlessCount
|
|
|
|
}
|
2021-02-08 11:30:30 +01:00
|
|
|
|
|
|
|
func (p *LoginPolicy) HasSecondFactors() bool {
|
|
|
|
return len(p.SecondFactors) > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *LoginPolicy) HasMultiFactors() bool {
|
|
|
|
return len(p.MultiFactors) > 0
|
|
|
|
}
|