2020-05-18 10:06:36 +00:00
|
|
|
package model
|
|
|
|
|
|
|
|
type NextStep interface {
|
|
|
|
Type() NextStepType
|
|
|
|
}
|
|
|
|
|
|
|
|
type NextStepType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
NextStepUnspecified NextStepType = iota
|
|
|
|
NextStepLogin
|
|
|
|
NextStepUserSelection
|
2020-06-05 05:50:04 +00:00
|
|
|
NextStepInitUser
|
2020-05-18 10:06:36 +00:00
|
|
|
NextStepPassword
|
|
|
|
NextStepChangePassword
|
|
|
|
NextStepInitPassword
|
|
|
|
NextStepVerifyEmail
|
|
|
|
NextStepMfaPrompt
|
|
|
|
NextStepMfaVerify
|
|
|
|
NextStepRedirectToCallback
|
2020-08-27 15:18:23 +00:00
|
|
|
NextStepChangeUsername
|
2020-09-18 11:26:28 +00:00
|
|
|
NextStepLinkUsers
|
|
|
|
NextStepExternalNotFoundOption
|
2020-10-02 06:02:09 +00:00
|
|
|
NextStepExternalLogin
|
2020-10-16 05:49:38 +00:00
|
|
|
NextStepGrantRequired
|
2020-05-18 10:06:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type UserSessionState int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
UserSessionStateActive UserSessionState = iota
|
|
|
|
UserSessionStateTerminated
|
|
|
|
)
|
|
|
|
|
2020-06-05 05:50:04 +00:00
|
|
|
type LoginStep struct{}
|
2020-05-18 10:06:36 +00:00
|
|
|
|
|
|
|
func (s *LoginStep) Type() NextStepType {
|
|
|
|
return NextStepLogin
|
|
|
|
}
|
|
|
|
|
|
|
|
type SelectUserStep struct {
|
|
|
|
Users []UserSelection
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SelectUserStep) Type() NextStepType {
|
|
|
|
return NextStepUserSelection
|
|
|
|
}
|
|
|
|
|
|
|
|
type UserSelection struct {
|
|
|
|
UserID string
|
2020-06-17 06:06:40 +00:00
|
|
|
DisplayName string
|
|
|
|
LoginName string
|
2020-05-18 10:06:36 +00:00
|
|
|
UserSessionState UserSessionState
|
|
|
|
}
|
|
|
|
|
2020-06-05 05:50:04 +00:00
|
|
|
type InitUserStep struct {
|
|
|
|
PasswordSet bool
|
|
|
|
}
|
|
|
|
|
2020-09-18 11:26:28 +00:00
|
|
|
type ExternalNotFoundOptionStep struct{}
|
|
|
|
|
|
|
|
func (s *ExternalNotFoundOptionStep) Type() NextStepType {
|
|
|
|
return NextStepExternalNotFoundOption
|
|
|
|
}
|
|
|
|
|
2020-06-05 05:50:04 +00:00
|
|
|
func (s *InitUserStep) Type() NextStepType {
|
|
|
|
return NextStepInitUser
|
2020-05-18 10:06:36 +00:00
|
|
|
}
|
|
|
|
|
2020-06-05 05:50:04 +00:00
|
|
|
type PasswordStep struct{}
|
|
|
|
|
2020-05-18 10:06:36 +00:00
|
|
|
func (s *PasswordStep) Type() NextStepType {
|
|
|
|
return NextStepPassword
|
|
|
|
}
|
|
|
|
|
2020-10-02 06:02:09 +00:00
|
|
|
type ExternalLoginStep struct {
|
|
|
|
SelectedIDPConfigID string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *ExternalLoginStep) Type() NextStepType {
|
|
|
|
return NextStepExternalLogin
|
|
|
|
}
|
|
|
|
|
2020-06-05 05:50:04 +00:00
|
|
|
type ChangePasswordStep struct{}
|
2020-05-18 10:06:36 +00:00
|
|
|
|
|
|
|
func (s *ChangePasswordStep) Type() NextStepType {
|
|
|
|
return NextStepChangePassword
|
|
|
|
}
|
|
|
|
|
2020-06-05 05:50:04 +00:00
|
|
|
type InitPasswordStep struct{}
|
2020-05-18 10:06:36 +00:00
|
|
|
|
|
|
|
func (s *InitPasswordStep) Type() NextStepType {
|
|
|
|
return NextStepInitPassword
|
|
|
|
}
|
|
|
|
|
2020-08-27 15:18:23 +00:00
|
|
|
type ChangeUsernameStep struct{}
|
|
|
|
|
|
|
|
func (s *ChangeUsernameStep) Type() NextStepType {
|
|
|
|
return NextStepChangeUsername
|
|
|
|
}
|
|
|
|
|
2020-06-05 05:50:04 +00:00
|
|
|
type VerifyEMailStep struct{}
|
2020-05-18 10:06:36 +00:00
|
|
|
|
|
|
|
func (s *VerifyEMailStep) Type() NextStepType {
|
|
|
|
return NextStepVerifyEmail
|
|
|
|
}
|
|
|
|
|
|
|
|
type MfaPromptStep struct {
|
|
|
|
Required bool
|
2020-11-04 10:26:10 +00:00
|
|
|
MfaProviders []MFAType
|
2020-05-18 10:06:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *MfaPromptStep) Type() NextStepType {
|
|
|
|
return NextStepMfaPrompt
|
|
|
|
}
|
|
|
|
|
|
|
|
type MfaVerificationStep struct {
|
2020-11-04 10:26:10 +00:00
|
|
|
MfaProviders []MFAType
|
2020-05-18 10:06:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *MfaVerificationStep) Type() NextStepType {
|
|
|
|
return NextStepMfaVerify
|
|
|
|
}
|
|
|
|
|
2020-09-18 11:26:28 +00:00
|
|
|
type LinkUsersStep struct{}
|
|
|
|
|
|
|
|
func (s *LinkUsersStep) Type() NextStepType {
|
|
|
|
return NextStepLinkUsers
|
|
|
|
}
|
|
|
|
|
2020-10-16 05:49:38 +00:00
|
|
|
type GrantRequiredStep struct{}
|
|
|
|
|
|
|
|
func (s *GrantRequiredStep) Type() NextStepType {
|
|
|
|
return NextStepGrantRequired
|
|
|
|
}
|
|
|
|
|
2020-06-05 05:50:04 +00:00
|
|
|
type RedirectToCallbackStep struct{}
|
2020-05-18 10:06:36 +00:00
|
|
|
|
|
|
|
func (s *RedirectToCallbackStep) Type() NextStepType {
|
|
|
|
return NextStepRedirectToCallback
|
|
|
|
}
|
|
|
|
|
2020-11-04 10:26:10 +00:00
|
|
|
type MFAType int
|
2020-05-18 10:06:36 +00:00
|
|
|
|
|
|
|
const (
|
2020-11-04 10:26:10 +00:00
|
|
|
MFATypeOTP MFAType = iota
|
|
|
|
MFATypeU2F
|
2020-05-18 10:06:36 +00:00
|
|
|
)
|
|
|
|
|
2020-11-04 10:26:10 +00:00
|
|
|
type MFALevel int
|
2020-05-18 10:06:36 +00:00
|
|
|
|
|
|
|
const (
|
2020-11-04 10:26:10 +00:00
|
|
|
MFALevelNotSetUp MFALevel = iota
|
|
|
|
MFALevelSecondFactor
|
|
|
|
MFALevelMultiFactor
|
|
|
|
MFALevelMultiFactorCertified
|
2020-05-18 10:06:36 +00:00
|
|
|
)
|