@@ -76,8 +76,9 @@ at [`logging.config` documentation page](https://docs.python.org/3.6/library/log
7676 section. Default value - not set.
7777- ` TABPY_OAUTH_ENABLED ` , ` TABPY_OAUTH_ISSUER ` , ` TABPY_OAUTH_JWKS_URI ` ,
7878 ` TABPY_OAUTH_AUDIENCE ` , ` TABPY_OAUTH_REQUIRED_SCOPES ` ,
79- ` TABPY_OAUTH_ENFORCE_ENDPOINT_SCOPES ` , ` TABPY_OAUTH_LOG_USER ` - configure
80- OAuth/JWT Bearer token authentication.
79+ ` TABPY_OAUTH_ENFORCE_ENDPOINT_SCOPES ` , ` TABPY_OAUTH_QUERY_SCOPE ` ,
80+ ` TABPY_OAUTH_EVALUATE_SCOPE ` , ` TABPY_OAUTH_DEPLOY_SCOPE ` ,
81+ ` TABPY_OAUTH_LOG_USER ` - configure OAuth/JWT Bearer token authentication.
8182 See [ OAuth / JWT Bearer Token Authentication] ( #oauth--jwt-bearer-token-authentication ) .
8283- ` TABPY_TRANSFER_PROTOCOL ` - transfer protocol. Default value - ` http ` . If
8384 set to ` https ` two additional parameters have to be specified:
@@ -311,35 +312,41 @@ service (e.g. a cloud metadata endpoint).
311312 the signing keys used to verify JWT signatures.
312313- ` TABPY_OAUTH_AUDIENCE ` is the expected ` aud ` claim on incoming JWTs.
313314
314- Three additional parameters are optional:
315+ Six additional parameters are optional:
315316
316317``` sh
317318TABPY_OAUTH_REQUIRED_SCOPES = tabpy
318319TABPY_OAUTH_ENFORCE_ENDPOINT_SCOPES = true
320+ TABPY_OAUTH_QUERY_SCOPE = tabpy:query
321+ TABPY_OAUTH_EVALUATE_SCOPE = tabpy:evaluate
322+ TABPY_OAUTH_DEPLOY_SCOPE = tabpy:deploy
319323TABPY_OAUTH_LOG_USER = true
320324```
321325
322326- ` TABPY_OAUTH_REQUIRED_SCOPES ` is a comma-separated list of scopes that
323327 must all be present in the JWT's ` scope ` claim on ** every** request,
324328 including ` /info ` . If unset, no global scope check is performed. A
325329 missing global scope is rejected with HTTP 401 (Flight:
326- ` UNAUTHENTICATED ` ). Do not put ` tabpy:query ` , ` tabpy:evaluate ` , or
327- ` tabpy:deploy ` here if you want them bound to specific paths; use
330+ ` UNAUTHENTICATED ` ). Do not put the configured endpoint scope names here
331+ if you want them bound only to their specific paths; use
328332 ` TABPY_OAUTH_ENFORCE_ENDPOINT_SCOPES ` for that.
329333
330- For example, an organization could restrict a finance team's TabPy
331- deployment with:
334+ Scope names are IdP-defined and compared exactly. For example, Amazon
335+ Cognito custom scopes use
336+ ` <resource-server-identifier>/<scope-name> ` . A Cognito resource server
337+ named ` tabpy ` with ` access ` and ` finance ` scopes could restrict a finance
338+ team's TabPy deployment with:
332339
333340 ``` sh
334- TABPY_OAUTH_REQUIRED_SCOPES = tabpy,org: finance
341+ TABPY_OAUTH_REQUIRED_SCOPES = tabpy/access,tabpy/ finance
335342 ```
336343
337- A token whose ` scope ` claim is ` openid tabpy org: finance ` would pass the
338- global scope check, while one containing ` openid tabpy org:marketing `
339- would be rejected. When multiple scopes are configured, the token must
340- contain ** all** of them.
344+ A token whose ` scope ` claim is ` openid tabpy/access tabpy/ finance ` would
345+ pass the global scope check, while one containing
346+ ` openid tabpy/access tabpy/marketing ` would be rejected. When multiple
347+ scopes are configured, the token must contain ** all** of them.
341348- ` TABPY_OAUTH_ENFORCE_ENDPOINT_SCOPES ` (default ` false ` ) requires
342- well-known scopes on specific HTTP paths after the JWT itself is valid:
349+ scopes on specific HTTP paths after the JWT itself is valid: by default,
343350 ` /query ` needs ` tabpy:query ` , ` /evaluate ` needs ` tabpy:evaluate ` , and
344351 mutating management operations need ` tabpy:deploy ` (` POST /endpoints ` ,
345352 ` PUT ` /` DELETE /endpoints/{name} ` , and
@@ -352,6 +359,23 @@ TABPY_OAUTH_LOG_USER = true
352359 forwards the original token. Arrow Flight is not per-endpoint scoped;
353360 it still uses only ` TABPY_OAUTH_REQUIRED_SCOPES ` . Basic Auth is
354361 unaffected.
362+ - ` TABPY_OAUTH_QUERY_SCOPE ` , ` TABPY_OAUTH_EVALUATE_SCOPE ` , and
363+ ` TABPY_OAUTH_DEPLOY_SCOPE ` configure the exact scope names used by
364+ endpoint enforcement and advertised by ` /info ` . Their defaults are
365+ ` tabpy:query ` , ` tabpy:evaluate ` , and ` tabpy:deploy ` . For an Amazon Cognito
366+ resource server with identifier ` tabpy ` , configure its slash-form custom
367+ scopes with:
368+
369+ ``` sh
370+ TABPY_OAUTH_QUERY_SCOPE = tabpy/query
371+ TABPY_OAUTH_EVALUATE_SCOPE = tabpy/evaluate
372+ TABPY_OAUTH_DEPLOY_SCOPE = tabpy/deploy
373+ ```
374+
375+ Each configured value must be a valid, non-empty OAuth scope token.
376+ Assigning the same value to multiple endpoint groups gives a token with
377+ that scope access to all of those groups; TabPy logs a warning when it
378+ detects this configuration.
355379- ` TABPY_OAUTH_LOG_USER ` (default ` false ` ) sets the JWT's ` sub ` claim as the
356380 authenticated user for logging purposes. The ` sub ` claim is often a
357381 user's email or SSO ID, so leave this disabled unless that's an
@@ -360,8 +384,8 @@ TABPY_OAUTH_LOG_USER = true
360384 enabled -- that's what actually logs the authenticated user, for both
361385 basic auth and OAuth.
362386
363- When OAuth is enabled, ` /info ` advertises ` tabpy:query ` , ` tabpy:evaluate ` ,
364- and ` tabpy:deploy ` under
387+ When OAuth is enabled, ` /info ` advertises the configured endpoint scopes
388+ (by default, ` tabpy:query ` , ` tabpy:evaluate ` , and ` tabpy:deploy ` ) under
365389` versions.v1.features.authentication.methods.oauth-jwt `
366390so an IdP or Tableau connection can request those scopes even when
367391endpoint enforcement is off.
0 commit comments