azapi August 2024
Gazitt, et al. Standards Track [Page]
Workgroup:
OpenID AuthZEN
Published:
Authors:
O. Gazitt, Ed.
Aserto
D. Brossard, Ed.
Axiomatics
A. Tulshibagwale, Ed.
SGNL

Authorization API 1.0 – draft 00

Abstract

The Authorization API enables Policy Decision Points (PDPs) and Policy Enforcement Points (PEPs) to communicate authorization requests and decisions to each other without requiring knowledge of each other's inner workings. The Authorization API is served by the PDP and is called by the PEP. The Authorization API includes an Evaluation endpoint, which provides specific access decisions. Other endpoints may be added in the future for other scenarios, including searching for subjects or resources.

Table of Contents

1. Introduction

Computational services often implement access control within their components by separating Policy Decision Points (PDPs) from Policy Enforcement Points (PEPs). PDPs and PEPs are defined in XACML ([XACML]) and NIST's ABAC SP 800-162 ([ABAC]). Communication between PDPs and PEPs follows similar patterns across different software and services that require or provide authorization information. The Authorization API described in this document enables different providers to offer PDP and PEP capabilities without having to bind themselves to one particular implementation of a PDP or PEP.

2. Model

The Authorization API is a transport-agnostic API published by the PDP, to which the PEP acts as a client. Possible bindings of this specification, such as HTTPS or gRPC, are described in Transport (Section 7).

Authorization for the Authorization API itself is out of scope for this document, since authorization for APIs is well-documented elsewhere. For example, the Authorization API's HTTPS binding MAY support authorization using an Authorization header, using a basic or bearer token. Support for OAuth 2.0 ([RFC6749]) is RECOMMENDED.

3. Features

The core feature of the Authorization API is the Access Evaluation API, which enables a PEP to find out if a specific request can be permitted to access a specific resource. The following are non-normative examples:

4. API Version

This document describes the API version 1. Any updates to this API through subsequent revisions of this document or other documents MAY augment this API, but MUST NOT modify the API described here. Augmentation MAY include additional API methods or additional parameters to existing API methods, additional authorization mechanisms, or additional optional headers in API requests. All API methods for version 1 MUST be immediately preceded by the relative URL path /v1/.

5. Information Model

The information model for requests and responses include the following entities: Subject, Action, Resource, Context, and Decision. These are all defined below.

5.1. Subject

A Subject is the user or robotic principal about whom the Authorization API is being invoked. The Subject may be requesting access at the time the Authorization API is invoked.

A Subject is a JSON ([RFC8259]) object that contains any number of key-value pair attributes. However, there are a minimal number of fields that are required in order to properly resolve a Subject.

type:

REQUIRED. A string value that specifies the type of the Subject.

id:

REQUIRED. The unique identifier of the Subject, scoped to the type.

A Subject MAY contain zero or more additional key-value pairs.

The following is a non-normative example of a subject:

{
  "type": "user",
  "id": "alice@acmecorp.com"
}
Figure 1: Example Subject

5.1.1. Subject Identifier

The id field of a Subject MAY be any valid JSON value. It MAY be a string, or it MAY be a structured identifier. For example, it MAY follow the format specified by the Subject Identifiers for Security Event Tokens specification [RFC9493].

The following is a non-normative example of a Subject Identifier as a simple string:

{
  "type": "user",
  "id": "alice@acmecorp.com"
}
Figure 2: Example of Simple Subject Identifier

The following is a non-normative example of a Subject Identifier in the [RFC9493] Email Identifier Format:

{
  "type": "user",
  "id": {
    "format" : "email",
    "email": "alice@acmecorp.com"
  }
}
Figure 3: Example Subject Identifier as RFC9493 Subject

5.1.2. Subject Type

Since [RFC9493] only concerns itself with the format of the identifier and not its type, every Subject MUST also include a string-valued type field, which identifies the type of Subject.

The following is a non-normative example of a Subject of type group with a Subject Identifier as a simple string:

{
  "type": "group",
  "id": "engineering@acmecorp.com"
}
Figure 4: Example Group Subject Type

The following is a non-normative example of a Subject of type group with a Subject Identifier in the [RFC9493] Email Identifier Format:

