fix: change to repository event types and removed unused code (#3386)

* fix: change to repository event types and removed unused code

* some fixes

* remove unused code
This commit is contained in:
Livio Amstutz
2022-03-31 11:36:26 +02:00
committed by GitHub
parent 55af4a18a2
commit 87560157c1
170 changed files with 999 additions and 9581 deletions

View File

@@ -19,7 +19,6 @@ type APIConfig struct {
ClientSecret *crypto.CryptoValue
ClientSecretString string
AuthMethodType APIAuthMethodType
ClientKeys []*ClientKey
}
type APIAuthMethodType int32

View File

@@ -1,8 +1,6 @@
package model
import (
"github.com/golang/protobuf/ptypes/timestamp"
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
)
@@ -16,21 +14,6 @@ type Application struct {
OIDCConfig *OIDCConfig
APIConfig *APIConfig
}
type ApplicationChanges struct {
Changes []*ApplicationChange
LastSequence uint64
}
type ApplicationChange struct {
ChangeDate *timestamp.Timestamp `json:"changeDate,omitempty"`
EventType string `json:"eventType,omitempty"`
Sequence uint64 `json:"sequence,omitempty"`
ModifierId string `json:"modifierUser,omitempty"`
ModifierName string `json:"-"`
ModifierLoginName string `json:"-"`
ModifierAvatarURL string `json:"-"`
Data interface{} `json:"data,omitempty"`
}
type AppState int32
@@ -49,10 +32,6 @@ const (
AppTypeAPI
)
func NewApplication(projectID, appID string) *Application {
return &Application{ObjectRoot: es_models.ObjectRoot{AggregateID: projectID}, AppID: appID, State: AppStateActive}
}
func (a *Application) IsValid(includeConfig bool) bool {
if a.Name == "" || a.AggregateID == "" {
return false
@@ -68,15 +47,3 @@ func (a *Application) IsValid(includeConfig bool) bool {
}
return true
}
func (a *Application) GetKey(keyID string) (int, *ClientKey) {
if a.OIDCConfig == nil {
return -1, nil
}
for i, k := range a.OIDCConfig.ClientKeys {
if k.KeyID == keyID {
return i, k
}
}
return -1, nil
}

View File

@@ -1,87 +0,0 @@
package model
import (
"github.com/caos/zitadel/internal/domain"
caos_errors "github.com/caos/zitadel/internal/errors"
"time"
)
type ApplicationView struct {
ID string
ProjectID string
Name string
CreationDate time.Time
ChangeDate time.Time
ResourceOwner string
State AppState
ProjectRoleAssertion bool
ProjectRoleCheck bool
HasProjectCheck bool
PrivateLabelingSetting domain.PrivateLabelingSetting
IsOIDC bool
OIDCVersion OIDCVersion
OIDCClientID string
OIDCRedirectUris []string
OIDCResponseTypes []OIDCResponseType
OIDCGrantTypes []OIDCGrantType
OIDCApplicationType OIDCApplicationType
OIDCAuthMethodType OIDCAuthMethodType
OIDCPostLogoutRedirectUris []string
NoneCompliant bool
ComplianceProblems []string
DevMode bool
OriginAllowList []string
AdditionalOrigins []string
AccessTokenType OIDCTokenType
IDTokenRoleAssertion bool
AccessTokenRoleAssertion bool
IDTokenUserinfoAssertion bool
ClockSkew time.Duration
Sequence uint64
}
type ApplicationSearchRequest struct {
Offset uint64
Limit uint64
SortingColumn AppSearchKey
Asc bool
Queries []*ApplicationSearchQuery
}
type AppSearchKey int32
const (
AppSearchKeyUnspecified AppSearchKey = iota
AppSearchKeyName
AppSearchKeyOIDCClientID
AppSearchKeyProjectID
AppSearchKeyAppID
)
type ApplicationSearchQuery struct {
Key AppSearchKey
Method domain.SearchMethod
Value interface{}
}
type ApplicationSearchResponse struct {
Offset uint64
Limit uint64
TotalResult uint64
Result []*ApplicationView
Sequence uint64
Timestamp time.Time
}
func (r *ApplicationSearchRequest) EnsureLimit(limit uint64) error {
if r.Limit > limit {
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-3Mf8s", "Errors.Limit.ExceedsDefault")
}
if r.Limit == 0 {
r.Limit = limit
}
return nil
}

View File

@@ -12,7 +12,6 @@ import (
"github.com/caos/zitadel/internal/errors"
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
"github.com/caos/zitadel/internal/id"
key_model "github.com/caos/zitadel/internal/key/model"
)
type OIDCConfig struct {
@@ -35,7 +34,6 @@ type OIDCConfig struct {
IDTokenRoleAssertion bool
IDTokenUserinfoAssertion bool
ClockSkew time.Duration
ClientKeys []*ClientKey
}
type OIDCVersion int32
@@ -89,17 +87,6 @@ const (
OIDCTokenTypeJWT
)
type ClientKey struct {
es_models.ObjectRoot
ApplicationID string
ClientID string
KeyID string
Type key_model.AuthNKeyType
ExpirationDate time.Time
PrivateKey []byte
}
type Token struct {
es_models.ObjectRoot

View File

@@ -1,8 +1,6 @@
package model
import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/caos/zitadel/internal/domain"
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
)
@@ -21,21 +19,6 @@ type Project struct {
HasProjectCheck bool
PrivateLabelingSetting domain.PrivateLabelingSetting
}
type ProjectChanges struct {
Changes []*ProjectChange
LastSequence uint64
}
type ProjectChange struct {
ChangeDate *timestamp.Timestamp `json:"changeDate,omitempty"`
EventType string `json:"eventType,omitempty"`
Sequence uint64 `json:"sequence,omitempty"`
ModifierId string `json:"modifierUser,omitempty"`
ModifierName string `json:"-"`
ModifierLoginName string `json:"-"`
ModifierAvatarURL string `json:"-"`
Data interface{} `json:"data,omitempty"`
}
type ProjectState int32
@@ -45,10 +28,6 @@ const (
ProjectStateRemoved
)
func NewProject(id string) *Project {
return &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: id}, State: ProjectStateActive}
}
func (p *Project) IsActive() bool {
return p.State == ProjectStateActive
}