mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:17: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:
@@ -15,110 +15,111 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
idpTemplateQuery = `SELECT projections.idp_templates3.id,` +
|
||||
` projections.idp_templates3.resource_owner,` +
|
||||
` projections.idp_templates3.creation_date,` +
|
||||
` projections.idp_templates3.change_date,` +
|
||||
` projections.idp_templates3.sequence,` +
|
||||
` projections.idp_templates3.state,` +
|
||||
` projections.idp_templates3.name,` +
|
||||
` projections.idp_templates3.type,` +
|
||||
` projections.idp_templates3.owner_type,` +
|
||||
` projections.idp_templates3.is_creation_allowed,` +
|
||||
` projections.idp_templates3.is_linking_allowed,` +
|
||||
` projections.idp_templates3.is_auto_creation,` +
|
||||
` projections.idp_templates3.is_auto_update,` +
|
||||
idpTemplateQuery = `SELECT projections.idp_templates4.id,` +
|
||||
` projections.idp_templates4.resource_owner,` +
|
||||
` projections.idp_templates4.creation_date,` +
|
||||
` projections.idp_templates4.change_date,` +
|
||||
` projections.idp_templates4.sequence,` +
|
||||
` projections.idp_templates4.state,` +
|
||||
` projections.idp_templates4.name,` +
|
||||
` projections.idp_templates4.type,` +
|
||||
` projections.idp_templates4.owner_type,` +
|
||||
` projections.idp_templates4.is_creation_allowed,` +
|
||||
` projections.idp_templates4.is_linking_allowed,` +
|
||||
` projections.idp_templates4.is_auto_creation,` +
|
||||
` projections.idp_templates4.is_auto_update,` +
|
||||
// oauth
|
||||
` projections.idp_templates3_oauth2.idp_id,` +
|
||||
` projections.idp_templates3_oauth2.client_id,` +
|
||||
` projections.idp_templates3_oauth2.client_secret,` +
|
||||
` projections.idp_templates3_oauth2.authorization_endpoint,` +
|
||||
` projections.idp_templates3_oauth2.token_endpoint,` +
|
||||
` projections.idp_templates3_oauth2.user_endpoint,` +
|
||||
` projections.idp_templates3_oauth2.scopes,` +
|
||||
` projections.idp_templates3_oauth2.id_attribute,` +
|
||||
` projections.idp_templates4_oauth2.idp_id,` +
|
||||
` projections.idp_templates4_oauth2.client_id,` +
|
||||
` projections.idp_templates4_oauth2.client_secret,` +
|
||||
` projections.idp_templates4_oauth2.authorization_endpoint,` +
|
||||
` projections.idp_templates4_oauth2.token_endpoint,` +
|
||||
` projections.idp_templates4_oauth2.user_endpoint,` +
|
||||
` projections.idp_templates4_oauth2.scopes,` +
|
||||
` projections.idp_templates4_oauth2.id_attribute,` +
|
||||
// oidc
|
||||
` projections.idp_templates3_oidc.idp_id,` +
|
||||
` projections.idp_templates3_oidc.issuer,` +
|
||||
` projections.idp_templates3_oidc.client_id,` +
|
||||
` projections.idp_templates3_oidc.client_secret,` +
|
||||
` projections.idp_templates3_oidc.scopes,` +
|
||||
` projections.idp_templates4_oidc.idp_id,` +
|
||||
` projections.idp_templates4_oidc.issuer,` +
|
||||
` projections.idp_templates4_oidc.client_id,` +
|
||||
` projections.idp_templates4_oidc.client_secret,` +
|
||||
` projections.idp_templates4_oidc.scopes,` +
|
||||
` projections.idp_templates4_oidc.id_token_mapping,` +
|
||||
// jwt
|
||||
` projections.idp_templates3_jwt.idp_id,` +
|
||||
` projections.idp_templates3_jwt.issuer,` +
|
||||
` projections.idp_templates3_jwt.jwt_endpoint,` +
|
||||
` projections.idp_templates3_jwt.keys_endpoint,` +
|
||||
` projections.idp_templates3_jwt.header_name,` +
|
||||
` projections.idp_templates4_jwt.idp_id,` +
|
||||
` projections.idp_templates4_jwt.issuer,` +
|
||||
` projections.idp_templates4_jwt.jwt_endpoint,` +
|
||||
` projections.idp_templates4_jwt.keys_endpoint,` +
|
||||
` projections.idp_templates4_jwt.header_name,` +
|
||||
// azure
|
||||
` projections.idp_templates3_azure.idp_id,` +
|
||||
` projections.idp_templates3_azure.client_id,` +
|
||||
` projections.idp_templates3_azure.client_secret,` +
|
||||
` projections.idp_templates3_azure.scopes,` +
|
||||
` projections.idp_templates3_azure.tenant,` +
|
||||
` projections.idp_templates3_azure.is_email_verified,` +
|
||||
` projections.idp_templates4_azure.idp_id,` +
|
||||
` projections.idp_templates4_azure.client_id,` +
|
||||
` projections.idp_templates4_azure.client_secret,` +
|
||||
` projections.idp_templates4_azure.scopes,` +
|
||||
` projections.idp_templates4_azure.tenant,` +
|
||||
` projections.idp_templates4_azure.is_email_verified,` +
|
||||
// github
|
||||
` projections.idp_templates3_github.idp_id,` +
|
||||
` projections.idp_templates3_github.client_id,` +
|
||||
` projections.idp_templates3_github.client_secret,` +
|
||||
` projections.idp_templates3_github.scopes,` +
|
||||
` projections.idp_templates4_github.idp_id,` +
|
||||
` projections.idp_templates4_github.client_id,` +
|
||||
` projections.idp_templates4_github.client_secret,` +
|
||||
` projections.idp_templates4_github.scopes,` +
|
||||
// github enterprise
|
||||
` projections.idp_templates3_github_enterprise.idp_id,` +
|
||||
` projections.idp_templates3_github_enterprise.client_id,` +
|
||||
` projections.idp_templates3_github_enterprise.client_secret,` +
|
||||
` projections.idp_templates3_github_enterprise.authorization_endpoint,` +
|
||||
` projections.idp_templates3_github_enterprise.token_endpoint,` +
|
||||
` projections.idp_templates3_github_enterprise.user_endpoint,` +
|
||||
` projections.idp_templates3_github_enterprise.scopes,` +
|
||||
` projections.idp_templates4_github_enterprise.idp_id,` +
|
||||
` projections.idp_templates4_github_enterprise.client_id,` +
|
||||
` projections.idp_templates4_github_enterprise.client_secret,` +
|
||||
` projections.idp_templates4_github_enterprise.authorization_endpoint,` +
|
||||
` projections.idp_templates4_github_enterprise.token_endpoint,` +
|
||||
` projections.idp_templates4_github_enterprise.user_endpoint,` +
|
||||
` projections.idp_templates4_github_enterprise.scopes,` +
|
||||
// gitlab
|
||||
` projections.idp_templates3_gitlab.idp_id,` +
|
||||
` projections.idp_templates3_gitlab.client_id,` +
|
||||
` projections.idp_templates3_gitlab.client_secret,` +
|
||||
` projections.idp_templates3_gitlab.scopes,` +
|
||||
` projections.idp_templates4_gitlab.idp_id,` +
|
||||
` projections.idp_templates4_gitlab.client_id,` +
|
||||
` projections.idp_templates4_gitlab.client_secret,` +
|
||||
` projections.idp_templates4_gitlab.scopes,` +
|
||||
// gitlab self hosted
|
||||
` projections.idp_templates3_gitlab_self_hosted.idp_id,` +
|
||||
` projections.idp_templates3_gitlab_self_hosted.issuer,` +
|
||||
` projections.idp_templates3_gitlab_self_hosted.client_id,` +
|
||||
` projections.idp_templates3_gitlab_self_hosted.client_secret,` +
|
||||
` projections.idp_templates3_gitlab_self_hosted.scopes,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.idp_id,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.issuer,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.client_id,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.client_secret,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.scopes,` +
|
||||
// google
|
||||
` projections.idp_templates3_google.idp_id,` +
|
||||
` projections.idp_templates3_google.client_id,` +
|
||||
` projections.idp_templates3_google.client_secret,` +
|
||||
` projections.idp_templates3_google.scopes,` +
|
||||
` projections.idp_templates4_google.idp_id,` +
|
||||
` projections.idp_templates4_google.client_id,` +
|
||||
` projections.idp_templates4_google.client_secret,` +
|
||||
` projections.idp_templates4_google.scopes,` +
|
||||
// ldap
|
||||
` projections.idp_templates3_ldap.idp_id,` +
|
||||
` projections.idp_templates3_ldap.host,` +
|
||||
` projections.idp_templates3_ldap.port,` +
|
||||
` projections.idp_templates3_ldap.tls,` +
|
||||
` projections.idp_templates3_ldap.base_dn,` +
|
||||
` projections.idp_templates3_ldap.user_object_class,` +
|
||||
` projections.idp_templates3_ldap.user_unique_attribute,` +
|
||||
` projections.idp_templates3_ldap.admin,` +
|
||||
` projections.idp_templates3_ldap.password,` +
|
||||
` projections.idp_templates3_ldap.id_attribute,` +
|
||||
` projections.idp_templates3_ldap.first_name_attribute,` +
|
||||
` projections.idp_templates3_ldap.last_name_attribute,` +
|
||||
` projections.idp_templates3_ldap.display_name_attribute,` +
|
||||
` projections.idp_templates3_ldap.nick_name_attribute,` +
|
||||
` projections.idp_templates3_ldap.preferred_username_attribute,` +
|
||||
` projections.idp_templates3_ldap.email_attribute,` +
|
||||
` projections.idp_templates3_ldap.email_verified,` +
|
||||
` projections.idp_templates3_ldap.phone_attribute,` +
|
||||
` projections.idp_templates3_ldap.phone_verified_attribute,` +
|
||||
` projections.idp_templates3_ldap.preferred_language_attribute,` +
|
||||
` projections.idp_templates3_ldap.avatar_url_attribute,` +
|
||||
` projections.idp_templates3_ldap.profile_attribute` +
|
||||
` FROM projections.idp_templates3` +
|
||||
` LEFT JOIN projections.idp_templates3_oauth2 ON projections.idp_templates3.id = projections.idp_templates3_oauth2.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_oauth2.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_oidc ON projections.idp_templates3.id = projections.idp_templates3_oidc.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_oidc.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_jwt ON projections.idp_templates3.id = projections.idp_templates3_jwt.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_jwt.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_azure ON projections.idp_templates3.id = projections.idp_templates3_azure.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_azure.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_github ON projections.idp_templates3.id = projections.idp_templates3_github.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_github.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_github_enterprise ON projections.idp_templates3.id = projections.idp_templates3_github_enterprise.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_github_enterprise.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_gitlab ON projections.idp_templates3.id = projections.idp_templates3_gitlab.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_gitlab.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_gitlab_self_hosted ON projections.idp_templates3.id = projections.idp_templates3_gitlab_self_hosted.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_gitlab_self_hosted.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_google ON projections.idp_templates3.id = projections.idp_templates3_google.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_google.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_ldap ON projections.idp_templates3.id = projections.idp_templates3_ldap.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_ldap.instance_id` +
|
||||
` projections.idp_templates4_ldap.idp_id,` +
|
||||
` projections.idp_templates4_ldap.host,` +
|
||||
` projections.idp_templates4_ldap.port,` +
|
||||
` projections.idp_templates4_ldap.tls,` +
|
||||
` projections.idp_templates4_ldap.base_dn,` +
|
||||
` projections.idp_templates4_ldap.user_object_class,` +
|
||||
` projections.idp_templates4_ldap.user_unique_attribute,` +
|
||||
` projections.idp_templates4_ldap.admin,` +
|
||||
` projections.idp_templates4_ldap.password,` +
|
||||
` projections.idp_templates4_ldap.id_attribute,` +
|
||||
` projections.idp_templates4_ldap.first_name_attribute,` +
|
||||
` projections.idp_templates4_ldap.last_name_attribute,` +
|
||||
` projections.idp_templates4_ldap.display_name_attribute,` +
|
||||
` projections.idp_templates4_ldap.nick_name_attribute,` +
|
||||
` projections.idp_templates4_ldap.preferred_username_attribute,` +
|
||||
` projections.idp_templates4_ldap.email_attribute,` +
|
||||
` projections.idp_templates4_ldap.email_verified,` +
|
||||
` projections.idp_templates4_ldap.phone_attribute,` +
|
||||
` projections.idp_templates4_ldap.phone_verified_attribute,` +
|
||||
` projections.idp_templates4_ldap.preferred_language_attribute,` +
|
||||
` projections.idp_templates4_ldap.avatar_url_attribute,` +
|
||||
` projections.idp_templates4_ldap.profile_attribute` +
|
||||
` FROM projections.idp_templates4` +
|
||||
` LEFT JOIN projections.idp_templates4_oauth2 ON projections.idp_templates4.id = projections.idp_templates4_oauth2.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_oauth2.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_oidc ON projections.idp_templates4.id = projections.idp_templates4_oidc.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_oidc.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_jwt ON projections.idp_templates4.id = projections.idp_templates4_jwt.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_jwt.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_azure ON projections.idp_templates4.id = projections.idp_templates4_azure.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_azure.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_github ON projections.idp_templates4.id = projections.idp_templates4_github.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_github.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_github_enterprise ON projections.idp_templates4.id = projections.idp_templates4_github_enterprise.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_github_enterprise.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_gitlab ON projections.idp_templates4.id = projections.idp_templates4_gitlab.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_gitlab.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_gitlab_self_hosted ON projections.idp_templates4.id = projections.idp_templates4_gitlab_self_hosted.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_gitlab_self_hosted.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_google ON projections.idp_templates4.id = projections.idp_templates4_google.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_google.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_ldap ON projections.idp_templates4.id = projections.idp_templates4_ldap.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_ldap.instance_id` +
|
||||
` AS OF SYSTEM TIME '-1 ms'`
|
||||
idpTemplateCols = []string{
|
||||
"id",
|
||||
@@ -149,6 +150,7 @@ var (
|
||||
"client_id",
|
||||
"client_secret",
|
||||
"scopes",
|
||||
"id_token_mapping",
|
||||
// jwt
|
||||
"idp_id",
|
||||
"issuer",
|
||||
@@ -215,111 +217,112 @@ var (
|
||||
"avatar_url_attribute",
|
||||
"profile_attribute",
|
||||
}
|
||||
idpTemplatesQuery = `SELECT projections.idp_templates3.id,` +
|
||||
` projections.idp_templates3.resource_owner,` +
|
||||
` projections.idp_templates3.creation_date,` +
|
||||
` projections.idp_templates3.change_date,` +
|
||||
` projections.idp_templates3.sequence,` +
|
||||
` projections.idp_templates3.state,` +
|
||||
` projections.idp_templates3.name,` +
|
||||
` projections.idp_templates3.type,` +
|
||||
` projections.idp_templates3.owner_type,` +
|
||||
` projections.idp_templates3.is_creation_allowed,` +
|
||||
` projections.idp_templates3.is_linking_allowed,` +
|
||||
` projections.idp_templates3.is_auto_creation,` +
|
||||
` projections.idp_templates3.is_auto_update,` +
|
||||
idpTemplatesQuery = `SELECT projections.idp_templates4.id,` +
|
||||
` projections.idp_templates4.resource_owner,` +
|
||||
` projections.idp_templates4.creation_date,` +
|
||||
` projections.idp_templates4.change_date,` +
|
||||
` projections.idp_templates4.sequence,` +
|
||||
` projections.idp_templates4.state,` +
|
||||
` projections.idp_templates4.name,` +
|
||||
` projections.idp_templates4.type,` +
|
||||
` projections.idp_templates4.owner_type,` +
|
||||
` projections.idp_templates4.is_creation_allowed,` +
|
||||
` projections.idp_templates4.is_linking_allowed,` +
|
||||
` projections.idp_templates4.is_auto_creation,` +
|
||||
` projections.idp_templates4.is_auto_update,` +
|
||||
// oauth
|
||||
` projections.idp_templates3_oauth2.idp_id,` +
|
||||
` projections.idp_templates3_oauth2.client_id,` +
|
||||
` projections.idp_templates3_oauth2.client_secret,` +
|
||||
` projections.idp_templates3_oauth2.authorization_endpoint,` +
|
||||
` projections.idp_templates3_oauth2.token_endpoint,` +
|
||||
` projections.idp_templates3_oauth2.user_endpoint,` +
|
||||
` projections.idp_templates3_oauth2.scopes,` +
|
||||
` projections.idp_templates3_oauth2.id_attribute,` +
|
||||
` projections.idp_templates4_oauth2.idp_id,` +
|
||||
` projections.idp_templates4_oauth2.client_id,` +
|
||||
` projections.idp_templates4_oauth2.client_secret,` +
|
||||
` projections.idp_templates4_oauth2.authorization_endpoint,` +
|
||||
` projections.idp_templates4_oauth2.token_endpoint,` +
|
||||
` projections.idp_templates4_oauth2.user_endpoint,` +
|
||||
` projections.idp_templates4_oauth2.scopes,` +
|
||||
` projections.idp_templates4_oauth2.id_attribute,` +
|
||||
// oidc
|
||||
` projections.idp_templates3_oidc.idp_id,` +
|
||||
` projections.idp_templates3_oidc.issuer,` +
|
||||
` projections.idp_templates3_oidc.client_id,` +
|
||||
` projections.idp_templates3_oidc.client_secret,` +
|
||||
` projections.idp_templates3_oidc.scopes,` +
|
||||
` projections.idp_templates4_oidc.idp_id,` +
|
||||
` projections.idp_templates4_oidc.issuer,` +
|
||||
` projections.idp_templates4_oidc.client_id,` +
|
||||
` projections.idp_templates4_oidc.client_secret,` +
|
||||
` projections.idp_templates4_oidc.scopes,` +
|
||||
` projections.idp_templates4_oidc.id_token_mapping,` +
|
||||
// jwt
|
||||
` projections.idp_templates3_jwt.idp_id,` +
|
||||
` projections.idp_templates3_jwt.issuer,` +
|
||||
` projections.idp_templates3_jwt.jwt_endpoint,` +
|
||||
` projections.idp_templates3_jwt.keys_endpoint,` +
|
||||
` projections.idp_templates3_jwt.header_name,` +
|
||||
` projections.idp_templates4_jwt.idp_id,` +
|
||||
` projections.idp_templates4_jwt.issuer,` +
|
||||
` projections.idp_templates4_jwt.jwt_endpoint,` +
|
||||
` projections.idp_templates4_jwt.keys_endpoint,` +
|
||||
` projections.idp_templates4_jwt.header_name,` +
|
||||
// azure
|
||||
` projections.idp_templates3_azure.idp_id,` +
|
||||
` projections.idp_templates3_azure.client_id,` +
|
||||
` projections.idp_templates3_azure.client_secret,` +
|
||||
` projections.idp_templates3_azure.scopes,` +
|
||||
` projections.idp_templates3_azure.tenant,` +
|
||||
` projections.idp_templates3_azure.is_email_verified,` +
|
||||
` projections.idp_templates4_azure.idp_id,` +
|
||||
` projections.idp_templates4_azure.client_id,` +
|
||||
` projections.idp_templates4_azure.client_secret,` +
|
||||
` projections.idp_templates4_azure.scopes,` +
|
||||
` projections.idp_templates4_azure.tenant,` +
|
||||
` projections.idp_templates4_azure.is_email_verified,` +
|
||||
// github
|
||||
` projections.idp_templates3_github.idp_id,` +
|
||||
` projections.idp_templates3_github.client_id,` +
|
||||
` projections.idp_templates3_github.client_secret,` +
|
||||
` projections.idp_templates3_github.scopes,` +
|
||||
` projections.idp_templates4_github.idp_id,` +
|
||||
` projections.idp_templates4_github.client_id,` +
|
||||
` projections.idp_templates4_github.client_secret,` +
|
||||
` projections.idp_templates4_github.scopes,` +
|
||||
// github enterprise
|
||||
` projections.idp_templates3_github_enterprise.idp_id,` +
|
||||
` projections.idp_templates3_github_enterprise.client_id,` +
|
||||
` projections.idp_templates3_github_enterprise.client_secret,` +
|
||||
` projections.idp_templates3_github_enterprise.authorization_endpoint,` +
|
||||
` projections.idp_templates3_github_enterprise.token_endpoint,` +
|
||||
` projections.idp_templates3_github_enterprise.user_endpoint,` +
|
||||
` projections.idp_templates3_github_enterprise.scopes,` +
|
||||
` projections.idp_templates4_github_enterprise.idp_id,` +
|
||||
` projections.idp_templates4_github_enterprise.client_id,` +
|
||||
` projections.idp_templates4_github_enterprise.client_secret,` +
|
||||
` projections.idp_templates4_github_enterprise.authorization_endpoint,` +
|
||||
` projections.idp_templates4_github_enterprise.token_endpoint,` +
|
||||
` projections.idp_templates4_github_enterprise.user_endpoint,` +
|
||||
` projections.idp_templates4_github_enterprise.scopes,` +
|
||||
// gitlab
|
||||
` projections.idp_templates3_gitlab.idp_id,` +
|
||||
` projections.idp_templates3_gitlab.client_id,` +
|
||||
` projections.idp_templates3_gitlab.client_secret,` +
|
||||
` projections.idp_templates3_gitlab.scopes,` +
|
||||
` projections.idp_templates4_gitlab.idp_id,` +
|
||||
` projections.idp_templates4_gitlab.client_id,` +
|
||||
` projections.idp_templates4_gitlab.client_secret,` +
|
||||
` projections.idp_templates4_gitlab.scopes,` +
|
||||
// gitlab self hosted
|
||||
` projections.idp_templates3_gitlab_self_hosted.idp_id,` +
|
||||
` projections.idp_templates3_gitlab_self_hosted.issuer,` +
|
||||
` projections.idp_templates3_gitlab_self_hosted.client_id,` +
|
||||
` projections.idp_templates3_gitlab_self_hosted.client_secret,` +
|
||||
` projections.idp_templates3_gitlab_self_hosted.scopes,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.idp_id,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.issuer,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.client_id,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.client_secret,` +
|
||||
` projections.idp_templates4_gitlab_self_hosted.scopes,` +
|
||||
// google
|
||||
` projections.idp_templates3_google.idp_id,` +
|
||||
` projections.idp_templates3_google.client_id,` +
|
||||
` projections.idp_templates3_google.client_secret,` +
|
||||
` projections.idp_templates3_google.scopes,` +
|
||||
` projections.idp_templates4_google.idp_id,` +
|
||||
` projections.idp_templates4_google.client_id,` +
|
||||
` projections.idp_templates4_google.client_secret,` +
|
||||
` projections.idp_templates4_google.scopes,` +
|
||||
// ldap
|
||||
` projections.idp_templates3_ldap.idp_id,` +
|
||||
` projections.idp_templates3_ldap.host,` +
|
||||
` projections.idp_templates3_ldap.port,` +
|
||||
` projections.idp_templates3_ldap.tls,` +
|
||||
` projections.idp_templates3_ldap.base_dn,` +
|
||||
` projections.idp_templates3_ldap.user_object_class,` +
|
||||
` projections.idp_templates3_ldap.user_unique_attribute,` +
|
||||
` projections.idp_templates3_ldap.admin,` +
|
||||
` projections.idp_templates3_ldap.password,` +
|
||||
` projections.idp_templates3_ldap.id_attribute,` +
|
||||
` projections.idp_templates3_ldap.first_name_attribute,` +
|
||||
` projections.idp_templates3_ldap.last_name_attribute,` +
|
||||
` projections.idp_templates3_ldap.display_name_attribute,` +
|
||||
` projections.idp_templates3_ldap.nick_name_attribute,` +
|
||||
` projections.idp_templates3_ldap.preferred_username_attribute,` +
|
||||
` projections.idp_templates3_ldap.email_attribute,` +
|
||||
` projections.idp_templates3_ldap.email_verified,` +
|
||||
` projections.idp_templates3_ldap.phone_attribute,` +
|
||||
` projections.idp_templates3_ldap.phone_verified_attribute,` +
|
||||
` projections.idp_templates3_ldap.preferred_language_attribute,` +
|
||||
` projections.idp_templates3_ldap.avatar_url_attribute,` +
|
||||
` projections.idp_templates3_ldap.profile_attribute,` +
|
||||
` projections.idp_templates4_ldap.idp_id,` +
|
||||
` projections.idp_templates4_ldap.host,` +
|
||||
` projections.idp_templates4_ldap.port,` +
|
||||
` projections.idp_templates4_ldap.tls,` +
|
||||
` projections.idp_templates4_ldap.base_dn,` +
|
||||
` projections.idp_templates4_ldap.user_object_class,` +
|
||||
` projections.idp_templates4_ldap.user_unique_attribute,` +
|
||||
` projections.idp_templates4_ldap.admin,` +
|
||||
` projections.idp_templates4_ldap.password,` +
|
||||
` projections.idp_templates4_ldap.id_attribute,` +
|
||||
` projections.idp_templates4_ldap.first_name_attribute,` +
|
||||
` projections.idp_templates4_ldap.last_name_attribute,` +
|
||||
` projections.idp_templates4_ldap.display_name_attribute,` +
|
||||
` projections.idp_templates4_ldap.nick_name_attribute,` +
|
||||
` projections.idp_templates4_ldap.preferred_username_attribute,` +
|
||||
` projections.idp_templates4_ldap.email_attribute,` +
|
||||
` projections.idp_templates4_ldap.email_verified,` +
|
||||
` projections.idp_templates4_ldap.phone_attribute,` +
|
||||
` projections.idp_templates4_ldap.phone_verified_attribute,` +
|
||||
` projections.idp_templates4_ldap.preferred_language_attribute,` +
|
||||
` projections.idp_templates4_ldap.avatar_url_attribute,` +
|
||||
` projections.idp_templates4_ldap.profile_attribute,` +
|
||||
` COUNT(*) OVER ()` +
|
||||
` FROM projections.idp_templates3` +
|
||||
` LEFT JOIN projections.idp_templates3_oauth2 ON projections.idp_templates3.id = projections.idp_templates3_oauth2.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_oauth2.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_oidc ON projections.idp_templates3.id = projections.idp_templates3_oidc.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_oidc.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_jwt ON projections.idp_templates3.id = projections.idp_templates3_jwt.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_jwt.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_azure ON projections.idp_templates3.id = projections.idp_templates3_azure.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_azure.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_github ON projections.idp_templates3.id = projections.idp_templates3_github.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_github.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_github_enterprise ON projections.idp_templates3.id = projections.idp_templates3_github_enterprise.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_github_enterprise.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_gitlab ON projections.idp_templates3.id = projections.idp_templates3_gitlab.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_gitlab.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_gitlab_self_hosted ON projections.idp_templates3.id = projections.idp_templates3_gitlab_self_hosted.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_gitlab_self_hosted.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_google ON projections.idp_templates3.id = projections.idp_templates3_google.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_google.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates3_ldap ON projections.idp_templates3.id = projections.idp_templates3_ldap.idp_id AND projections.idp_templates3.instance_id = projections.idp_templates3_ldap.instance_id` +
|
||||
` FROM projections.idp_templates4` +
|
||||
` LEFT JOIN projections.idp_templates4_oauth2 ON projections.idp_templates4.id = projections.idp_templates4_oauth2.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_oauth2.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_oidc ON projections.idp_templates4.id = projections.idp_templates4_oidc.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_oidc.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_jwt ON projections.idp_templates4.id = projections.idp_templates4_jwt.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_jwt.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_azure ON projections.idp_templates4.id = projections.idp_templates4_azure.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_azure.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_github ON projections.idp_templates4.id = projections.idp_templates4_github.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_github.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_github_enterprise ON projections.idp_templates4.id = projections.idp_templates4_github_enterprise.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_github_enterprise.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_gitlab ON projections.idp_templates4.id = projections.idp_templates4_gitlab.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_gitlab.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_gitlab_self_hosted ON projections.idp_templates4.id = projections.idp_templates4_gitlab_self_hosted.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_gitlab_self_hosted.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_google ON projections.idp_templates4.id = projections.idp_templates4_google.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_google.instance_id` +
|
||||
` LEFT JOIN projections.idp_templates4_ldap ON projections.idp_templates4.id = projections.idp_templates4_ldap.idp_id AND projections.idp_templates4.instance_id = projections.idp_templates4_ldap.instance_id` +
|
||||
` AS OF SYSTEM TIME '-1 ms'`
|
||||
idpTemplatesCols = []string{
|
||||
"id",
|
||||
@@ -350,6 +353,7 @@ var (
|
||||
"client_id",
|
||||
"client_secret",
|
||||
"scopes",
|
||||
"id_token_mapping",
|
||||
// jwt
|
||||
"idp_id",
|
||||
"issuer",
|
||||
@@ -484,6 +488,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -614,6 +619,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
"client_id",
|
||||
nil,
|
||||
database.StringArray{"profile"},
|
||||
true,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -697,11 +703,12 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
IsAutoCreation: true,
|
||||
IsAutoUpdate: true,
|
||||
OIDCIDPTemplate: &OIDCIDPTemplate{
|
||||
IDPID: "idp-id",
|
||||
Issuer: "issuer",
|
||||
ClientID: "client_id",
|
||||
ClientSecret: nil,
|
||||
Scopes: []string{"profile"},
|
||||
IDPID: "idp-id",
|
||||
Issuer: "issuer",
|
||||
ClientID: "client_id",
|
||||
ClientSecret: nil,
|
||||
Scopes: []string{"profile"},
|
||||
IsIDTokenMapping: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -741,6 +748,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
"idp-id",
|
||||
"issuer",
|
||||
@@ -868,6 +876,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -994,6 +1003,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -1120,6 +1130,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -1247,6 +1258,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -1373,6 +1385,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -1518,6 +1531,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -1674,6 +1688,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -1828,6 +1843,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -1957,6 +1973,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -2052,6 +2069,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -2147,6 +2165,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -2242,6 +2261,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
"client_id",
|
||||
nil,
|
||||
database.StringArray{"profile"},
|
||||
true,
|
||||
// jwt
|
||||
nil,
|
||||
nil,
|
||||
@@ -2337,6 +2357,7 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
// jwt
|
||||
"idp-id-jwt",
|
||||
"issuer",
|
||||
@@ -2513,11 +2534,12 @@ func Test_IDPTemplateTemplatesPrepares(t *testing.T) {
|
||||
IsAutoCreation: true,
|
||||
IsAutoUpdate: true,
|
||||
OIDCIDPTemplate: &OIDCIDPTemplate{
|
||||
IDPID: "idp-id-oidc",
|
||||
Issuer: "issuer",
|
||||
ClientID: "client_id",
|
||||
ClientSecret: nil,
|
||||
Scopes: []string{"profile"},
|
||||
IDPID: "idp-id-oidc",
|
||||
Issuer: "issuer",
|
||||
ClientID: "client_id",
|
||||
ClientSecret: nil,
|
||||
Scopes: []string{"profile"},
|
||||
IsIDTokenMapping: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user