mirror of
https://github.com/zitadel/zitadel.git
synced 2026-08-19 01:14:48 -05:00
Merge commit from fork
* feat(jwt idp): manage and validate audience * translations * fix tests * address comments * update migration version * fix merge
This commit is contained in:
@@ -41,6 +41,7 @@ type JWTProvider struct {
|
||||
JWTEndpoint string
|
||||
KeyEndpoint string
|
||||
HeaderName string
|
||||
Audience string
|
||||
IDPOptions idp.Options
|
||||
}
|
||||
|
||||
|
||||
@@ -430,6 +430,7 @@ type JWTIDPWriteModel struct {
|
||||
JWTEndpoint string
|
||||
KeysEndpoint string
|
||||
HeaderName string
|
||||
Audience string
|
||||
idp.Options
|
||||
|
||||
State domain.IDPState
|
||||
@@ -465,6 +466,7 @@ func (wm *JWTIDPWriteModel) reduceAddedEvent(e *idp.JWTIDPAddedEvent) {
|
||||
wm.JWTEndpoint = e.JWTEndpoint
|
||||
wm.KeysEndpoint = e.KeysEndpoint
|
||||
wm.HeaderName = e.HeaderName
|
||||
wm.Audience = e.Audience
|
||||
wm.Options = e.Options
|
||||
wm.State = domain.IDPStateActive
|
||||
}
|
||||
@@ -485,6 +487,9 @@ func (wm *JWTIDPWriteModel) reduceChangedEvent(e *idp.JWTIDPChangedEvent) {
|
||||
if e.HeaderName != nil {
|
||||
wm.HeaderName = *e.HeaderName
|
||||
}
|
||||
if e.Audience != nil {
|
||||
wm.Audience = *e.Audience
|
||||
}
|
||||
wm.Options.ReduceChanges(e.OptionChanges)
|
||||
}
|
||||
|
||||
@@ -493,7 +498,8 @@ func (wm *JWTIDPWriteModel) NewChanges(
|
||||
issuer,
|
||||
jwtEndpoint,
|
||||
keysEndpoint,
|
||||
headerName string,
|
||||
headerName,
|
||||
audience string,
|
||||
options idp.Options,
|
||||
) ([]idp.JWTIDPChanges, error) {
|
||||
changes := make([]idp.JWTIDPChanges, 0)
|
||||
@@ -512,6 +518,9 @@ func (wm *JWTIDPWriteModel) NewChanges(
|
||||
if wm.HeaderName != headerName {
|
||||
changes = append(changes, idp.ChangeJWTHeaderName(headerName))
|
||||
}
|
||||
if wm.Audience != audience {
|
||||
changes = append(changes, idp.ChangeJWTAudience(audience))
|
||||
}
|
||||
opts := wm.Options.Changes(options)
|
||||
if !opts.IsZero() {
|
||||
changes = append(changes, idp.ChangeJWTOptions(opts))
|
||||
@@ -583,6 +592,7 @@ func (wm *JWTIDPWriteModel) ToProvider(callbackURL string, idpAlg crypto.Encrypt
|
||||
wm.JWTEndpoint,
|
||||
wm.KeysEndpoint,
|
||||
wm.HeaderName,
|
||||
wm.Audience,
|
||||
idpAlg,
|
||||
opts...,
|
||||
)
|
||||
|
||||
@@ -940,6 +940,7 @@ func (c *Commands) prepareAddInstanceJWTProvider(a *instance.Aggregate, writeMod
|
||||
provider.JWTEndpoint,
|
||||
provider.KeyEndpoint,
|
||||
provider.HeaderName,
|
||||
provider.Audience,
|
||||
provider.IDPOptions,
|
||||
),
|
||||
}, nil
|
||||
@@ -988,6 +989,7 @@ func (c *Commands) prepareUpdateInstanceJWTProvider(a *instance.Aggregate, write
|
||||
provider.JWTEndpoint,
|
||||
provider.KeyEndpoint,
|
||||
provider.HeaderName,
|
||||
provider.Audience,
|
||||
provider.IDPOptions,
|
||||
)
|
||||
if err != nil || event == nil {
|
||||
|
||||
@@ -274,7 +274,8 @@ func (wm *InstanceJWTIDPWriteModel) NewChangedEvent(
|
||||
issuer,
|
||||
jwtEndpoint,
|
||||
keysEndpoint,
|
||||
headerName string,
|
||||
headerName,
|
||||
audience string,
|
||||
options idp.Options,
|
||||
) (*instance.JWTIDPChangedEvent, error) {
|
||||
|
||||
@@ -284,6 +285,7 @@ func (wm *InstanceJWTIDPWriteModel) NewChangedEvent(
|
||||
jwtEndpoint,
|
||||
keysEndpoint,
|
||||
headerName,
|
||||
audience,
|
||||
options,
|
||||
)
|
||||
if err != nil || len(changes) == 0 {
|
||||
|
||||
@@ -911,6 +911,7 @@ func (c *Commands) prepareAddOrgJWTProvider(a *org.Aggregate, writeModel *OrgJWT
|
||||
provider.JWTEndpoint,
|
||||
provider.KeyEndpoint,
|
||||
provider.HeaderName,
|
||||
provider.Audience,
|
||||
provider.IDPOptions,
|
||||
),
|
||||
}, nil
|
||||
@@ -959,6 +960,7 @@ func (c *Commands) prepareUpdateOrgJWTProvider(a *org.Aggregate, writeModel *Org
|
||||
provider.JWTEndpoint,
|
||||
provider.KeyEndpoint,
|
||||
provider.HeaderName,
|
||||
provider.Audience,
|
||||
provider.IDPOptions,
|
||||
)
|
||||
if err != nil || event == nil {
|
||||
|
||||
@@ -276,7 +276,8 @@ func (wm *OrgJWTIDPWriteModel) NewChangedEvent(
|
||||
issuer,
|
||||
jwtEndpoint,
|
||||
keysEndpoint,
|
||||
headerName string,
|
||||
headerName,
|
||||
audience string,
|
||||
options idp.Options,
|
||||
) (*org.JWTIDPChangedEvent, error) {
|
||||
|
||||
@@ -286,6 +287,7 @@ func (wm *OrgJWTIDPWriteModel) NewChangedEvent(
|
||||
jwtEndpoint,
|
||||
keysEndpoint,
|
||||
headerName,
|
||||
audience,
|
||||
options,
|
||||
)
|
||||
if err != nil || len(changes) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user