fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! added first event

This commit is contained in:
Iraq Jaber
2025-08-08 10:52:42 +01:00
parent b522e691cc
commit 5198c0e0a6
4 changed files with 4 additions and 920 deletions

View File

@@ -3,7 +3,6 @@
package events_test package events_test
import ( import (
"fmt"
"testing" "testing"
"time" "time"
@@ -177,7 +176,6 @@ func TestServer_TestIDProviderReduces(t *testing.T) {
assert.Equal(t, addOIDC.IdpId, idp.ID) assert.Equal(t, addOIDC.IdpId, idp.ID)
assert.Equal(t, domain.IDPStateActive.String(), idp.State) assert.Equal(t, domain.IDPStateActive.String(), idp.State)
assert.Equal(t, name, idp.Name) assert.Equal(t, name, idp.Name)
// assert.Equal(t, domain.IDPTypeUnspecified.String(), idp.Type)
assert.Equal(t, true, idp.AutoRegister) assert.Equal(t, true, idp.AutoRegister)
assert.Equal(t, true, idp.AllowCreation) assert.Equal(t, true, idp.AllowCreation)
assert.Equal(t, false, idp.AllowAutoUpdate) assert.Equal(t, false, idp.AllowAutoUpdate)
@@ -453,19 +451,6 @@ func TestServer_TestIDProviderReduces(t *testing.T) {
assert.Equal(t, addOIDC.IdpId, oidc.ID) assert.Equal(t, addOIDC.IdpId, oidc.ID)
}, retryDuration, tick) }, retryDuration, tick)
// // idp
// assert.Equal(t, addOIDC.IdpId, oidc.ID)
// assert.Equal(t, domain.IDPTypeOIDC.String(), oidc.Type)
// // oidc
// assert.Equal(t, instanceID, oidc.InstanceID)
// assert.Nil(t, oidc.OrgID)
// assert.Equal(t, "issuer", oidc.Issuer)
// assert.Equal(t, "clientID", oidc.ClientID)
// assert.Equal(t, []string{"scope"}, oidc.Scopes)
// assert.Equal(t, domain.OIDCMappingField(idp.OIDCMappingField_OIDC_MAPPING_FIELD_EMAIL), oidc.IDPDisplayNameMapping)
// assert.Equal(t, domain.OIDCMappingField(idp.OIDCMappingField_OIDC_MAPPING_FIELD_EMAIL), oidc.UserNameMapping)
beforeCreate := time.Now() beforeCreate := time.Now()
_, err = AdminClient.UpdateIDPOIDCConfig(CTX, &admin.UpdateIDPOIDCConfigRequest{ _, err = AdminClient.UpdateIDPOIDCConfig(CTX, &admin.UpdateIDPOIDCConfigRequest{
IdpId: addOIDC.IdpId, IdpId: addOIDC.IdpId,
@@ -570,25 +555,6 @@ func TestServer_TestIDProviderReduces(t *testing.T) {
idpRepo := repository.IDProviderRepository(pool) idpRepo := repository.IDProviderRepository(pool)
// check original values for jwt
// var jwt *domain.IDPJWT
// retryDuration, tick := integration.WaitForAndTickWithMaxDuration(CTX, time.Second*5)
// assert.EventuallyWithT(t, func(t *assert.CollectT) {
// jwt, err = idpRepo.GetJWT(CTX, idpRepo.IDCondition(addJWT.IdpId), instanceID, nil)
// require.NoError(t, err)
// assert.Equal(t, addJWT.IdpId, jwt.ID)
// }, retryDuration, tick)
// // idp
// assert.Equal(t, addJWT.IdpId, jwt.ID)
// assert.Equal(t, domain.IDPTypeJWT.String(), jwt.Type)
// // jwt
// assert.Equal(t, "jwtEndpoint", jwt.JWTEndpoint)
// assert.Equal(t, "issuer", jwt.Issuer)
// assert.Equal(t, "keyEndpoint", jwt.KeysEndpoint)
// assert.Equal(t, "headerName", jwt.HeaderName)
beforeCreate := time.Now() beforeCreate := time.Now()
_, err = AdminClient.UpdateIDPJWTConfig(CTX, &admin.UpdateIDPJWTConfigRequest{ _, err = AdminClient.UpdateIDPJWTConfig(CTX, &admin.UpdateIDPJWTConfigRequest{
IdpId: addJWT.IdpId, IdpId: addJWT.IdpId,
@@ -2555,7 +2521,6 @@ func TestServer_TestIDProviderReduces(t *testing.T) {
instanceID, instanceID,
nil, nil,
) )
fmt.Printf("@@ >>>>>>>>>>>>>>>>>>>>>>>>>>>> err = %+v\n", err)
require.ErrorIs(t, &database.NoRowFoundError{}, err) require.ErrorIs(t, &database.NoRowFoundError{}, err)
}, retryDuration, tick) }, retryDuration, tick)
}) })

View File

@@ -473,18 +473,3 @@ func (p *idpRelationalProjection) reduceJWTRelationalConfigChanged(event eventst
}, },
), nil ), nil
} }
// func (p *idpProjection) reduceOwnerRemoved(event eventstore.Event) (*handler.Statement, error) {
// e, ok := event.(*org.OrgRemovedEvent)
// if !ok {
// return nil, zerrors.ThrowInvalidArgumentf(nil, "PROJE-YsbQC", "reduce.wrong.event.type %s", org.OrgRemovedEventType)
// }
// return handler.NewDeleteStatement(
// e,
// []handler.Condition{
// handler.NewCond(IDPInstanceIDCol, e.Aggregate().InstanceID),
// handler.NewCond(IDPResourceOwnerCol, e.Aggregate().ID),
// },
// ), nil
// }

View File

@@ -2,6 +2,7 @@ package projection
import ( import (
"context" "context"
"fmt"
"time" "time"
"github.com/zitadel/zitadel/internal/database" "github.com/zitadel/zitadel/internal/database"
@@ -683,6 +684,7 @@ func (p *idpTemplateProjection) Reducers() []handler.AggregateReducer {
} }
func (p *idpTemplateProjection) reduceOAuthIDPAdded(event eventstore.Event) (*handler.Statement, error) { func (p *idpTemplateProjection) reduceOAuthIDPAdded(event eventstore.Event) (*handler.Statement, error) {
fmt.Println("@@ >>>>>>>>>>>>>>>>>>>>>>>>>>>> OAUTH ORIGINAL")
var idpEvent idp.OAuthIDPAddedEvent var idpEvent idp.OAuthIDPAddedEvent
var idpOwnerType domain.IdentityProviderType var idpOwnerType domain.IdentityProviderType
switch e := event.(type) { switch e := event.(type) {
@@ -2170,6 +2172,8 @@ func (p *idpTemplateProjection) reduceIDPConfigRemoved(event eventstore.Event) (
return nil, zerrors.ThrowInvalidArgumentf(nil, "HANDL-SAFet", "reduce.wrong.event.type %v", []eventstore.EventType{org.IDPConfigRemovedEventType, instance.IDPConfigRemovedEventType}) return nil, zerrors.ThrowInvalidArgumentf(nil, "HANDL-SAFet", "reduce.wrong.event.type %v", []eventstore.EventType{org.IDPConfigRemovedEventType, instance.IDPConfigRemovedEventType})
} }
fmt.Println("@@ >>>>>>>>>>>>>>>>>>>>>>>>>>>> IDP CONFIG REMOVED")
return handler.NewDeleteStatement( return handler.NewDeleteStatement(
&idpEvent, &idpEvent,
[]handler.Condition{ []handler.Condition{

File diff suppressed because it is too large Load Diff