mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:37:34 +00:00
chore: move the go code into a subfolder
This commit is contained in:
22
apps/api/internal/project/model/api_config.go
Normal file
22
apps/api/internal/project/model/api_config.go
Normal 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
|
||||
)
|
34
apps/api/internal/project/model/application.go
Normal file
34
apps/api/internal/project/model/application.go
Normal 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
|
||||
)
|
110
apps/api/internal/project/model/oidc_config.go
Normal file
110
apps/api/internal/project/model/oidc_config.go
Normal 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
|
||||
}
|
29
apps/api/internal/project/model/project.go
Normal file
29
apps/api/internal/project/model/project.go
Normal 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
|
||||
)
|
22
apps/api/internal/project/model/project_grant.go
Normal file
22
apps/api/internal/project/model/project_grant.go
Normal 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
|
||||
)
|
10
apps/api/internal/project/model/project_grant_member.go
Normal file
10
apps/api/internal/project/model/project_grant_member.go
Normal 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
|
||||
}
|
10
apps/api/internal/project/model/project_member.go
Normal file
10
apps/api/internal/project/model/project_member.go
Normal 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
|
||||
}
|
11
apps/api/internal/project/model/project_role.go
Normal file
11
apps/api/internal/project/model/project_role.go
Normal 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
|
||||
}
|
12
apps/api/internal/project/model/saml_config.go
Normal file
12
apps/api/internal/project/model/saml_config.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user