mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
e4bdaf26b0
* faet: auto regsiter config on idp * feat: auto register on login * feat: auto register on register * feat: redirect to selected identity provider * fix: test * fix: test * fix: user by id request org id * fix: migration version and test Co-authored-by: Livio Amstutz <livio.a@gmail.com>
112 lines
2.4 KiB
Go
112 lines
2.4 KiB
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/caos/zitadel/internal/crypto"
|
|
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
|
)
|
|
|
|
type IDPConfig struct {
|
|
es_models.ObjectRoot
|
|
IDPConfigID string
|
|
Type IDPConfigType
|
|
Name string
|
|
StylingType IDPConfigStylingType
|
|
State IDPConfigState
|
|
OIDCConfig *OIDCIDPConfig
|
|
AutoRegister bool
|
|
}
|
|
|
|
type IDPConfigView struct {
|
|
AggregateID string
|
|
IDPConfigID string
|
|
Name string
|
|
StylingType IDPConfigStylingType
|
|
State IDPConfigState
|
|
CreationDate time.Time
|
|
ChangeDate time.Time
|
|
Sequence uint64
|
|
IDPProviderType IdentityProviderType
|
|
AutoRegister bool
|
|
|
|
IsOIDC bool
|
|
OIDCClientID string
|
|
OIDCClientSecret *crypto.CryptoValue
|
|
OIDCIssuer string
|
|
OIDCScopes []string
|
|
OIDCIDPDisplayNameMapping OIDCMappingField
|
|
OIDCUsernameMapping OIDCMappingField
|
|
OAuthAuthorizationEndpoint string
|
|
OAuthTokenEndpoint string
|
|
}
|
|
|
|
type OIDCIDPConfig struct {
|
|
es_models.ObjectRoot
|
|
IDPConfigID string
|
|
ClientID string
|
|
ClientSecret *crypto.CryptoValue
|
|
ClientSecretString string
|
|
Issuer string
|
|
AuthorizationEndpoint string
|
|
TokenEndpoint string
|
|
Scopes []string
|
|
IDPDisplayNameMapping OIDCMappingField
|
|
UsernameMapping OIDCMappingField
|
|
}
|
|
|
|
type IDPConfigType int32
|
|
|
|
const (
|
|
IDPConfigTypeOIDC IDPConfigType = iota
|
|
IDPConfigTypeSAML
|
|
|
|
//count is for validation
|
|
idpConfigTypeCount
|
|
)
|
|
|
|
func (f IDPConfigType) Valid() bool {
|
|
return f >= 0 && f < idpConfigTypeCount
|
|
}
|
|
|
|
type IDPConfigState int32
|
|
|
|
const (
|
|
IDPConfigStateUnspecified IDPConfigState = iota
|
|
IDPConfigStateActive
|
|
IDPConfigStateInactive
|
|
IDPConfigStateRemoved
|
|
|
|
idpConfigStateCount
|
|
)
|
|
|
|
func (s IDPConfigState) Valid() bool {
|
|
return s >= 0 && s < idpConfigStateCount
|
|
}
|
|
|
|
func (s IDPConfigState) Exists() bool {
|
|
return s != IDPConfigStateUnspecified || s == IDPConfigStateRemoved
|
|
}
|
|
|
|
type IDPConfigStylingType int32
|
|
|
|
const (
|
|
IDPConfigStylingTypeUnspecified IDPConfigStylingType = iota
|
|
IDPConfigStylingTypeGoogle
|
|
|
|
idpConfigStylingTypeCount
|
|
)
|
|
|
|
func (f IDPConfigStylingType) Valid() bool {
|
|
return f >= 0 && f < idpConfigStylingTypeCount
|
|
}
|
|
|
|
func (st IDPConfigStylingType) GetCSSClass() string {
|
|
switch st {
|
|
case IDPConfigStylingTypeGoogle:
|
|
return "google"
|
|
default:
|
|
return ""
|
|
}
|
|
}
|