mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
feat: custom domain feature (#1618)
* fix: custom domain * fix: custom domain * fix: custom domain * fix: custom domain feature in proto * fix: remove custom domains on feature downgrade * fix test * fix: custom domain feature in proto * ensure tests work Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@ const (
|
||||
FeatureLoginPolicyUsernameLogin = FeatureLoginPolicy + ".username_login"
|
||||
FeaturePasswordComplexityPolicy = "password_complexity_policy"
|
||||
FeatureLabelPolicy = "label_policy"
|
||||
FeatureCustomDomain = "custom_domain"
|
||||
)
|
||||
|
||||
type Features struct {
|
||||
@@ -34,6 +35,7 @@ type Features struct {
|
||||
LoginPolicyUsernameLogin bool
|
||||
PasswordComplexityPolicy bool
|
||||
LabelPolicy bool
|
||||
CustomDomain bool
|
||||
}
|
||||
|
||||
type FeaturesState int32
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
)
|
||||
|
||||
@@ -29,11 +27,7 @@ func (o *Org) IsValid() bool {
|
||||
}
|
||||
|
||||
func (o *Org) AddIAMDomain(iamDomain string) {
|
||||
o.Domains = append(o.Domains, &OrgDomain{Domain: o.nameForDomain(iamDomain), Verified: true, Primary: true})
|
||||
}
|
||||
|
||||
func (o *Org) nameForDomain(iamDomain string) string {
|
||||
return strings.ToLower(strings.ReplaceAll(o.Name, " ", "-") + "." + iamDomain)
|
||||
o.Domains = append(o.Domains, &OrgDomain{Domain: NewIAMDomainName(o.Name, iamDomain), Verified: true, Primary: true})
|
||||
}
|
||||
|
||||
type OrgState int32
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
http_util "github.com/caos/zitadel/internal/api/http"
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
@@ -29,6 +31,10 @@ func (domain *OrgDomain) GenerateVerificationCode(codeGenerator crypto.Generator
|
||||
return validationCode, nil
|
||||
}
|
||||
|
||||
func NewIAMDomainName(orgName, iamDomain string) string {
|
||||
return strings.ToLower(strings.ReplaceAll(orgName, " ", "-") + "." + iamDomain)
|
||||
}
|
||||
|
||||
type OrgDomainValidationType int32
|
||||
|
||||
const (
|
||||
|
Reference in New Issue
Block a user