Skip to main content

RAZ Client JWT Auth

A Python package that lets your application access S3 buckets protected by Cloudera's Ranger Authorization Service (RAZ) using a JWT token — no Kerberos required.

It works as a boto3 plugin: you configure it once, and every S3 call automatically goes through your Knox gateway → RAZ for authorization.


How It Works

Your app  →  boto3 S3 call
              ↓
         RazJwtS3Signer (this package)
              ↓  JWT Bearer token
         Knox Gateway → Ranger RAZ
              ↓  signed headers
         AWS S3
  1. Every boto3 S3 request is intercepted before it is sent.
  2. This package contacts your Knox-protected RAZ server using your JWT token.
  3. RAZ checks the Ranger policy and returns signed S3 headers.
  4. The request is forwarded to S3 with those headers.

Prerequisites

Requirement Details
Python 3.10 or higher
JWT access token Obtain from your CDP environment or identity provider
RAZ URL Knox-protected RAZ endpoint, e.g. https://<knox-host>:8443/<env>/cdp-entraid/rangerraz/
Knox CA certificate (optional) Path to the Knox CA .pem file — only needed if Knox uses a private/internal CA

Installation

pip install raz_client_jwt_auth boto3

raz_client is installed automatically as a dependency.


Quick Start

import boto3
from raz_client import Configuration, RAZ_URL_KEY, SSL_CERT_LOCATION, USE_SSL_VERIFICATION
from raz_client_jwt_auth import configure_ranger_raz_jwt

# 1. Create a boto3 S3 client
client = boto3.client("s3")

# 2. Build the configuration
conf = Configuration()
conf[RAZ_URL_KEY] = "https://<knox-host>:8443/<env>/cdp-entraid/rangerraz/"

# 3. SSL setup — pick ONE of the three options below:

# Option A (most common): Knox uses a private/internal CA — provide the CA cert
conf[SSL_CERT_LOCATION] = "/path/to/cdp-knox-ca.pem"

# Option B: Knox uses a publicly signed cert — no extra line needed,
#           USE_SSL_VERIFICATION defaults to True and uses the system trust store

# Option C: Disable SSL verification entirely — for testing only, not recommended in production
# conf[USE_SSL_VERIFICATION] = False

# 4. Register the JWT signer with the boto3 client
configure_ranger_raz_jwt(client, token="eyJ...", conf=conf)

# 5. Use the client normally
result = client.list_objects_v2(Bucket="my-bucket", Prefix="my/prefix/")
print(result)

SSL Configuration

SSL verification is enabled by default. The behaviour depends on which config keys you set:

USE_SSL_VERIFICATION SSL_CERT_LOCATION Result
True (default) Set to a .pem path Verifies Knox cert against your CA file
True (default) Not set Verifies using the system trust store
False — SSL verification disabled (testing only)

Supported S3 Operations

  • get_object / head_object
  • list_objects_v2
  • put_object / delete_object
  • upload_file / upload_fileobj
  • download_file / download_fileobj

See the raz_client README for the complete list.


Full Example

A runnable example covering all operations is in the examples folder. Run it directly using environment variables:

export RAZ_URL="https://<knox-host>:8443/<env>/cdp-entraid/rangerraz/"
export JWT_TOKEN="eyJ..."
export BUCKET="my-bucket"
export KEY="path/to/existing/file.csv"
export SSL_CERT="/path/to/cdp-knox-ca.pem"   # optional
export WRITE_KEY="path/to/write/test.txt"      # optional, enables write/delete test

python3 -m raz_client_jwt_auth.examples.jwt_s3_example

Configuration Reference

Constant Config Key Required Description
RAZ_URL_KEY fs.s3a.ext.raz.rest.host.url ✅ Yes Knox-protected RAZ server URL with port
SSL_CERT_LOCATION raz.client.ssl.cert.location No Absolute path to Knox CA cert (private CAs only)
USE_SSL_VERIFICATION raz.client.use.ssl.verification No True by default. Set False to disable SSL (not recommended)
RAZ_CLIENT_ENABLE_DEBUG_MODE raz.client.enable.debug.mode No Set True to print full debug logs
JWT token — ✅ Yes Passed as token= argument to configure_ranger_raz_jwt()

Troubleshooting

Error Cause Fix
ValueError: JWT token must be provided token argument is empty or whitespace Pass a valid JWT string
ValueError: RAZ URL must be set RAZ_URL_KEY not set in config Set conf[RAZ_URL_KEY] before calling configure_ranger_raz_jwt
SSL: CERTIFICATE_VERIFY_FAILED Knox uses a private CA but no cert provided Set conf[SSL_CERT_LOCATION] to your Knox CA .pem path
401 Unauthorized JWT token expired or invalid Refresh your JWT token
403 Forbidden Ranger policy denied the operation Check your Ranger S3 policy for this user/bucket

Development

From raz_client_jwt_auth/:

make setup
make test

Integration tests against a live cluster: raz_client_jwt_auth/test/integration_test_jwt_s3.py


License

Copyright (c) 2026 Cloudera, Inc. All Rights Reserved. This software is governed by the Cloudera Standard License — see LICENSE.txt or the Cloudera License page.

Metadata

Release files for raz-client-jwt-auth 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raz-client-jwt-auth 1.0.0
File Size Uploaded Provenance Actions
raz_client_jwt_auth-1.0.0.tar.gz 18.3 kB Without provenance Details for raz_client_jwt_auth-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for raz-client-jwt-auth 1.0.0
File Interpreter ABI Platform Actions
raz_client_jwt_auth-1.0.0-py3-none-any.whl Python 3 none any Details for raz_client_jwt_auth-1.0.0-py3-none-any.whl

Total release size: 37.6 kB

Release files / raz_client_jwt_auth-1.0.0.tar.gz

Download URL raz_client_jwt_auth-1.0.0.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f6cce8eac1c39d5c794a712da092d8eaa9c24dae39d979d3012efafbe7928943
BLAKE2b-256 checksum
How to use checksums
6468a90e391dcd3b410b4a2b825ec9cb86b4c443afbcdebdaf2b61c61c293b41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.8

Release files / raz_client_jwt_auth-1.0.0-py3-none-any.whl

Download URL raz_client_jwt_auth-1.0.0-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
195e1933220a3181b9885a4376790d3b7fac86d6fbea1f5f23413916c3b2b7e6
BLAKE2b-256 checksum
How to use checksums
f8155c37f62bca96a8184bf0877a046119e105640cd469ecb0090283acff0b6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.8

Security for raz-client-jwt-auth 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page