mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
fix: use idToken for mapping when using old configs (#5458)
* fix: use idToken for mapping when using old configs * fix events and add tests
This commit is contained in:
@@ -63,11 +63,12 @@ type OAuthIDPTemplate struct {
|
||||
}
|
||||
|
||||
type OIDCIDPTemplate struct {
|
||||
IDPID string
|
||||
ClientID string
|
||||
ClientSecret *crypto.CryptoValue
|
||||
Issuer string
|
||||
Scopes database.StringArray
|
||||
IDPID string
|
||||
ClientID string
|
||||
ClientSecret *crypto.CryptoValue
|
||||
Issuer string
|
||||
Scopes database.StringArray
|
||||
IsIDTokenMapping bool
|
||||
}
|
||||
|
||||
type JWTIDPTemplate struct {
|
||||
@@ -278,6 +279,10 @@ var (
|
||||
name: projection.OIDCScopesCol,
|
||||
table: oidcIdpTemplateTable,
|
||||
}
|
||||
OIDCIDTokenMappingCol = Column{
|
||||
name: projection.OIDCIDTokenMappingCol,
|
||||
table: oidcIdpTemplateTable,
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -722,6 +727,7 @@ func prepareIDPTemplateByIDQuery(ctx context.Context, db prepareDatabase) (sq.Se
|
||||
OIDCClientIDCol.identifier(),
|
||||
OIDCClientSecretCol.identifier(),
|
||||
OIDCScopesCol.identifier(),
|
||||
OIDCIDTokenMappingCol.identifier(),
|
||||
// jwt
|
||||
JWTIDCol.identifier(),
|
||||
JWTIssuerCol.identifier(),
|
||||
@@ -818,6 +824,7 @@ func prepareIDPTemplateByIDQuery(ctx context.Context, db prepareDatabase) (sq.Se
|
||||
oidcClientID := sql.NullString{}
|
||||
oidcClientSecret := new(crypto.CryptoValue)
|
||||
oidcScopes := database.StringArray{}
|
||||
oidcIDTokenMapping := sql.NullBool{}
|
||||
|
||||
jwtID := sql.NullString{}
|
||||
jwtIssuer := sql.NullString{}
|
||||
@@ -913,6 +920,7 @@ func prepareIDPTemplateByIDQuery(ctx context.Context, db prepareDatabase) (sq.Se
|
||||
&oidcClientID,
|
||||
&oidcClientSecret,
|
||||
&oidcScopes,
|
||||
&oidcIDTokenMapping,
|
||||
// jwt
|
||||
&jwtID,
|
||||
&jwtIssuer,
|
||||
@@ -1002,11 +1010,12 @@ func prepareIDPTemplateByIDQuery(ctx context.Context, db prepareDatabase) (sq.Se
|
||||
}
|
||||
if oidcID.Valid {
|
||||
idpTemplate.OIDCIDPTemplate = &OIDCIDPTemplate{
|
||||
IDPID: oidcID.String,
|
||||
ClientID: oidcClientID.String,
|
||||
ClientSecret: oidcClientSecret,
|
||||
Issuer: oidcIssuer.String,
|
||||
Scopes: oidcScopes,
|
||||
IDPID: oidcID.String,
|
||||
ClientID: oidcClientID.String,
|
||||
ClientSecret: oidcClientSecret,
|
||||
Issuer: oidcIssuer.String,
|
||||
Scopes: oidcScopes,
|
||||
IsIDTokenMapping: oidcIDTokenMapping.Bool,
|
||||
}
|
||||
}
|
||||
if jwtID.Valid {
|
||||
@@ -1135,6 +1144,7 @@ func prepareIDPTemplatesQuery(ctx context.Context, db prepareDatabase) (sq.Selec
|
||||
OIDCClientIDCol.identifier(),
|
||||
OIDCClientSecretCol.identifier(),
|
||||
OIDCScopesCol.identifier(),
|
||||
OIDCIDTokenMappingCol.identifier(),
|
||||
// jwt
|
||||
JWTIDCol.identifier(),
|
||||
JWTIssuerCol.identifier(),
|
||||
@@ -1235,6 +1245,7 @@ func prepareIDPTemplatesQuery(ctx context.Context, db prepareDatabase) (sq.Selec
|
||||
oidcClientID := sql.NullString{}
|
||||
oidcClientSecret := new(crypto.CryptoValue)
|
||||
oidcScopes := database.StringArray{}
|
||||
oidcIDTokenMapping := sql.NullBool{}
|
||||
|
||||
jwtID := sql.NullString{}
|
||||
jwtIssuer := sql.NullString{}
|
||||
@@ -1330,6 +1341,7 @@ func prepareIDPTemplatesQuery(ctx context.Context, db prepareDatabase) (sq.Selec
|
||||
&oidcClientID,
|
||||
&oidcClientSecret,
|
||||
&oidcScopes,
|
||||
&oidcIDTokenMapping,
|
||||
// jwt
|
||||
&jwtID,
|
||||
&jwtIssuer,
|
||||
@@ -1418,11 +1430,12 @@ func prepareIDPTemplatesQuery(ctx context.Context, db prepareDatabase) (sq.Selec
|
||||
}
|
||||
if oidcID.Valid {
|
||||
idpTemplate.OIDCIDPTemplate = &OIDCIDPTemplate{
|
||||
IDPID: oidcID.String,
|
||||
ClientID: oidcClientID.String,
|
||||
ClientSecret: oidcClientSecret,
|
||||
Issuer: oidcIssuer.String,
|
||||
Scopes: oidcScopes,
|
||||
IDPID: oidcID.String,
|
||||
ClientID: oidcClientID.String,
|
||||
ClientSecret: oidcClientSecret,
|
||||
Issuer: oidcIssuer.String,
|
||||
Scopes: oidcScopes,
|
||||
IsIDTokenMapping: oidcIDTokenMapping.Bool,
|
||||
}
|
||||
}
|
||||
if jwtID.Valid {
|
||||
|
Reference in New Issue
Block a user