@@ -158,6 +158,93 @@ Authentication that checks a given API Key token is present as a Bearer token
158158- Same user ID and username handling as `noop`
159159- Token is passed through and validated against the API Key given from configuration, for downstream use
160160
161+ # ## Red Hat Identity (`rh-identity`)
162+
163+ Red Hat Identity header authentication is suitable for deployments behind Red Hat
164+ Hybrid Cloud Console infrastructure (e.g., console.redhat.com, Insights). This
165+ method validates the `x-rh-identity` header provided by Red Hat's authentication
166+ proxy, supporting both User (console users) and System (RHEL systems) identity types.
167+
168+ **Configuration:**
169+ ` ` ` yaml
170+ authentication:
171+ module: rh-identity
172+ rh_identity_config:
173+ required_entitlements: ["rhel"] # optional, validates service entitlements
174+ ` ` `
175+
176+ The `required_entitlements` field accepts a list of service names. When configured,
177+ ALL listed entitlements must be present in the identity header. Omit this field
178+ to disable entitlement validation entirely.
179+
180+ **Identity Types:**
181+
182+ - **User**: Console users authenticated via SSO. Identified by `user_id` and `username`
183+ from the `identity.user` object.
184+ - **System**: Certificate-authenticated RHEL systems. Identified by `cn` (Common Name)
185+ from the `identity.system` object, with `account_number` used as username.
186+
187+ **Header Format:**
188+
189+ The `x-rh-identity` header contains a base64-encoded JSON payload. Below are
190+ examples of the decoded JSON structure for each identity type.
191+
192+ User identity :
193+ ` ` ` json
194+ {
195+ "identity": {
196+ "account_number": "123456",
197+ "org_id": "654321",
198+ "type": "User",
199+ "user": {
200+ "user_id": "abc123",
201+ "username": "user@example.com",
202+ "is_org_admin": false
203+ }
204+ },
205+ "entitlements": {
206+ "rhel": {"is_entitled": true, "is_trial": false}
207+ }
208+ }
209+ ` ` `
210+
211+ System identity :
212+ ` ` ` json
213+ {
214+ "identity": {
215+ "account_number": "123456",
216+ "org_id": "654321",
217+ "type": "System",
218+ "system": {
219+ "cn": "c87dcb4c-8af1-40dd-878e-60c744edddd0"
220+ }
221+ },
222+ "entitlements": {
223+ "rhel": {"is_entitled": true, "is_trial": false}
224+ }
225+ }
226+ ` ` `
227+
228+ **Behavior:**
229+ - Extracts `x-rh-identity` header from request
230+ - Base64 decodes and parses as JSON
231+ - Validates structure based on identity type (User or System)
232+ - Validates service entitlements if `required_entitlements` is configured
233+ - Extracts user_id (or cn for System) and username (or account_number for System)
234+
235+ **Requirements:**
236+ - Valid `x-rh-identity` header with base64-encoded JSON
237+ - Proper JSON structure for the identity type
238+ - Required service entitlements (if configured)
239+
240+ **Error Responses:**
241+
242+ | Status | Condition |
243+ |--------|-----------|
244+ | 401 | Missing `x-rh-identity` header |
245+ | 400 | Invalid base64 encoding, invalid JSON, or missing required fields |
246+ | 403 | Missing required service entitlements |
247+
161248# # Authorization System
162249
163250Authorization is controlled through role-based access control using two resolver types.
0 commit comments