You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: agency/README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,10 @@ This specification contains a collection of RESTful APIs used to specify the dig
9
9
## Table of Contents
10
10
11
11
*[General Information](#general-information)
12
+
*[Authorization](#authorization)
12
13
*[Versioning](#versioning)
13
14
*[Modes](#modes)
14
15
*[Responses and Error Messages](#responses-and-error-messages)
15
-
*[Authorization](#authorization)
16
16
*[GBFS](#gbfs)
17
17
*[Vehicles](#vehicles)
18
18
*[Vehicle - Status](#vehicle---status)
@@ -34,6 +34,14 @@ This specification uses data types including timestamps, UUIDs, and vehicle stat
34
34
35
35
[Top][toc]
36
36
37
+
### Authorization
38
+
39
+
MDS Agency endpoint producers **SHALL** provide authorization for API endpoints via a bearer token based auth system. When making requests, the endpoints expect `provider_id` to be part of the 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. [JSON Web Token](/general-information.md#json-web-tokens) is the recommended format.
40
+
41
+
General authorization details are specified in the [Authorization section](/general-information.md#authorization) in MDS General Information.
42
+
43
+
[Top][toc]
44
+
37
45
### Versioning
38
46
39
47
`Agency` APIs must handle requests for specific versions of the specification from clients.
@@ -54,12 +62,6 @@ See the [Responses][responses] and [Error Messages][error-messages] sections.
54
62
55
63
[Top][toc]
56
64
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
-
63
65
### GBFS
64
66
65
67
See the [GBFS Requirement](/README.md#gbfs-requirement) language for more details.
Copy file name to clipboardExpand all lines: general-information.md
+41-3Lines changed: 41 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This document contains specifications that are shared between the various MDS [A
4
4
5
5
## Table of Contents
6
6
7
-
-[Authentication](#authentication)
7
+
-[Authorization](#authorization)
8
8
-[Beta Features](#beta-features)
9
9
-[Costs and Currencies](#costs-and-currencies)
10
10
-[Data Types](#data-types)
@@ -25,11 +25,49 @@ This document contains specifications that are shared between the various MDS [A
25
25
-[Vehicle States](#vehicle-states)
26
26
-[Versioning](#versioning)
27
27
28
-
## Authentication
28
+
## Authorization
29
+
30
+
Outlines shared authorization details and methods across all MDS APIs.
31
+
32
+
### Endpoint Requirements
33
+
34
+
All MDS Provider, Agency, and Metrics APIs require authentication, as outlined.
29
35
30
36
If implementing MDS Policy, Geography, and/or Jurisdiction APIs and endpoints, an agency must make them unauthenticated and public. This allows transparency for the public to see how the city is regulating, holds the city accountable for their policy decisions, and reduces the technical burden on providers to use these endpoints. A side benefit is that this allows third parties to ingest this information into their applications and services for public benefit.
31
37
32
-
All other MDS APIs require authentication, as outlined.
38
+
As of MDS 0.3.0, `gbfs.json` is required. The required GBFS endpoints should be made available publicly. See Provider [#realtime-data](https://github.com/openmobilityfoundation/mobility-data-specification/tree/main/provider#realtime-data) for more information about how to implement GBFS for dockless systems.
39
+
40
+
### Header
41
+
42
+
The `Authorization` header is sent as part of an HTTP request. Example:
43
+
44
+
```
45
+
GET /trips HTTP/1.1
46
+
Host: api.provider.co
47
+
Authorization: Bearer <token>
48
+
```
49
+
50
+
More info on how to document [Bearer Auth in swagger](https://swagger.io/docs/specification/authentication/bearer-authentication/).
51
+
52
+
### JSON Web Tokens
53
+
54
+
JSON Web Token ([JWT](https://jwt.io/introduction/)) is **RECOMMENDED** as the token format.
55
+
56
+
JWTs provide a safe, secure way to verify the identity of an agency and provide access to MDS resources without providing access to other, potentially sensitive data.
57
+
58
+
> JSON Web Token (JWT) is an open standard ([RFC 7519](https://tools.ietf.org/html/rfc7519)) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA.
59
+
60
+
MDS API producers **MAY** include any metadata in the JWT they wish that helps to route, log, permission, or debug agency requests, leaving their internal implementation flexible.
61
+
62
+
JWT provides a helpful [debugger](https://jwt.io/#debugger) for testing your token and verifying security.
63
+
64
+
### OAuth 2.0
65
+
66
+
OAuth 2.0's `client_credentials` grant type (outlined in [RFC6749](https://tools.ietf.org/html/rfc6749#section-4.4)) is **RECOMMENDED** as the authentication and authorization scheme.
67
+
68
+
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.
69
+
70
+
If an MDS endpoint producer 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 parsable way.
Copy file name to clipboardExpand all lines: jurisdiction/README.md
+32-19Lines changed: 32 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,9 @@ This specification details the purpose, use cases, and schema for Jurisdictions.
8
8
9
9
-[Background](#background)
10
10
-[Beta Feature](#beta-feature)
11
+
-[Authorization](#authorization)
11
12
-[Use Cases](#use-cases)
12
13
-[Distribution](#distribution)
13
-
-[REST](#rest)
14
14
-[Schema](#schema)
15
15
-[REST Endpoints](#rest-endpoints)
16
16
-[Flat Files](#flat-files)
@@ -33,12 +33,22 @@ A jurisdiction is:
33
33
- Purview to make rules over physical boundaries and modal boundaries (e.g. a jurisdiction could be for taxis only)
34
34
- A way of tracking revisions in an agency's authority
35
35
36
+
[Top][toc]
37
+
36
38
## Beta Feature
37
39
38
40
The Jurisdictions API and all of its endpoints are marked as a [beta feature](https://github.com/openmobilityfoundation/mobility-data-specification/blob/feature-metrics/general-information.md#beta-features) starting in the 1.1.0 release. It has not been tested in real world scenarios, and may be adjusted in future releases.
39
41
40
42
**[Beta feature](https://github.com/openmobilityfoundation/mobility-data-specification/blob/feature-metrics/general-information.md#beta-features)**: _Yes (as of 1.1.0)_. [Leave feedback](https://github.com/openmobilityfoundation/mobility-data-specification/issues/673)
41
43
44
+
[Top][toc]
45
+
46
+
### Authorization
47
+
48
+
This endpoint should be made public. Authorization is not required.
49
+
50
+
[Top][toc]
51
+
42
52
## Use Cases
43
53
44
54
### 1. Defining boundaries and what the vehicle state `elsewhere` means
@@ -64,25 +74,13 @@ Example: A SaaS company contracts with Miami-Dade County to provide MDS. There a
64
74
Example: The City of Miami has different data visualization tools from the city of Coral Gables
65
75
Those tools can be granted data access from the SaaS tool based on the jurisdiction's stable identifier.
66
76
67
-
[Top](#table-of-contents)
77
+
[Top][toc]
68
78
69
79
## Distribution
70
80
71
-
Jurisdictions can be served by agencies through the following REST API, or via [flat-files](#flat-files). Agencies should make the endpoints public and non-authenticated.
72
-
73
-
### REST
74
-
75
-
All response fields must use `lower_case_with_underscores`.
76
-
77
-
Responses must set the `Content-Type` header, as specified in the [Provider versioning](../provider/README.md#versioning) section. They must also specify the current API version being served in the JSON-formatted response body, under the `version` key.
78
-
79
-
Response bodies must be a `UTF-8` encoded JSON object.
80
-
81
-
#### HTTP Response Codes
81
+
Jurisdictions can be served by agencies through the following REST API, or via [flat-files](#flat-files). See [Authorization](#authorization).
82
82
83
-
The response to a client request must include a valid HTTP status code defined in the [IANA HTTP Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
84
-
85
-
[Top](#table-of-contents)
83
+
[Top][toc]
86
84
87
85
## Schema
88
86
@@ -116,9 +114,23 @@ Formatted in JSON, a Jurisdiction object should look like this:
116
114
"timestamp": Timestamp
117
115
}
118
116
```
117
+
[Top][toc]
119
118
120
119
## REST Endpoints
121
120
121
+
### Format
122
+
123
+
All response fields must use `lower_case_with_underscores`.
124
+
125
+
Responses must set the `Content-Type` header, as specified in the [Provider versioning](../provider/README.md#versioning) section. They must also specify the current API version being served in the JSON-formatted response body, under the `version` key.
126
+
127
+
Response bodies must be a `UTF-8` encoded JSON object.
128
+
129
+
### HTTP Response Codes
130
+
131
+
The response to a client request must include a valid HTTP status code defined in the [IANA HTTP Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
132
+
133
+
122
134
### GET /Jurisdictions
123
135
124
136
Gets all of an agency's Jurisdictions. Served by agencies.
@@ -150,7 +162,7 @@ Response codes:
150
162
- 404 - not found
151
163
- 500 - Server error
152
164
153
-
[Top](#table-of-contents)
165
+
[Top][toc]
154
166
155
167
## Flat Files
156
168
@@ -165,14 +177,15 @@ The publishing Agency should establish and communicate to interested parties how
165
177
166
178
The `updated` field in the payload wrapper should be set to the time of publishing a revision, so that it is simple to identify a changed file.
167
179
168
-
[Top](#table-of-contents)
180
+
[Top][toc]
169
181
170
182
## Examples
171
183
172
184
See the [Jurisdiction Examples](examples/README.md) for a sample `jurisdictions.json` file.
173
185
174
186
See the [Geography Examples](/geography/examples/README.md) for an example `geographies.json`.
Copy file name to clipboardExpand all lines: metrics/README.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,10 @@ The Metrics API endpoints are intended to be implemented by regulatory agencies,
10
10
11
11
-[General Information](#general-information)
12
12
-[Implementation](#implementation)
13
+
-[Authorization](#authorization)
13
14
-[Data Requirements](#data-requirements)
14
15
-[Beta Feature](#beta-feature)
15
16
-[Date and Time Format](#date-and-time-format)
16
-
-[Authorization](#authorization)
17
17
-[Data Redaction](#data-redaction)
18
18
-[Metrics Discovery API](#metrics-discovery-api)
19
19
-[Metrics Query API](#metrics-query-api)
@@ -58,6 +58,22 @@ Here are initial design use cases and scenarios for Metrics.
58
58
59
59
[Top][toc]
60
60
61
+
## Authorization
62
+
63
+
### For Agencies hosting the Metrics API
64
+
65
+
MDS Metrics endpoint producers **SHALL** provide authorization for API endpoints via a bearer token based auth system. When making requests, the endpoints expect 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. [JSON Web Token](/general-information.md#json-web-tokens) is the recommended format.
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
+
61
77
## Data Requirements
62
78
63
79
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,20 +98,6 @@ All interval durations (duration) are [ISO 8601](https://en.wikipedia.org/wiki/I
82
98
83
99
[Top][toc]
84
100
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 [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.
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
-
[Top][toc]
98
-
99
101
## Data Redaction
100
102
101
103
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).
Copy file name to clipboardExpand all lines: policy/README.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,13 @@ This specification describes the digital relationship between _mobility as a ser
10
10
11
11
-[General information](#general-information)
12
12
-[Background](#background)
13
+
-[Authorization](#authorization)
13
14
-[Update Frequency](#update-frequency)
14
15
-[Updating or Ending Policies](#updating-or-ending-policies)
15
16
-[Versioning](#versioning)
16
17
-[Distribution](#distribution)
17
18
-[REST Endpoints](#rest-endpoints)
18
19
-[Responses and Error Messages](#responses-and-error-messages)
19
-
-[Authorization](#authorization)
20
20
-[Policies](#policies)
21
21
-[Query Parameters](#query-parameters)
22
22
-[Geographies](#geographies)
@@ -71,6 +71,10 @@ The machine-readable format allows Providers to obtain policies and compute comp
71
71
72
72
[Top][toc]
73
73
74
+
### Authorization
75
+
76
+
This endpoint should be made public. Authorization is not required.
77
+
74
78
### Update Frequency
75
79
76
80
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
127
131
128
132
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.
129
133
130
-
### Authorization
131
-
132
-
This endpoint should be made public. Authorization is not required.
Copy file name to clipboardExpand all lines: provider/README.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ This specification contains a data standard for *mobility as a service* provider
9
9
## Table of Contents
10
10
11
11
*[General Information](#general-information)
12
+
*[Authorization](#authorization)
12
13
*[Versioning](#versioning)
13
14
*[Modes](#modes)
14
15
*[Responses and Error Messages](#responses-and-error-messages)
@@ -37,12 +38,20 @@ This specification contains a data standard for *mobility as a service* provider
37
38
38
39
## General Information
39
40
40
-
The following information applies to all `provider` API endpoints. Details on providing authorization to endpoints is specified in the [auth](auth.md) document.
41
+
The following information applies to all `provider` API endpoints.
41
42
42
43
This specification uses data types including timestamps, UUIDs, and vehicle state definitions as described in the MDS [General Information][general-information] document.
43
44
44
45
[Top][toc]
45
46
47
+
### Authorization
48
+
49
+
MDS Provider endpoint producers **SHALL** provide authorization for API endpoints via a bearer token based auth system. When making requests, the endpoints expect `provider_id` to be part of the 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. [JSON Web Token](/general-information.md#json-web-tokens) is the recommended format.
50
+
51
+
General authorization details are specified in the [Authorization section](/general-information.md#authorization) in MDS General Information.
52
+
53
+
[Top][toc]
54
+
46
55
### Versioning
47
56
48
57
`provider` APIs must handle requests for specific versions of the specification from clients.
0 commit comments