mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 14:37:34 +00:00
feat: add PKCE option to generic OAuth2 / OIDC identity providers (#9373)
# Which Problems Are Solved Some OAuth2 and OIDC providers require the use of PKCE for all their clients. While ZITADEL already recommended the same for its clients, it did not yet support the option on the IdP configuration. # How the Problems Are Solved - A new boolean `use_pkce` is added to the add/update generic OAuth/OIDC endpoints. - A new checkbox is added to the generic OAuth and OIDC provider templates. - The `rp.WithPKCE` option is added to the provider if the use of PKCE has been set. - The `rp.WithCodeChallenge` and `rp.WithCodeVerifier` options are added to the OIDC/Auth BeginAuth and CodeExchange function. - Store verifier or any other persistent argument in the intent or auth request. - Create corresponding session object before creating the intent, to be able to store the information. - (refactored session structs to use a constructor for unified creation and better overview of actual usage) Here's a screenshot showing the URI including the PKCE params:  # Additional Changes None. # Additional Context - Closes #6449 - This PR replaces the existing PR (#8228) of @doncicuto. The base he did was cherry picked. Thank you very much for that! --------- Co-authored-by: Miguel Cabrerizo <doncicuto@gmail.com> Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
@@ -6124,6 +6124,8 @@ message AddGenericOAuthProviderRequest {
|
||||
}
|
||||
];
|
||||
zitadel.idp.v1.Options provider_options = 9;
|
||||
// Enable the use of Proof Key for Code Exchange (PKCE) for the OAuth2 flow.
|
||||
bool use_pkce = 10;
|
||||
}
|
||||
|
||||
message AddGenericOAuthProviderResponse {
|
||||
@@ -6191,6 +6193,8 @@ message UpdateGenericOAuthProviderRequest {
|
||||
}
|
||||
];
|
||||
zitadel.idp.v1.Options provider_options = 10;
|
||||
// Enable the use of Proof Key for Code Exchange (PKCE) for the OAuth2 flow.
|
||||
bool use_pkce = 11;
|
||||
}
|
||||
|
||||
message UpdateGenericOAuthProviderResponse {
|
||||
@@ -6234,6 +6238,8 @@ message AddGenericOIDCProviderRequest {
|
||||
];
|
||||
zitadel.idp.v1.Options provider_options = 6;
|
||||
bool is_id_token_mapping = 7;
|
||||
// Enable the use of Proof Key for Code Exchange (PKCE) for the OIDC flow.
|
||||
bool use_pkce = 8;
|
||||
}
|
||||
|
||||
message AddGenericOIDCProviderResponse {
|
||||
@@ -6285,6 +6291,8 @@ message UpdateGenericOIDCProviderRequest {
|
||||
];
|
||||
zitadel.idp.v1.Options provider_options = 7;
|
||||
bool is_id_token_mapping = 8;
|
||||
// Enable the use of Proof Key for Code Exchange (PKCE) for the OIDC flow.
|
||||
bool use_pkce = 9;
|
||||
}
|
||||
|
||||
message UpdateGenericOIDCProviderResponse {
|
||||
|
@@ -338,6 +338,8 @@ message OAuthConfig {
|
||||
description: "defines how the attribute is called where ZITADEL can get the id of the user";
|
||||
}
|
||||
];
|
||||
// Defines if the Proof Key for Code Exchange (PKCE) is used for the authorization code flow.
|
||||
bool use_pkce = 7;
|
||||
}
|
||||
|
||||
message GenericOIDCConfig {
|
||||
@@ -365,6 +367,12 @@ message GenericOIDCConfig {
|
||||
description: "if true, provider information get mapped from the id token, not from the userinfo endpoint";
|
||||
}
|
||||
];
|
||||
// Defines if the Proof Key for Code Exchange (PKCE) is used for the authorization code flow.
|
||||
bool use_pkce = 5 [
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
example: "true";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message GitHubConfig {
|
||||
|
@@ -12545,6 +12545,8 @@ message AddGenericOAuthProviderRequest {
|
||||
}
|
||||
];
|
||||
zitadel.idp.v1.Options provider_options = 9;
|
||||
// Enable the use of Proof Key for Code Exchange (PKCE) for the OAuth2 flow.
|
||||
bool use_pkce = 10;
|
||||
}
|
||||
|
||||
message AddGenericOAuthProviderResponse {
|
||||
@@ -12612,6 +12614,8 @@ message UpdateGenericOAuthProviderRequest {
|
||||
}
|
||||
];
|
||||
zitadel.idp.v1.Options provider_options = 10;
|
||||
// Enable the use of Proof Key for Code Exchange (PKCE) for the OAuth2 flow.
|
||||
bool use_pkce = 11;
|
||||
}
|
||||
|
||||
message UpdateGenericOAuthProviderResponse {
|
||||
@@ -12655,6 +12659,8 @@ message AddGenericOIDCProviderRequest {
|
||||
];
|
||||
zitadel.idp.v1.Options provider_options = 6;
|
||||
bool is_id_token_mapping = 7;
|
||||
// Enable the use of Proof Key for Code Exchange (PKCE) for the OIDC flow.
|
||||
bool use_pkce = 8;
|
||||
}
|
||||
|
||||
message AddGenericOIDCProviderResponse {
|
||||
@@ -12706,6 +12712,8 @@ message UpdateGenericOIDCProviderRequest {
|
||||
];
|
||||
zitadel.idp.v1.Options provider_options = 7;
|
||||
bool is_id_token_mapping = 8;
|
||||
// Enable the use of Proof Key for Code Exchange (PKCE) for the OIDC flow.
|
||||
bool use_pkce = 9;
|
||||
}
|
||||
|
||||
message UpdateGenericOIDCProviderResponse {
|
||||
|
Reference in New Issue
Block a user