{
  "type": "group",
  "id": {
    "format" : "email",
    "email": "engineering@acmecorp.com"
  }
}
Figure 5: Example Subject Type in RFC9493 Format

5.1.3. Subject Attributes

Many authorization systems are stateless, and expect the client (PEP) to pass in any attributes that are expected to be used in the evaluation of the authorization policy. To satisfy this requirement, Subjects MAY include zero or more additional attributes as key-value pairs.

An attribute can be single-valued or multi-valued. It can be a primitive type (string, boolean, number) or a complex type such as a JSON object or JSON array.

The following is a non-normative example of a Subject which adds a string-valued department attribute:

{
  "type": "user",
  "id": "alice@acmecorp.com",
  "department": "Sales"
}
Figure 6: Example Subject with Additional Attribute

To increase interoperability, a few common attributes are specified below:

5.1.3.1. IP Address

The IP Address of the Subject, identified by an ip_address field, whose value is a textual representation of an IP Address, as defined in Textual Conventions for Internet Network Addresses [RFC4001].

The following is a non-normative example of a subject which adds the ip_address attribute:

{
  "type": "user",
  "id": "alice@acmecorp.com",
  "department": "Sales",
  "ip_address": "172.217.22.14"
}
Figure 7: Example Subject with IP Address
5.1.3.2. Device ID

The Device Identifier of the Subject, identified by a device_id field, whose value is a string representation of the device identifier.

The following is a non-normative example of a subject which adds the device_id attribute:

{
  "type": "user",
  "id": "alice@acmecorp.com",
  "department": "Sales",
  "ip_address": "172.217.22.14",
  "device_id": "8:65:ee:17:7e:0b"
}
Figure 8: Example Subject with Device ID

5.2. Resource

A Resource is the target of an access request. It is a JSON ([RFC8259]) object that is constructed similar to a Subject entity.

type:

REQUIRED. A string value that specifies the type of the Resource.

id:

REQUIRED. The unique identifier of the Resource, scoped to the type. The value MAY be any valid JSON value, including a simple string. It also MAY follow the format specified by the Subject Identifiers for Security Event Tokens specification [RFC9493].

5.2.1. Examples (non-normative)

The following is a non-normative example of a Resource with a type and a simple id:

{
  "type": "book",
  "id": "123"
}
Figure 9: Example Resource

The following is a non-normative example of a Resource containing a Subject Identifier in the Opaque Identifier Format, with additional structured attributes:

{
  "type": "book",
  "id": {
    "format": "opaque",
    "value": "123"
  },
  "library_record":{
    "title": "AuthZEN in Action",
    "isbn": "978-0593383322"
  }
}
Figure 10: Example Resource with Subject Identifier and Additional Attributes

5.3. Action

An Action is the type of access that the requester intends to perform.

Action is a JSON ([RFC8259]) object that contains at least a name field.

name:

REQUIRED. The name of the Action.

The following is a non-normative example of an action:

{
  "name": "can_read"
}
Figure 11: Example Action

5.3.1. Common Action Values

Since many services follow a Create-Read-Update-Delete convention, a set of common Actions are defined. That said, an Action may be specific to the application being accessed or shared across applications but not listed in the common Actions below.

The following common Actions are defined:

  • can_access: A generic Action that could mean any type of access. This is useful if the policy or application is not interested in different decisions for different types of Actions.

  • can_create: The Action to create a new entity, which MAY be defined by the resource field in the request.

  • can_read: The Action to read the content. Based on the Resource being accessed, this could mean a list functionality or reading an individual Resource's contents.

  • can_update: The Action to update the content of an existing Resource. This represents a partial update or an entire replacement of an entity that MAY be identified by the Resource in the request.

  • can_delete: The Action to delete a Resource. The specific entity MAY be identified by the Resource in the request.

PDP Policies MAY incorporate common Action names to provide different decisions based on the Action.

5.4. Context

The Context object is a set of attributes that represent environmental or contextual data about the request such as time of day. It is a JSON ([RFC8259]) object.

The following is a non-normative example of a Context:

{
  "time": "1985-10-26T01:22-07:00"
}
Figure 12: Example Context

6. Access Evaluation API

The Access Evaluation API defines the message exchange pattern between a client (PEP) and an authorization service (PDP) for executing a single access evaluation.

