Skip to content

Commit 3602bd7

Browse files
committed
Auth for Agency and Geography
1 parent 5bb925a commit 3602bd7

6 files changed

Lines changed: 41 additions & 37 deletions

File tree

agency/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ This specification contains a collection of RESTful APIs used to specify the dig
99
## Table of Contents
1010

1111
* [General Information](#general-information)
12+
* [Authorization](#authorization)
1213
* [Versioning](#versioning)
1314
* [Modes](#modes)
1415
* [Responses and Error Messages](#responses-and-error-messages)
15-
* [Authorization](#authorization)
1616
* [GBFS](#gbfs)
1717
* [Vehicles](#vehicles)
1818
* [Vehicle - Status](#vehicle---status)
@@ -34,6 +34,15 @@ This specification uses data types including timestamps, UUIDs, and vehicle stat
3434

3535
[Top][toc]
3636

37+
38+
### Authorization
39+
40+
When making requests, the Agency API expects `provider_id` to be part of the claims in a [JWT](https://jwt.io/) `access_token` in the `Authorization` header, in the form `Authorization: Bearer <access_token>`. The token issuance, expiration and revocation policies are at the discretion of the Agency. [JSON Web Token](/general-information.md#json-web-tokens) is the recommended format.
41+
42+
General authorization details are specified in the [Authorization section](/general-information.md#authorization) in MDS General Information.
43+
44+
[Top][toc]
45+
3746
### Versioning
3847

3948
`Agency` APIs must handle requests for specific versions of the specification from clients.
@@ -54,12 +63,6 @@ See the [Responses][responses] and [Error Messages][error-messages] sections.
5463

5564
[Top][toc]
5665

57-
### Authorization
58-
59-
When making requests, the Agency API expects `provider_id` to be part of the claims in a [JWT](https://jwt.io/) `access_token` in the `Authorization` header, in the form `Authorization: Bearer <access_token>`. The token issuance, expiration and revocation policies are at the discretion of the Agency.
60-
61-
[Top][toc]
62-
6366
### GBFS
6467

6568
See the [GBFS Requirement](/README.md#gbfs-requirement) language for more details.

general-information.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ OAuth 2.0's `client_credentials` grant type (outlined in [RFC6749](https://tools
6969

7070
OAuth 2.0 is an industry standard authorization framework with a variety of existing tooling. The `client_credentials` grant type facilitates generation of tokens that can be used for access by agencies and distributed to data partners.
7171

72-
If an MDS `provider` implements this auth scheme, it **MAY** choose to specify token scopes that define access parameters like allowable time ranges. These guidelines **SHOULD** be encoded into the returned token in a parseable way.
72+
If an MDS provider implements this auth scheme, it **MAY** choose to specify token scopes that define access parameters like allowable time ranges. These guidelines **SHOULD** be encoded into the returned token in a parseable way.
7373

7474
[Top][toc]
7575

geography/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ Geographical data will be stored as GeoJSON and read from either `geographies.js
1111
## Table of Contents
1212

1313
* [General Information](#general-information)
14+
* [Authorization](#authorization)
1415
* [Versioning](#versioning)
1516
* [Distribution](#distribution)
1617
* [Flat Files](#flat-files)
1718
* [Response Format](#response-format)
18-
* [Authorization](#authorization)
1919
* [Schema](#schema)
2020
* [Geography Fields](#geography-fields)
2121
* [Previous Geographies](#previous-geographies)
@@ -32,6 +32,12 @@ The following information applies to all `geography` API endpoints.
3232

3333
[Top][toc]
3434

35+
### Authorization
36+
37+
This endpoint should be made public. Authorization is not required.
38+
39+
[Top][toc]
40+
3541
### Versioning
3642

3743
MDS APIs must handle requests for specific versions of the specification from clients.
@@ -72,12 +78,6 @@ See the [Responses][responses] and [Error Messages][error-messages] sections.
7278

7379
[Top][toc]
7480

75-
### Authorization
76-
77-
This endpoint should be made public. Authorization is not required.
78-
79-
[Top][toc]
80-
8181
## Schema
8282

8383
See the [Endpoints](#endpoints) below for links to their specific JSON Schema documents.

metrics/README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ The Metrics API endpoints are intended to be implemented by regulatory agencies,
1010

1111
- [General Information](#general-information)
1212
- [Implementation](#implementation)
13+
- [Authorization](#authorization)
1314
- [Data Requirements](#data-requirements)
1415
- [Beta Feature](#beta-feature)
1516
- [Date and Time Format](#date-and-time-format)
16-
- [Authorization](#authorization)
1717
- [Data Redaction](#data-redaction)
1818
- [Metrics Discovery API](#metrics-discovery-api)
1919
- [Metrics Query API](#metrics-query-api)
@@ -58,6 +58,22 @@ Here are initial design use cases and scenarios for Metrics.
5858

5959
[Top][toc]
6060

61+
## Authorization
62+
63+
### For Agencies hosting the Metrics API
64+
65+
When making requests, the Metrics API expects one of two scopes `metrics:read` or `metrics:read:provider` to be present as part of the `scope` claims in a [JSON Web Token](https://jwt.io/) (JWT) `access_token` in the `Authorization` header, in the form `Authorization: Bearer <access_token>`. The token issuance, expiration and revocation policies are at the discretion of the agency. See MDS [JSON Web Token](/general-information.md#json-web-tokens) guidance.
66+
67+
If a client has a `metrics:read` scope, they are permitted to read _all_ metrics available via the Metrics API.
68+
69+
If a client has a `metrics:read:provider` scope, they are only permitted to read metrics which pertain to a particular `provider_id` claim in the aforementioned [JWT](https://jwt.io/) `access_token`.
70+
71+
Further scopes and requirements may be added at the discretion of the Agency, depending on their particular access control needs.
72+
73+
General authorization details are specified in the [Authorization section](/general-information.md#authorization) in MDS General Information.
74+
75+
[Top][toc]
76+
6177
## Data Requirements
6278

6379
The Metrics API does not replace required MDS Provider and Agency endpoints (e.g., [trips](/provider#trips), [events](/provider#events), [vehicles](/provider#vehicles), etc.) in any way. City regulators use disaggregated data access for policy, data validation, auditing, and operational needs, and the Metrics API is not designed to serve these purposes.
@@ -82,22 +98,6 @@ All interval durations (duration) are [ISO 8601](https://en.wikipedia.org/wiki/I
8298

8399
[Top][toc]
84100

85-
## Authorization
86-
87-
### For Agencies hosting the Metrics API
88-
89-
When making requests, the Metrics API expects one of two scopes `metrics:read` or `metrics:read:provider` to be present as part of the `scope` claims in a [JSON Web Token](https://jwt.io/) (JWT) `access_token` in the `Authorization` header, in the form `Authorization: Bearer <access_token>`. The token issuance, expiration and revocation policies are at the discretion of the agency. See MDS [JSON Web Token](/general-information.md#json-web-tokens) guidance.
90-
91-
If a client has a `metrics:read` scope, they are permitted to read _all_ metrics available via the Metrics API.
92-
93-
If a client has a `metrics:read:provider` scope, they are only permitted to read metrics which pertain to a particular `provider_id` claim in the aforementioned [JWT](https://jwt.io/) `access_token`.
94-
95-
Further scopes and requirements may be added at the discretion of the Agency, depending on their particular access control needs.
96-
97-
General authorization details are specified in the [Authorization section](/general-information.md#authorization) in MDS General Information.
98-
99-
[Top][toc]
100-
101101
## Data Redaction
102102

103103
Some combinations of dimensions, filters, time, and geography may return a small count of trips, which could increase a privacy risk of re-identification. To correct for that, Metrics does not return data below a certain count of results. This data redaction is called k-anonymity, and the threshold is set at a k-value of 10. For more explanation of this methodology, see our [Data Redaction Guidance document](https://github.com/openmobilityfoundation/mobility-data-specification/wiki/MDS-Data-Redaction).

policy/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ This specification describes the digital relationship between _mobility as a ser
1010

1111
- [General information](#general-information)
1212
- [Background](#background)
13+
- [Authorization](#authorization)
1314
- [Update Frequency](#update-frequency)
1415
- [Updating or Ending Policies](#updating-or-ending-policies)
1516
- [Versioning](#versioning)
1617
- [Distribution](#distribution)
1718
- [REST Endpoints](#rest-endpoints)
1819
- [Responses and Error Messages](#responses-and-error-messages)
19-
- [Authorization](#authorization)
2020
- [Policies](#policies)
2121
- [Query Parameters](#query-parameters)
2222
- [Geographies](#geographies)
@@ -71,6 +71,10 @@ The machine-readable format allows Providers to obtain policies and compute comp
7171

7272
[Top][toc]
7373

74+
### Authorization
75+
76+
This endpoint should be made public. Authorization is not required.
77+
7478
### Update Frequency
7579

7680
The publishing agency should establish beforehand and communicate to providers how frequently the Policy endpoints are expected to change, how often they should be polled to get the latest information, and expectations around emergency updates.
@@ -127,10 +131,6 @@ The response to a client request must include a valid HTTP status code defined i
127131

128132
See the [Responses section][responses] for information on valid MDS response codes and the [Error Messages section][error-messages] for information on formatting error messages.
129133

130-
### Authorization
131-
132-
This endpoint should be made public. Authorization is not required.
133-
134134
### Policies
135135

136136
**Endpoint**: `/policies/{id}`

provider/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This specification contains a data standard for *mobility as a service* provider
99
## Table of Contents
1010

1111
* [General Information](#general-information)
12+
* [Authorization](#authorization)
1213
* [Versioning](#versioning)
1314
* [Modes](#modes)
1415
* [Responses and Error Messages](#responses-and-error-messages)

0 commit comments

Comments
 (0)