chore: move the go code into a subfolder

This commit is contained in:
Florian Forster
2025-08-05 15:20:32 -07:00
parent 4ad22ba456
commit cd2921de26
2978 changed files with 373 additions and 300 deletions

View File

@@ -0,0 +1,22 @@
package model
import (
"github.com/zitadel/zitadel/internal/crypto"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
)
type APIConfig struct {
es_models.ObjectRoot
AppID string
ClientID string
ClientSecret *crypto.CryptoValue
ClientSecretString string
AuthMethodType APIAuthMethodType
}
type APIAuthMethodType int32
const (
APIAuthMethodTypeBasic APIAuthMethodType = iota
APIAuthMethodTypePrivateKeyJWT
)

View File

@@ -0,0 +1,34 @@
package model
import (
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
)
type Application struct {
es_models.ObjectRoot
AppID string
State AppState
Name string
Type AppType
OIDCConfig *OIDCConfig
APIConfig *APIConfig
SAMLConfig *SAMLConfig
}
type AppState int32
const (
AppStateActive AppState = iota
AppStateInactive
AppStateRemoved
)
type AppType int32
const (
AppTypeUnspecified AppType = iota
AppTypeOIDC
AppTypeSAML
AppTypeAPI
)

View File

@@ -0,0 +1,110 @@
package model
import (
"time"
"github.com/muhlemmer/gu"
"github.com/zitadel/zitadel/internal/crypto"
"github.com/zitadel/zitadel/internal/domain"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
)
type OIDCConfig struct {
es_models.ObjectRoot
AppID string
ClientID string
ClientSecret *crypto.CryptoValue
ClientSecretString string
RedirectUris []string
ResponseTypes []OIDCResponseType
GrantTypes []OIDCGrantType
ApplicationType OIDCApplicationType
AuthMethodType OIDCAuthMethodType
PostLogoutRedirectUris []string
OIDCVersion OIDCVersion
Compliance *Compliance
DevMode bool
AccessTokenType OIDCTokenType
AccessTokenRoleAssertion bool
IDTokenRoleAssertion bool
IDTokenUserinfoAssertion bool
ClockSkew time.Duration
}
type OIDCVersion int32
const (
OIDCVersionV1 OIDCVersion = iota
)
type OIDCResponseType int32
const (
OIDCResponseTypeCode OIDCResponseType = iota
OIDCResponseTypeIDToken
OIDCResponseTypeIDTokenToken
)
type OIDCGrantType int32
const (
OIDCGrantTypeAuthorizationCode OIDCGrantType = iota
OIDCGrantTypeImplicit
OIDCGrantTypeRefreshToken
)
type OIDCApplicationType int32
const (
OIDCApplicationTypeWeb OIDCApplicationType = iota
OIDCApplicationTypeUserAgent
OIDCApplicationTypeNative
)
type OIDCAuthMethodType int32
const (
OIDCAuthMethodTypeBasic OIDCAuthMethodType = iota
OIDCAuthMethodTypePost
OIDCAuthMethodTypeNone
OIDCAuthMethodTypePrivateKeyJWT
)
type Compliance struct {
NoneCompliant bool
Problems []string
}
type OIDCTokenType int32
const (
OIDCTokenTypeBearer OIDCTokenType = iota
OIDCTokenTypeJWT
)
type Token struct {
es_models.ObjectRoot
TokenID string
ClientID string
Audience []string
Expiration time.Time
Scopes []string
}
func GetOIDCCompliance(version OIDCVersion, appType OIDCApplicationType, grantTypes []OIDCGrantType, responseTypes []OIDCResponseType, authMethod OIDCAuthMethodType, redirectUris []string) *Compliance {
switch version {
case OIDCVersionV1:
domainGrantTypes := make([]domain.OIDCGrantType, len(grantTypes))
for i, grantType := range grantTypes {
domainGrantTypes[i] = domain.OIDCGrantType(grantType)
}
compliance := domain.GetOIDCV1Compliance(gu.Ptr(domain.OIDCApplicationType(appType)), domainGrantTypes, gu.Ptr(domain.OIDCAuthMethodType(authMethod)), redirectUris)
return &Compliance{
NoneCompliant: compliance.NoneCompliant,
Problems: compliance.Problems,
}
}
return nil
}

View File

@@ -0,0 +1,29 @@
package model
import (
"github.com/zitadel/zitadel/internal/domain"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
)
type Project struct {
es_models.ObjectRoot
State ProjectState
Name string
Members []*ProjectMember
Roles []*ProjectRole
Applications []*Application
Grants []*ProjectGrant
ProjectRoleAssertion bool
ProjectRoleCheck bool
HasProjectCheck bool
PrivateLabelingSetting domain.PrivateLabelingSetting
}
type ProjectState int32
const (
ProjectStateActive ProjectState = iota
ProjectStateInactive
ProjectStateRemoved
)

View File

@@ -0,0 +1,22 @@
package model
import (
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
)
type ProjectGrant struct {
es_models.ObjectRoot
GrantID string
GrantedOrgID string
State ProjectGrantState
RoleKeys []string
Members []*ProjectGrantMember
}
type ProjectGrantState int32
const (
ProjectGrantStateActive ProjectGrantState = iota
ProjectGrantStateInactive
)

View File

@@ -0,0 +1,10 @@
package model
import es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
type ProjectGrantMember struct {
es_models.ObjectRoot
GrantID string
UserID string
Roles []string
}

View File

@@ -0,0 +1,10 @@
package model
import es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
type ProjectMember struct {
es_models.ObjectRoot
UserID string
Roles []string
}

View File

@@ -0,0 +1,11 @@
package model
import es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
type ProjectRole struct {
es_models.ObjectRoot
Key string
DisplayName string
Group string
}

View File

@@ -0,0 +1,12 @@
package model
import (
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
)
type SAMLConfig struct {
es_models.ObjectRoot
AppID string
Metadata []byte
MetadataURL string
}