mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +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:
@@ -58,6 +58,22 @@ func NewAPIConfigAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func (e *APIConfigAddedEvent) Validate(cmd eventstore.Command) bool {
|
||||
c, ok := cmd.(*APIConfigAddedEvent)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
if e.AppID != c.AppID {
|
||||
return false
|
||||
}
|
||||
if e.AuthMethodType != c.AuthMethodType {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func APIConfigAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e := &APIConfigAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
|
@@ -97,6 +97,92 @@ func NewOIDCConfigAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func (e *OIDCConfigAddedEvent) Validate(cmd eventstore.Command) bool {
|
||||
c, ok := cmd.(*OIDCConfigAddedEvent)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
if e.Version != c.Version {
|
||||
return false
|
||||
}
|
||||
if e.AppID != c.AppID {
|
||||
return false
|
||||
}
|
||||
if e.ClientID != "" && e.ClientID != c.ClientID {
|
||||
return false
|
||||
}
|
||||
if e.ClientSecret != c.ClientSecret {
|
||||
return false
|
||||
}
|
||||
if len(e.RedirectUris) != len(c.RedirectUris) {
|
||||
return false
|
||||
}
|
||||
for i, uri := range e.RedirectUris {
|
||||
if uri != c.RedirectUris[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if len(e.ResponseTypes) != len(c.ResponseTypes) {
|
||||
return false
|
||||
}
|
||||
for i, typ := range e.ResponseTypes {
|
||||
if typ != c.ResponseTypes[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if len(e.GrantTypes) != len(c.GrantTypes) {
|
||||
return false
|
||||
}
|
||||
for i, typ := range e.GrantTypes {
|
||||
if typ != c.GrantTypes[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if e.ApplicationType != c.ApplicationType {
|
||||
return false
|
||||
}
|
||||
if e.AuthMethodType != c.AuthMethodType {
|
||||
return false
|
||||
}
|
||||
if len(e.PostLogoutRedirectUris) != len(c.PostLogoutRedirectUris) {
|
||||
return false
|
||||
}
|
||||
for i, uri := range e.PostLogoutRedirectUris {
|
||||
if uri != c.PostLogoutRedirectUris[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if e.DevMode != c.DevMode {
|
||||
return false
|
||||
}
|
||||
if e.AccessTokenType != c.AccessTokenType {
|
||||
return false
|
||||
}
|
||||
if e.AccessTokenRoleAssertion != c.AccessTokenRoleAssertion {
|
||||
return false
|
||||
}
|
||||
if e.IDTokenRoleAssertion != c.IDTokenRoleAssertion {
|
||||
return false
|
||||
}
|
||||
if e.IDTokenUserinfoAssertion != c.IDTokenUserinfoAssertion {
|
||||
return false
|
||||
}
|
||||
if e.ClockSkew != c.ClockSkew {
|
||||
return false
|
||||
}
|
||||
if len(e.AdditionalOrigins) != len(c.AdditionalOrigins) {
|
||||
return false
|
||||
}
|
||||
for i, origin := range e.AdditionalOrigins {
|
||||
if origin != c.AdditionalOrigins[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func OIDCConfigAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e := &OIDCConfigAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
|
Reference in New Issue
Block a user