6.1. The Access Evaluation API Request

The Access Evaluation request is a 4-tuple constructed of the four previously defined entities:

subject:

REQUIRED. The subject (or principal) of type Subject

action:

REQUIRED. The action (or verb) of type Action.

resource:

REQUIRED. The resource of type Resource.

context:

OPTIONAL. The context (or environment) of type Context.

6.1.1. Example (non-normative)

{
  "subject": {
    "type": "user",
    "id": {
      "format": "iss_sub",
      "iss": "https://issuer.example.com/",
      "sub": "145234573"
    }
  },
  "resource": {
    "type": "account",
    "id": "123"
  },
  "action": {
    "name": "can_read",
    "method": "GET"
  },
  "context": {
    "time": "1985-10-26T01:22-07:00"
  }
}
Figure 13: Example Request

6.2. The Access Evaluation API Response

The simplest form of a response is simply a boolean representing a Decision, indicated by a "decision" field.

decision:

REQUIRED. A boolean value that specifies whether the Decision is to allow or deny the operation.

In this specification, assuming the evaluation was successful, there are only 2 possible responses:

  • true: The access request is permitted to go forward.

  • false: The access request is denied and MUST NOT be permitted to go forward.

The response object MUST contain this boolean-valued Decision key.

6.2.1. Access Evaluation Decision

The following is a non-normative example of a simple Decision:

{
  "decision": true
}
Figure 14: Example Decision

6.2.2. Additional Context in a Response

In addition to a "decision", a response may contain a "context" field which can be any JSON object. This context can convey additional information that can be used by the PEP as part of the decision evaluation process. Examples include:

  • XACML's notion of "advice" and "obligations"

  • Hints for rendering UI state

  • Instructions for step-up authentication

6.2.3. Example Context

An implementation MAY follow a structured approach to "context", in which it presents the reasons that an authorization request failed.

  • A list of identifiers representing the items (policies, graph nodes, tuples) that were used in the decision-making process.

  • A list of reasons as to why access is permitted or denied.

6.2.3.1. Reasons

Reasons MAY be provided by the PDP.

6.2.3.1.1. Reason Field

A Reason Field is a JSON object that has keys and values of type string. The following are non-normative examples of Reason Field objects:

{
  "en": "location restriction violation"
}
Figure 15: Example Reason
6.2.3.1.2. Reason Object

A Reason Object specifies a particular reason. It is a JSON object that has the following fields:

id:

REQUIRED. A string value that specifies the reason within the scope of a particular response.

reason_admin:

OPTIONAL. The reason, which MUST NOT be shared with the user, but useful for administrative purposes that indicates why the access was denied. The value of this field is a Reason Field object (Section 6.2.3.1.1).

reason_user:

OPTIONAL. The reason, which MAY be shared with the user that indicates why the access was denied. The value of this field is a Reason Field object (Section 6.2.3.1.1).

The following is a non-normative example of a Reason Object:

{
  "id": "0",
  "reason_admin": {
    "en": "Request failed policy C076E82F"
  },
  "reason_user": {
    "en-403": "Insufficient privileges. Contact your administrator",
    "es-403": "Privilegios insuficientes. Póngase en contacto con su administrador"
  }
}
Figure 16: Example of a Reason Object

6.2.4. Sample Response with additional context (non-normative)

{
  "decision": true,
  "context": {
    "id": "0",
    "reason_admin": {
      "en": "Request failed policy C076E82F"
    },
    "reason_user": {
      "en-403": "Insufficient privileges. Contact your administrator",
      "es-403": "Privilegios insuficientes. Póngase en contacto con su administrador"
    }
  }
}
Figure 17: Example Response with Context

7. Transport

This specification defines an HTTPS binding which MUST be implemented by a compliant PDP.

Additional transport bindings (e.g. gRPC) MAY be defined in the future in the form of profiles, and MAY be implemented by a PDP.

7.1. HTTPS Binding

7.1.1. HTTPS Access Evaluation Request

The Access Evaluation Request is an HTTPS request with content-type of application/json. Its body is a JSON object that contains the Access Evaluation Request, as defined in Section 6.1.

The following is a non-normative example of the HTTPS binding of the Access Evaluation Request:

