Skip to content

Commit 6c56d9e

Browse files
committed
major refactor
1 parent 406ddb7 commit 6c56d9e

17 files changed

+811
-958
lines changed

docs/en/operations/external-authenticators/jwt.md

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,8 @@ Only one of `static_jwks` or `static_jwks_file` keys must be present in one veri
9494
<!- ... -->
9595
<jwt_validators>
9696
<basic_auth_server>
97-
<uri>http://localhost:8000/.well-known/jwks.json</uri>
98-
<connection_timeout_ms>1000</connection_timeout_ms>
99-
<receive_timeout_ms>1000</receive_timeout_ms>
100-
<send_timeout_ms>1000</send_timeout_ms>
101-
<max_tries>3</max_tries>
102-
<retry_initial_backoff_ms>50</retry_initial_backoff_ms>
103-
<retry_max_backoff_ms>1000</retry_max_backoff_ms>
104-
<refresh_ms>300000</refresh_ms>
97+
<jwks_uri>http://localhost:8000/.well-known/jwks.json</jwks_uri>
98+
<jwks_refresh_timeout>300000</jwks_refresh_timeout>
10599
</basic_auth_server>
106100
</jwt_validators>
107101
</clickhouse>
@@ -110,38 +104,7 @@ Only one of `static_jwks` or `static_jwks_file` keys must be present in one veri
110104
#### Parameters:
111105

112106
- `uri` - JWKS endpoint. Mandatory.
113-
- `refresh_ms` - Period for resend request for refreshing JWKS. Optional, default: 300000.
114-
115-
Timeouts in milliseconds on the socket used for communicating with the server (optional):
116-
- `connection_timeout_ms` - Default: 1000.
117-
- `receive_timeout_ms` - Default: 1000.
118-
- `send_timeout_ms` - Default: 1000.
119-
120-
Retry parameters (optional):
121-
- `max_tries` - The maximum number of attempts to make an authentication request. Default: 3.
122-
- `retry_initial_backoff_ms` - The backoff initial interval on retry. Default: 50.
123-
- `retry_max_backoff_ms` - The maximum backoff interval. Default: 1000.
124-
125-
### Verifying access tokens {$verifying-access-tokens}
126-
127-
Access tokens that are not JWT (and thus no data can be extracted from the token directly) need to be resolved by external providers.
128-
129-
**Example**
130-
```xml
131-
<clickhouse>
132-
<!- ... -->
133-
<access_token_processors>
134-
<my_access_token_processor>
135-
<provider>google</provider>
136-
</my_access_token_processor>
137-
</access_token_processors>
138-
</clickhouse>
139-
```
140-
141-
#### Parameters:
142-
143-
- `provider` - name of provider that will be used for token processing. Mandatory parameter. Possible options: `google`.
144-
107+
- `jwks_refresh_timeout` - Period for resend request for refreshing JWKS. Optional, default: 300000.
145108

146109
### Enabling JWT authentication in `users.xml` {#enabling-jwt-auth-in-users-xml}
147110

docs/en/operations/external-authenticators/tokens.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ To define an access token processor, add `token_processors` section to `config.x
2424
<azuure>
2525
<provider>azure</provider>
2626
<username_claim>claim_name</username_claim>
27-
<client_id>CLIENT_ID</client_id>
28-
<tenant_id>TENANT_ID</tenant_id>
2927
</azuure>
3028
</token_processors>
3129
</clickhouse>
@@ -39,10 +37,7 @@ Different providers have different sets of parameters.
3937

4038
- `provider` -- name of identity provider. Mandatory, case-insensitive. Supported options: "Google", "Azure", "OpenID".
4139
- `username_claim` -- name of claim (field) that will be treated as ClickHouse user name. Optional, default: "sub".
42-
- `cache_lifetime` -- maximum lifetime of cached token (in seconds). Optional, default: 3600.
43-
- `email_filter` -- Regex for validation of user emails. Optional parameter, only for Google IdP.
44-
- `client_id` -- Azure AD (Entra ID) client ID. Optional parameter, used only for Azure IdP.
45-
- `tenant_id` -- Azure AD (Entra ID) tenant ID. Optional parameter, used only for Azure IdP.
40+
- `cache_lifetime` -- maximum lifetime of cached token (in seconds). Optional, default: 3600.
4641
- `groups_claim` -- Name of claim (field) that contains list of groups user belongs to. This claim will be looked up in the token itself (in case token is a valid JWT, e.g. in Keycloak) or in response from `/userinfo`. Optional parameter.
4742
- `configuration_endpoint` -- URI of `.well-known/openid-configuration`. Optional parameter, useful only for OIDC-compliant providers (e.g. Keycloak).
4843
- `userinfo_endpoint` -- URI of userinfo endpoint. Optional parameter.

src/Access/AccessControl.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -728,11 +728,6 @@ bool AccessControl::isNoPasswordAllowed() const
728728
return allow_no_password;
729729
}
730730

731-
bool AccessControl::isJWTEnabled() const
732-
{
733-
return external_authenticators->isJWTAllowed();
734-
}
735-
736731
void AccessControl::setPlaintextPasswordAllowed(bool allow_plaintext_password_)
737732
{
738733
allow_plaintext_password = allow_plaintext_password_;

src/Access/AccessControl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ class AccessControl : public MultipleAccessStorage
157157
void setNoPasswordAllowed(bool allow_no_password_);
158158
bool isNoPasswordAllowed() const;
159159

160-
bool isJWTEnabled() const;
161-
162160
/// Allows users with plaintext password (by default it's allowed).
163161
void setPlaintextPasswordAllowed(bool allow_plaintext_password_);
164162
bool isPlaintextPasswordAllowed() const;

src/Access/AccessTokenProcessor.h

Lines changed: 0 additions & 134 deletions
This file was deleted.

src/Access/Authentication.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,7 @@ bool Authentication::areCredentialsValid(
345345
if (authentication_method.getType() != AuthenticationType::JWT)
346346
return false;
347347

348-
if (external_authenticators.checkJWTClaims(authentication_method.getJWTClaims(), *token_credentials))
349-
return true;
350-
351-
return external_authenticators.checkAccessTokenCredentials(*token_credentials);
348+
return external_authenticators.checkTokenCredentials(*token_credentials);
352349
}
353350

354351
if ([[maybe_unused]] const auto * always_allow_credentials = typeid_cast<const AlwaysAllowCredentials *>(&credentials))

0 commit comments

Comments
 (0)