Skip to content

Commit 5f6aab6

Browse files
m-mohrsoxofaan
andauthored
Migrate from openEO-specific tokens to JWT #558 (#567)
* Migrate from openEO-specific tokens to JWT #558 Co-authored-by: Stefaan Lippens <[email protected]>
1 parent 7483918 commit 5f6aab6

File tree

2 files changed

+65
-40
lines changed

2 files changed

+65
-40
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Added `stacktrace` to log entries (e.g. for `GET /jobs/{job_id}/logs`) [#512](https://github.com/Open-EO/openeo-api/issues/512)
1818
- Added `version` property to `GET /processes` [#517](https://github.com/Open-EO/openeo-api/issues/517)
1919
- Added `queued`, `started` and `unpublished` to the batch job metadata and the corresponding STAC results [#542](https://github.com/Open-EO/openeo-api/issues/542)
20-
- Added all the batch job timestamps (including the new timestamps above) to the Collection type of batch job results
2120
- Added a status diagram that explains the status changes of batch jobs [#436](https://github.com/Open-EO/openeo-api/issues/436)
21+
- Added all the batch job timestamps (including the new timestamps above) to the Collection type of batch job results
22+
- Support for standard JSON Web Tokens (JWT) being used as Bearer tokens [#558](https://github.com/Open-EO/openeo-api/issues/558)
23+
24+
### Deprecated
25+
26+
- Deprecated the openEO-specific Bearer token format (authentication mechanism/provider id/access token) [#558](https://github.com/Open-EO/openeo-api/issues/558)
27+
28+
### Changed
29+
30+
- Migrate from openEO-specific tokens to JWT, i.e. deprecating the openEO-specific format in favor of JWT [#558](https://github.com/Open-EO/openeo-api/issues/558)
2231

2332
### Deprecated
2433

openapi.yaml

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,18 +1909,7 @@ paths:
19091909
openEO clients MUST use the **access token** as part of the Bearer token
19101910
for authorization in subsequent API calls (see also the information
19111911
about Bearer tokens in this document). Clients MUST NOT use the id token
1912-
or the authorization code. The access token provided by an OpenID Connect
1913-
Provider does not necessarily provide information about the issuer (i.e. the
1914-
OpenID Connect provider) and therefore a prefix MUST be added to the Bearer
1915-
Token sent in subsequent API calls to protected endpoints. The Bearer
1916-
Token sent to protected endpoints MUST consist of the authentication
1917-
method (here `oidc`), the provider ID and the access token itself. All
1918-
separated by a forward slash `/`. The provider ID corresponds to the
1919-
value specified for `id` for each provider in the response body of this
1920-
endpoint. The header in subsequent API calls for a provider with `id`
1921-
`ms` would look as follows: `Authorization: Bearer oidc/ms/TOKEN`
1922-
(replace `TOKEN` with the actual access token received from the OpenID
1923-
Connect Provider).
1912+
or the authorization code.
19241913
19251914
Back-ends MAY request user information ([including Claims](https://openid.net/specs/openid-connect-core-1_0.html#Claims))
19261915
from the [OpenID Connect Userinfo endpoint](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo)
@@ -1959,14 +1948,15 @@ paths:
19591948
properties:
19601949
id:
19611950
type: string
1962-
description: >-
1963-
A per-back-end **unique** identifier for the OpenID Connect Provider to
1964-
be as prefix for the Bearer token.
1951+
description: |-
1952+
A per-back-end **unique** identifier for the OpenID Connect provider.
1953+
1954+
Is used as prefix for the openEO token.
19651955
pattern: '[\d\w]{1,20}'
19661956
issuer:
19671957
type: string
19681958
format: uri
1969-
description: >-
1959+
description: |-
19701960
The [issuer location](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig)
19711961
(also referred to as 'authority' in some client libraries) is the URL of the
19721962
OpenID Connect provider, which conforms to a set of rules:
@@ -1980,7 +1970,6 @@ paths:
19801970
OpenID Connect.
19811971
19821972
2. The URL MUST NOT contain a terminating forward slash `/`.
1983-
19841973
example: 'https://accounts.google.com'
19851974
scopes:
19861975
type: array
@@ -2133,27 +2122,20 @@ paths:
21332122
get:
21342123
summary: HTTP Basic authentication
21352124
operationId: authenticate-basic
2136-
description: >-
2125+
description: |-
21372126
Checks the credentials provided through [HTTP Basic Authentication
2138-
according to RFC 7617](https://www.rfc-editor.org/rfc/rfc7617.html) and returns
2139-
an access token for valid credentials.
2140-
2127+
according to RFC 7617](https://www.rfc-editor.org/rfc/rfc7617.html) and
2128+
returns an access token in exchange for providing valid credentials.
21412129
21422130
The credentials (username and password) MUST be sent in the HTTP header
21432131
`Authorization` with type `Basic` and the Base64 encoded string
21442132
consisting of username and password separated by a double colon `:`. The
21452133
header would look as follows for username `user` and password `pw`:
21462134
`Authorization: Basic dXNlcjpwdw==`.
21472135
2148-
21492136
The access token has to be used in the Bearer token for authorization in
21502137
subsequent API calls (see also the information about Bearer tokens in
2151-
this document). The access token returned by this request MUST NOT be
2152-
provided with `basic//` prefix, but the Bearer Token sent in subsequent
2153-
API calls to protected endpoints MUST be prefixed with `basic//`. The
2154-
header in subsequent API calls would look as follows: `Authorization:
2155-
Bearer basic//TOKEN` (replace `TOKEN` with the actual access token).
2156-
2138+
this document).
21572139
21582140
It is RECOMMENDED to implement this authentication method for non-public
21592141
services only.
@@ -2174,9 +2156,8 @@ paths:
21742156
properties:
21752157
access_token:
21762158
description: >-
2177-
The access token (without `basic//` prefix) to be used in
2178-
the Bearer token for authorization in subsequent API
2179-
calls.
2159+
The access token to be used in the Bearer token for authorization
2160+
in subsequent API calls (without the custom `basic//` prefix).
21802161
type: string
21812162
example: b34ba2bdf9ac9ee1
21822163
4XX:
@@ -6820,14 +6801,49 @@ components:
68206801
Bearer:
68216802
type: http
68226803
scheme: bearer
6823-
bearerFormat: >-
6824-
The Bearer Token MUST consist of the authentication method, a provider
6825-
ID (if available) and the token itself. All separated by a forward slash
6826-
`/`. Examples (replace `TOKEN` with the actual access token): (1) Basic
6827-
authentication (no provider ID available): `basic//TOKEN` (2) OpenID
6828-
Connect (provider ID is `ms`): `oidc/ms/TOKEN`. For OpenID Connect, the
6829-
provider ID corresponds to the value specified for `id` for each
6830-
provider in `GET /credentials/oidc`.
6804+
bearerFormat: JWT or openEO
6805+
description: >-
6806+
A Bearer token can be provided in two different formats:
6807+
6808+
1. **JSON Web Token (JWT) - RECOMMENDED**
6809+
6810+
- Conformance class: `https://api.openeo.org/1.2.0/authentication/jwt`
6811+
6812+
The Bearer token is an access token in [JWT](https://datatracker.ietf.org/doc/html/rfc7519) format
6813+
as defined in RFC 7519. For openEO, it MUST include the issuer in the
6814+
`iss` claim although being optional in RFC 7519.
6815+
If the concept of an issuer does not exist in an authentication method (e.g. in HTTP Basic),
6816+
implementations could use the endpoint for Basic Authentication as the issuer, for example.
6817+
6818+
openEO backend implementations MUST signal their support for JWT by listing the given
6819+
conformance class. Likewise, openEO clients SHOULD only use JWT when the openEO backend
6820+
lists the conformance class.
6821+
6822+
2. **openEO Tokens - DEPRECATED**
6823+
6824+
- Conformance class: *None*
6825+
6826+
The Bearer Token is constructed from the authentication method, a
6827+
provider ID (if available) and the access token. All separated by a
6828+
forward slash `/`.
6829+
6830+
Examples (replace `TOKEN` with the actual access token):
6831+
6832+
- Basic authentication (no provider ID available): `basic//TOKEN`
6833+
- OpenID Connect (provider ID is `ms`): `oidc/ms/TOKEN`.
6834+
For OpenID Connect, the provider ID corresponds to the value
6835+
specified for `id` for each provider in `GET /credentials/oidc`.
6836+
6837+
All openEO backends MUST accept this method for backward compatibility
6838+
until version 2.0 of the specification.
6839+
6840+
The access tokens provided by the identity provider do not include
6841+
the prefix that includes the authentication method and provider ID.
6842+
The Bearer Token sent to the openEO backend MUST have the prefix, e.g. `basic//` for Basic authentication.
6843+
This means that the clients have to prepend the prefix.
6844+
6845+
JWT and openEO tokens can be distinguished by the presence of a slash
6846+
`/` in the token, which JWT can never contain due to the Base64 encoding.
68316847
Basic:
68326848
type: http
68336849
scheme: basic

0 commit comments

Comments
 (0)