POST /access/v1/evaluation HTTP/1.1
Host: pdp.mycompany.com
Authorization: Bearer <myoauthtoken>
X-Request-ID: bfe9eb29-ab87-4ca3-be83-a1d5d8305716

{
  "subject": {
    "type": "user",
    "id": "alice@acmecorp.com"
  },
  "resource": {
    "type": "todo",
    "id": "1",
  },
  "action": {
    "name": "can_read"
  },
  "context": {
    "time": "1985-10-26T01:22-07:00"
  }
}
Figure 18: Example of an HTTPS Access Evaluation Request

7.1.2. Access Evaluation HTTPS Response

The success response to an Access Evaluation Request is an Access Evaluation Response. It is an HTTPS response with a status code of 200, and content-type of application/json. Its body is a JSON object that contains the Access Evaluation Response, as defined in Section 6.2.

Following is a non-normative example of an HTTPS Access Evaluation Response:

HTTP/1.1 OK
Content-type: application/json
X-Request-ID: bfe9eb29-ab87-4ca3-be83-a1d5d8305716

{
  "decision": true
}
Figure 19: Example of an HTTPS Access Evaluation Response

7.1.3. Error Responses

The following error responses are common to all methods of the Authorization API. The error response is indicated by an HTTPS status code (Section 15 of [RFC9110]) that indicates error.

The following errors are indicated by the status codes defined below:

Table 1: HTTPS Error status codes
Code Description HTTPS Body Content
400 Bad Request An error message string
401 Unauthorized An error message string
403 Forbidden An error message string
500 Internal error An error message string

Note: HTTPS errors are returned by the PDP to indicate an error condition relating to the request or its processing, and are unrelated to the outcome of an authorization decision, which is always returned with a 200 status code and a response payload.

To make this concrete: * a 401 HTTPS status code indicates that the caller (policy enforcement point) did not properly authenticate to the PDP - for example, by omitting a required Authorization header, or using an invalid access token. * the PDP indicates to the caller that the authorization request is denied by sending a response with a 200 HTTPS status code, along with a payload of { "decision": false }.

7.1.4. Request Identification

All requests to the API MAY have request identifiers to uniquely identify them. The API client (PEP) is responsible for generating the request identifier. If present, the request identifier SHALL be provided using the HTTPS Header X-Request-ID. The value of this header is an arbitrary string. The following non-normative example describes this header:

POST /access/v1/evaluation HTTP/1.1
Authorization: Bearer mF_9.B5f-4.1JqM
X-Request-ID: bfe9eb29-ab87-4ca3-be83-a1d5d8305716
Figure 20: Example HTTPS request with a Request Id Header

7.1.5. Request Identification in a Response

A PDP responding to an Authorization API request that contains an X-Request-ID header MUST include a request identifier in the response. The request identifier is specified in the HTTPS Response header: X-Request-ID. If the PEP specified a request identifier in the request, the PDP MUST include the same identifier in the response to that request.

The following is a non-normative example of an HTTPS Response with this header:

HTTP/1.1 OK
Content-type: application/json
X-Request-ID: bfe9eb29-ab87-4ca3-be83-a1d5d8305716
Figure 21: Example HTTPS response with a Request Id Header

8. IANA Considerations

This specification does not introduce any new identifiers that would require registration with IANA.

9. Security Considerations

9.1. Communication Integrity and Confidentiality

In the ABAC architecture, the PEP-PDP connection is the most sensitive one and needs to be secured to guarantee:

  • Integrity

  • Confidentiality

As a result, the connection between the PEP and the PDP MUST be secured using the most adequate means given the choice of transport (e.g. TLS for HTTP REST).

9.2. Policy Confidentiality and Sender Authentication

Additionally, the PDP SHOULD authenticate the calling PEP. There are several ways authentication can be established. These ways are out of scope of this specification. They MAY include:

  • Mutual TLS

  • OAuth-based authentication

  • API key

The choice and strength of either mechanism is not in scope.

Authenticating the PEP allows the PDP to avoid common attacks (such as DoS - see below) and/or reveal its internal policies. A malicious actor could craft a large number of requests to try and understand what policies the PDP is configured with. Requesting a client (PEP) be authenticated mitigates that risk.

