Authorization Requests - Heimdall
Policy enforcement points ask Heimdall for a decision by posting an authorization request, either in the Heimdall format to /heimdall/authorize or as an AuthZEN evaluation. This page describes both payloads and the responses Heimdall returns.
-
The authorization request is a simple payload that is sent to the Heimdall authorization engine using the endpoint
/heimdall/authorizevia aPOST. The payload has the following structure:1 2 3 4 5 6 7 8
{ "method" : "POST", "uri" : "/api/example?hello=world", "namespace" : "API_EXAMPLE", "context" : { "key" : "value" } }
…which is trying to ask CAS:
Is the request to
/api/example?hello=world, owned byAPI_EXAMPLE, using the HTTP methodPOST, allowed?The following elements are supported:
Field Description methodThe requested HTTP method to allow or deny. uriThe request URI intended for access and invocation by the caller. namespaceLogical name for the owner of the API or resource in question. contextFree-form key-value pairs for more advanced decisions based on arbitrary contextual data. Typical responses include
200,401or403. -
Heimdall also supports the OpenID AuthZEN Authorization API 1.0 Access Evaluation API. Using this strategy, the authorization request is composed of the following entities:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
{ "subject": { "type": "user", "id": "alice@acmecorp.com" }, "resource": { "type": "account", "id": "123" }, "action": { "name": "can_read", "properties": { "hello": "world" } }, "context": { "field": "value" } }
This authorization request is sent to the Heimdall authorization engine using the endpoint
/heimdall/authzenvia aPOST. Once the request is evaluated, the typical response may match the following:1 2 3
{ "decision": true }
The
subject,resourceandactionobjects are required, along withsubject.type,subject.id,resource.type,resource.idandaction.name. A request that is missing any of these is rejected with a400status code, and a caller that cannot be authenticated receives a401status code. A request that is evaluated and denied receives a200status code with"decision": falseand a decision context. If the request carries anX-Request-IDheader, the same value is returned in the response.Note that
resource.ididentifies the resource instance being accessed, such as a specific account or document, and is not the name of a policy namespace. AuthZEN requests are matched against authorizable resources in every namespace using theirresourceType,actionsand optionalresourceIdPatternfields; the URI pattern, method and namespace fields are ignored for AuthZEN requests. Likewise, the/heimdall/authorizeendpoint rejects requests that carry AuthZENsubject,resourceoractionfields with a400status code.See AuthZEN for the decision context, access evaluations and policy decision point metadata.