2023-02-15 09:14:59 +01:00
|
|
|
package domain
|
|
|
|
|
|
|
|
type IDPState int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
IDPStateUnspecified IDPState = iota
|
|
|
|
IDPStateActive
|
|
|
|
IDPStateInactive
|
|
|
|
IDPStateRemoved
|
|
|
|
|
|
|
|
idpStateCount
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s IDPState) Valid() bool {
|
|
|
|
return s >= 0 && s < idpStateCount
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s IDPState) Exists() bool {
|
|
|
|
return s != IDPStateUnspecified && s != IDPStateRemoved
|
|
|
|
}
|
|
|
|
|
|
|
|
type IDPType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
IDPTypeUnspecified IDPType = iota
|
|
|
|
IDPTypeOIDC
|
|
|
|
IDPTypeJWT
|
|
|
|
IDPTypeOAuth
|
|
|
|
IDPTypeLDAP
|
|
|
|
IDPTypeAzureAD
|
|
|
|
IDPTypeGitHub
|
2023-03-08 11:17:28 +01:00
|
|
|
IDPTypeGitHubEnterprise
|
2023-02-15 09:14:59 +01:00
|
|
|
IDPTypeGitLab
|
|
|
|
IDPTypeGitLabSelfHosted
|
|
|
|
IDPTypeGoogle
|
|
|
|
)
|
2023-02-28 21:20:58 +01:00
|
|
|
|
|
|
|
func (t IDPType) GetCSSClass() string {
|
2023-03-13 17:34:29 +01:00
|
|
|
switch t {
|
2023-02-28 21:20:58 +01:00
|
|
|
case IDPTypeGoogle:
|
|
|
|
return "google"
|
2023-03-08 11:17:28 +01:00
|
|
|
case IDPTypeGitHub,
|
|
|
|
IDPTypeGitHubEnterprise:
|
|
|
|
return "github"
|
2023-03-13 17:34:29 +01:00
|
|
|
case IDPTypeGitLab,
|
|
|
|
IDPTypeGitLabSelfHosted:
|
|
|
|
return "gitlab"
|
|
|
|
case IDPTypeUnspecified,
|
|
|
|
IDPTypeOIDC,
|
|
|
|
IDPTypeJWT,
|
|
|
|
IDPTypeOAuth,
|
|
|
|
IDPTypeLDAP,
|
|
|
|
IDPTypeAzureAD:
|
|
|
|
fallthrough
|
2023-02-28 21:20:58 +01:00
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|