zitadel/internal/domain/user.go
Fabi 3902f9adb5
feat: auth method projection (#3020)
* feat: auth method projection

* feat: auth method projection

* feat: add tests
2022-01-19 14:49:50 +01:00

56 lines
933 B
Go

package domain
type User interface {
GetUsername() string
GetState() UserState
}
type UserState int32
const (
UserStateUnspecified UserState = iota
UserStateActive
UserStateInactive
UserStateDeleted
UserStateLocked
UserStateSuspend
UserStateInitial
userStateCount
)
func (f UserState) Valid() bool {
return f >= 0 && f < userStateCount
}
func (s UserState) Exists() bool {
return s != UserStateUnspecified && s != UserStateDeleted
}
type UserType int32
const (
UserTypeUnspecified UserType = iota
UserTypeHuman
UserTypeMachine
userTypeCount
)
func (f UserType) Valid() bool {
return f >= 0 && f < userTypeCount
}
type UserAuthMethodType int32
const (
UserAuthMethodTypeUnspecified UserAuthMethodType = iota
UserAuthMethodTypeOTP
UserAuthMethodTypeU2F
UserAuthMethodTypePasswordless
userAuthMethodTypeCount
)
func (f UserAuthMethodType) Valid() bool {
return f >= 0 && f < userAuthMethodTypeCount
}