This document describes authentication mechanisms for the HyperFleet API.
HyperFleet API supports two authentication modes:
- Development Mode (No Auth): For local development and testing
- Production Mode (OCM Auth): JWT-based authentication via OpenShift Cluster Manager
For local development and testing, authentication can be disabled.
# Start service without authentication
make run-no-auth
# Access API without tokens
curl http://localhost:8000/api/hyperfleet/v1/clusters | jqexport AUTH_ENABLED=false
./bin/hyperfleet-api serveImportant: Never disable authentication in production environments.
Production deployments use JWT-based authentication integrated with OpenShift Cluster Manager (OCM).
# Start service with authentication
make run
# Login to OCM
ocm login --token=${OCM_ACCESS_TOKEN} --url=http://localhost:8000
# Access API with authentication
ocm get /api/hyperfleet/v1/clustersHyperFleet API validates JWT tokens issued by Red Hat SSO.
Token validation checks:
- Signature - Token signed by trusted issuer
- Issuer - Matches configured
JWT_ISSUER - Audience - Matches configured
JWT_AUDIENCE - Expiration - Token not expired
- Claims - Required claims present
Token format:
Authorization: Bearer <jwt-token>
Example request:
curl -H "Authorization: Bearer ${TOKEN}" \
http://localhost:8000/api/hyperfleet/v1/clustersHyperFleet API implements resource-based authorization.
Resources track ownership via created_by and updated_by fields:
{
"id": "cluster-123",
"name": "my-cluster",
"created_by": "user@example.com",
"updated_by": "user@example.com"
}- Create: Users can create resources
- Read: Users can read resources they created or have access to
- Update: Users can update resources they own
- Delete: Users can delete resources they own
Users within the same organization can access shared resources based on organizational membership.
# Development (no auth)
export AUTH_ENABLED=false
# Production (with auth)
export AUTH_ENABLED=true
export OCM_URL=https://api.openshift.com
export JWT_ISSUER=https://sso.redhat.com/auth/realms/redhat-external
export JWT_AUDIENCE=https://api.openshift.comSee Deployment for complete configuration options.
Configure via Helm values:
# values.yaml
auth:
enabled: true
ocmUrl: https://api.openshift.com
jwtIssuer: https://sso.redhat.com/auth/realms/redhat-external
jwtAudience: https://api.openshift.comDeploy:
helm install hyperfleet-api ./charts/ --values values.yaml401 Unauthorized
- Check token is valid and not expired
- Verify
JWT_ISSUERandJWT_AUDIENCEmatch token claims - Ensure
Authorizationheader is correctly formatted
403 Forbidden
- User authenticated but lacks permissions
- Check resource ownership
- Verify organizational membership
Token debugging
# Decode JWT token (header and payload only, not verified)
echo $TOKEN | cut -d. -f2 | base64 -d | jq
# Check token expiration
ocm token --refresh- Deployment - Authentication configuration and Kubernetes setup