9.3. Trust

In ABAC, there is occasionally conversations around the trust between PEP and PDP: how can the PDP trust the PEP to send the right values in? This is a misplaced concern. The PDP must trust the PEP as ultimately, the PEP is the one responsible for enforcing the decision the PDP produces.

9.4. Availability & Denial of Service

The PDP SHOULD apply reasonable protections to avoid common attacks tied to request payload size, the number of requests, invalid JSON, nested JSON attacks, or memory consumption. Rate limiting is one such way to address such issues.

10. References

10.1. Normative References

[RFC4001]
Daniele, M., Haberman, B., Routhier, S., and J. Schoenwaelder, "Textual Conventions for Internet Network Addresses", RFC 4001, DOI 10.17487/RFC4001, , <https://www.rfc-editor.org/rfc/rfc4001>.
[RFC6749]
Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", RFC 6749, DOI 10.17487/RFC6749, , <https://www.rfc-editor.org/rfc/rfc6749>.
[RFC8259]
Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/rfc/rfc8259>.
[RFC9110]
Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "HTTP Semantics", STD 97, RFC 9110, DOI 10.17487/RFC9110, , <https://www.rfc-editor.org/rfc/rfc9110>.
[RFC9493]
Backman, A., Ed., Scurtescu, M., and P. Jain, "Subject Identifiers for Security Event Tokens", RFC 9493, DOI 10.17487/RFC9493, , <https://www.rfc-editor.org/rfc/rfc9493>.
[XACML]
Godik, S., Ed. and T. M. (Ed.), Ed., "eXtensible Access Control Markup Language (XACML) Version 1.1", , <https://www.oasis-open.org/committees/xacml/repository/cs-xacml-specification-1.1.pdf>.

Appendix A. Terminology

Subject:

The user or robotic principal about whom the Authorization API call is being made.

Resource:

The target of the request; the resource about which the Authorization API is being made.

Action:

The operation the Subject has attempted on the Resource in an Authorization API call.

Context:

The environmental or contextual attributes for this request.

Decision:

The value of the evaluation decision made by the PDP: true for "allow", false for "deny".

PDP:

Policy Decision Point. The component or system that provides authorization decisions over the network interface defined here as the Authorization API.

PEP:

Policy Enforcement Point. The component or system that requests decisions from the PDP and enforces access to specific requests based on the decisions obtained from the PDP.

Appendix B. Acknowledgements

This template uses extracts from templates written by Pekka Savola, Elwyn Davies and Henrik Levkowetz.

Appendix C. Document History

[[ To be removed from the final specification ]]

-00

Appendix D. Notices

Copyright (c) 2024 The OpenID Foundation.

The OpenID Foundation (OIDF) grants to any Contributor, developer, implementer, or other interested party a non-exclusive, royalty free, worldwide copyright license to reproduce, prepare derivative works from, distribute, perform and display, this Implementers Draft or Final Specification solely for the purposes of (i) developing specifications, and (ii) implementing Implementers Drafts and Final Specifications based on such documents, provided that attribution be made to the OIDF as the source of the material, but that such attribution does not indicate an endorsement by the OIDF.

The technology described in this specification was made available from contributions from various sources, including members of the OpenID Foundation and others. Although the OpenID Foundation has taken steps to help ensure that the technology is available for distribution, it takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this specification or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any independent effort to identify any such rights. The OpenID Foundation and the contributors to this specification make no (and hereby expressly disclaim any) warranties (express, implied, or otherwise), including implied warranties of merchantability, non-infringement, fitness for a particular purpose, or title, related to this specification, and the entire risk as to implementing this specification is assumed by the implementer. The OpenID Intellectual Property Rights policy requires contributors to offer a patent promise not to assert certain patent claims against other contributors and against implementers. The OpenID Foundation invites any interested party to bring to its attention any copyrights, patents, patent applications, or other proprietary rights that may cover technology that may be required to practice this specification.

Contributors

Marc Jordan
SGNL
Erik Gustavson
SGNL
Alex Babeanu
3Edges

Authors' Addresses

Omri Gazitt (editor)
Aserto
David Brossard (editor)
Axiomatics
Atul Tulshibagwale (editor)
SGNL