mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:47:32 +00:00
fix: v2 human command (#3435)
* add/register human command done * validations * crypto * move clientid * keys * fix: clientID * remove v2 package * tests * tests running * revert old code * instance domain from ctx * chore: rename zitadel app ids * comments * fix: test
This commit is contained in:
@@ -146,10 +146,15 @@ func (a *OIDCApp) OriginsValid() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (a *OIDCApp) getRequiredGrantTypes() []OIDCGrantType {
|
||||
grantTypes := make([]OIDCGrantType, 0)
|
||||
implicit := false
|
||||
for _, r := range a.ResponseTypes {
|
||||
func ContainsRequiredGrantTypes(responseTypes []OIDCResponseType, grantTypes []OIDCGrantType) bool {
|
||||
required := RequiredOIDCGrantTypes(responseTypes)
|
||||
return ContainsOIDCGrantTypes(required, grantTypes)
|
||||
}
|
||||
|
||||
func RequiredOIDCGrantTypes(responseTypes []OIDCResponseType) (grantTypes []OIDCGrantType) {
|
||||
var implicit bool
|
||||
|
||||
for _, r := range responseTypes {
|
||||
switch r {
|
||||
case OIDCResponseTypeCode:
|
||||
grantTypes = append(grantTypes, OIDCGrantTypeAuthorizationCode)
|
||||
@@ -160,9 +165,23 @@ func (a *OIDCApp) getRequiredGrantTypes() []OIDCGrantType {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return grantTypes
|
||||
}
|
||||
|
||||
func (a *OIDCApp) getRequiredGrantTypes() []OIDCGrantType {
|
||||
return RequiredOIDCGrantTypes(a.ResponseTypes)
|
||||
}
|
||||
|
||||
func ContainsOIDCGrantTypes(shouldContain, list []OIDCGrantType) bool {
|
||||
for _, should := range shouldContain {
|
||||
if !containsOIDCGrantType(list, should) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func containsOIDCGrantType(grantTypes []OIDCGrantType, grantType OIDCGrantType) bool {
|
||||
for _, gt := range grantTypes {
|
||||
if gt == grantType {
|
||||
|
@@ -8,6 +8,11 @@ import (
|
||||
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
)
|
||||
|
||||
type HumanDetails struct {
|
||||
ID string
|
||||
ObjectDetails
|
||||
}
|
||||
|
||||
type Human struct {
|
||||
es_models.ObjectRoot
|
||||
|
||||
|
@@ -8,7 +8,9 @@ import (
|
||||
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
)
|
||||
|
||||
var EmailRegex = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
|
||||
var (
|
||||
EmailRegex = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
|
||||
)
|
||||
|
||||
type Email struct {
|
||||
es_models.ObjectRoot
|
||||
|
@@ -1,11 +1,12 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
"github.com/ttacon/libphonenumber"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@@ -22,8 +22,14 @@ const (
|
||||
ProjectStateActive
|
||||
ProjectStateInactive
|
||||
ProjectStateRemoved
|
||||
|
||||
projectStateMax
|
||||
)
|
||||
|
||||
func (s ProjectState) Valid() bool {
|
||||
return s > ProjectStateUnspecified && s < projectStateMax
|
||||
}
|
||||
|
||||
type PrivateLabelingSetting int32
|
||||
|
||||
const (
|
||||
|
@@ -7,6 +7,7 @@ const (
|
||||
SecretGeneratorTypeInitCode
|
||||
SecretGeneratorTypeVerifyEmailCode
|
||||
SecretGeneratorTypeVerifyPhoneCode
|
||||
SecretGeneratorTypeVerifyDomain
|
||||
SecretGeneratorTypePasswordResetCode
|
||||
SecretGeneratorTypePasswordlessInitCode
|
||||
SecretGeneratorTypeAppSecret
|
||||
@@ -14,6 +15,10 @@ const (
|
||||
secretGeneratorTypeCount
|
||||
)
|
||||
|
||||
func (t SecretGeneratorType) Valid() bool {
|
||||
return t > SecretGeneratorTypeUnspecified && t < secretGeneratorTypeCount
|
||||
}
|
||||
|
||||
type SecretGeneratorState int32
|
||||
|
||||
const (
|
||||
|
Reference in New Issue
Block a user