harbor run -t openthoughts/rsa-jwt-token-api-redis-blacklistharbor download openthoughts/rsa-jwt-token-api-redis-blacklistDevelop a REST API that issues RSA-signed JWT access and refresh tokens tagged with unique JTI claims and enforces expiration and revocation checks via a Redis-backed blacklist. Provide a CLI to acquire, validate, revoke, and retry tokens, ensuring revoked or expired tokens are correctly denied access.
REST API Server: Create a Flask or FastAPI server that provides the following endpoints:
POST /auth/login - Accepts username/password, returns access and refresh tokensPOST /auth/refresh - Accepts refresh token, returns new access tokenPOST /auth/revoke - Accepts token, adds it to Redis blacklistGET /auth/validate - Validates token and checks blacklist/expirationJWT Token Requirements:
iss, exp, iat, jti, subRedis Blacklist:
blacklist:{jti}CLI Tool: Create a command-line interface (/app/cli.py) with the following commands:
acquire - Login and acquire tokens, save to /app/tokens.jsonvalidate - Validate a token from /app/tokens.jsonrevoke - Revoke a token and update /app/tokens.jsonretry - Retry acquiring tokens if expiredSecurity Requirements:
/app/keys/ directory/app/keys/private.pem (must not be exposed via API)/app/keys/public.pem (can be exposed for validation)admin / password123Error Handling:
/app/logs/app.log/app/api.py or /app/main.py/app/cli.py/app/requirements.txt/app/tokens.json (created by CLI)/app/logs/app.log/app/keys/private.pem and /app/keys/public.pemThe solution will be tested by: