-
Notifications
You must be signed in to change notification settings - Fork 2
chore(other): align cafe api description with dcr rfc7591 and oauth2 rfc6749 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0ec2d4f
cd3b893
b88e51e
6f4cae9
4e514e2
1c60d01
7621def
8991378
85b9d26
a56d098
c264ace
f31ba06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # This file instructs Redocly's linter to ignore the rules contained for specific parts of your API. | ||
| # See https://redocly.com/docs/cli/ for more information. | ||
| openapi/paths/oauth2_register_{clientId}.yaml: | ||
| no-invalid-media-type-examples: | ||
| - >- | ||
| #/put/requestBody/content/application~1json/examples/UpdateClient/dataValue/client_id |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: clientId | ||
| in: path | ||
| required: true | ||
| description: The client identifier issued at registration. | ||
| schema: | ||
| type: string | ||
| example: client_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| description: | | ||
| OAuth2 error (RFC 6749 Section 5.2 / RFC 7591 Section 3.2.2). | ||
| The `error` field carries the standard OAuth2 error code. | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: ../schemas/OAuthError.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| description: Unexpected server error, reported with the `server_error` error code. | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: ../schemas/OAuthError.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| description: | | ||
| Client authentication failed (`error: invalid_client`, RFC 6749 Section 5.2) | ||
| or the presented bearer token is invalid (`error: invalid_token`, RFC 6750). | ||
| The response carries a `WWW-Authenticate` challenge naming the expected | ||
| authentication scheme. | ||
| headers: | ||
| WWW-Authenticate: | ||
| description: Authentication challenge, e.g. `Basic realm="redocly-cafe"` or `Bearer realm="redocly-cafe", error="invalid_token"`. | ||
| schema: | ||
| type: string | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: ../schemas/OAuthError.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| type: object | ||
| description: OAuth2 authorization server metadata per RFC 8414. | ||
| properties: | ||
| issuer: | ||
| type: string | ||
| format: uri | ||
| description: The authorization server's issuer identifier. | ||
| authorization_endpoint: | ||
| type: string | ||
| format: uri | ||
| token_endpoint: | ||
| type: string | ||
| format: uri | ||
| registration_endpoint: | ||
| type: string | ||
| format: uri | ||
| description: Dynamic client registration endpoint (RFC 7591). | ||
| revocation_endpoint: | ||
| type: string | ||
| format: uri | ||
| description: Token revocation endpoint (RFC 7009). | ||
| scopes_supported: | ||
| type: array | ||
| items: | ||
| type: string | ||
| response_types_supported: | ||
| type: array | ||
| items: | ||
| type: string | ||
| response_modes_supported: | ||
| type: array | ||
| items: | ||
| type: string | ||
| grant_types_supported: | ||
| type: array | ||
| items: | ||
| type: string | ||
| token_endpoint_auth_methods_supported: | ||
| type: array | ||
| items: | ||
| type: string | ||
| revocation_endpoint_auth_methods_supported: | ||
| type: array | ||
| items: | ||
| type: string | ||
| code_challenge_methods_supported: | ||
| type: array | ||
| description: PKCE code challenge methods supported (RFC 7636). | ||
| items: | ||
| type: string | ||
| authorization_response_iss_parameter_supported: | ||
| type: boolean | ||
| description: Whether authorization responses carry the `iss` parameter (RFC 9207). | ||
| service_documentation: | ||
| type: string | ||
| format: uri | ||
| required: | ||
| - issuer | ||
| - authorization_endpoint | ||
| - token_endpoint | ||
| - response_types_supported |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,70 @@ | ||
| type: object | ||
| description: OAuth2 client registration response. Per RFC 7591, includes the client identifier, secret, timestamps, and all registered client metadata. | ||
| description: | | ||
| OAuth2 client information response per RFC 7591 Section 3.2.1, using the | ||
| standard snake_case field names. Returned by the registration endpoint and | ||
| the RFC 7592 client configuration endpoint. | ||
| properties: | ||
| clientId: | ||
| client_id: | ||
| type: string | ||
| description: Client identifier issued by the authorization server. | ||
| clientSecret: | ||
| client_secret: | ||
|
DmitryAnansky marked this conversation as resolved.
|
||
| type: string | ||
| description: Client secret issued by the authorization server. | ||
| clientIdIssuedAt: | ||
| description: Client secret issued by the authorization server. Store it securely. | ||
| client_id_issued_at: | ||
| type: integer | ||
| format: int64 | ||
| description: Time when the client_id is issued, represented as seconds since epoch (RFC7591). | ||
| clientSecretExpiresAt: | ||
| description: Time when the client_id is issued, represented as seconds since epoch (RFC 7591). | ||
| client_secret_expires_at: | ||
| type: integer | ||
| format: int64 | ||
| description: Time at which the client_secret expires, represented as seconds since epoch. 0 indicates the secret does not expire (RFC 7591). | ||
| name: | ||
| type: string | ||
| description: Client name (registered metadata). | ||
| redirectUris: | ||
| type: array | ||
| items: | ||
| type: string | ||
| format: uri | ||
| description: List of redirect URIs (registered metadata). | ||
| registrationClientUri: | ||
| registration_client_uri: | ||
| type: string | ||
| format: uri | ||
| description: URL of the client configuration endpoint for managing this client registration (RFC 7592). | ||
| registrationAccessToken: | ||
| registration_access_token: | ||
| type: string | ||
| description: Access token to be used at the client configuration endpoint for managing this client registration (RFC 7592). | ||
| scopes: | ||
| description: Bearer token for the client configuration endpoint (RFC 7592). Store it securely. | ||
| client_name: | ||
| type: string | ||
| description: Client name (registered metadata). Omitted for clients registered without a name. | ||
| redirect_uris: | ||
| type: array | ||
| items: | ||
| type: string | ||
| enum: | ||
| - menu:read | ||
| - menu:write | ||
| - orders:read | ||
| - orders:write | ||
| - revenue:read | ||
| description: List of scopes (registered metadata). | ||
| grantTypes: | ||
| format: uri | ||
| description: Registered redirect URIs. | ||
| grant_types: | ||
| type: array | ||
| items: | ||
| type: string | ||
| enum: | ||
| - authorization_code | ||
| - client_credentials | ||
| description: List of grant types (registered metadata). | ||
| - refresh_token | ||
| description: Registered grant types. | ||
| scope: | ||
| type: string | ||
| description: Space-separated registered scopes. | ||
| token_endpoint_auth_method: | ||
| type: string | ||
| enum: | ||
| - client_secret_basic | ||
| - client_secret_post | ||
| description: | | ||
| Registered token endpoint authentication method. Defaults to `client_secret_basic` | ||
| when not requested at registration (RFC 7591 Section 2). Informational: the token | ||
| and revocation endpoints accept both methods for every client regardless. | ||
| # client_name is the only conditional field: it is omitted for clients | ||
| # registered without a name. Everything else is always returned. | ||
| required: | ||
| - clientId | ||
| - clientSecret | ||
| - clientIdIssuedAt | ||
| - clientSecretExpiresAt | ||
| - registrationClientUri | ||
| - registrationAccessToken | ||
| - client_id | ||
| - client_secret | ||
| - client_id_issued_at | ||
| - client_secret_expires_at | ||
| - registration_client_uri | ||
| - registration_access_token | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not valid What RFC 7592 actually specifies: Section 2.1 (Read) and Section 2.2 (Update) both say, verbatim: "Some values in the response, including the client_secret and registration_access_token, MAY be different from those in the initial registration response." The RFC doesn't merely permit these fields in GET/PUT responses — it builds a feature on top of them: the server may rotate the secret or registration token during a read/update, and the response is how the client learns the new values. Omitting them would break that mechanism. So our GET/PUT responses (and OAuth2Client.yaml requiring those fields) are not a violation of §2.1 — they're an implementation of it. The contract tests validate exactly this shape. Where the reviewer likely went wrong: §2.2 does contain a MUST NOT, but it applies to the request: the update request must not include registration_access_token, registration_client_uri, client_id_issued_at, or client_secret_expires_at (and any included client_secret must match). We enforce that direction correctly. It's an easy sentence to misattribute to the response. |
||
| - redirect_uris | ||
| - grant_types | ||
| - scope | ||
|
DmitryAnansky marked this conversation as resolved.
|
||
| - token_endpoint_auth_method | ||
|
redocly[bot] marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| type: object | ||
| description: | | ||
| OAuth2 error response, as defined by RFC 6749 Section 5.2 (token endpoint), | ||
| RFC 7591 Section 3.2.2 (registration endpoint), and RFC 7009 (revocation endpoint). | ||
| The OAuth2 endpoints return this shape instead of the `application/problem+json` | ||
| format used by the rest of the API. | ||
| properties: | ||
| error: | ||
| type: string | ||
| description: Machine-readable error code. | ||
| enum: | ||
| - invalid_request | ||
| - invalid_client | ||
| - invalid_grant | ||
| - unauthorized_client | ||
| - unsupported_grant_type | ||
| - unsupported_response_type | ||
| - invalid_scope | ||
| - invalid_client_metadata | ||
| - invalid_redirect_uri | ||
| - invalid_token | ||
| - access_denied | ||
| - server_error | ||
|
DmitryAnansky marked this conversation as resolved.
|
||
| error_description: | ||
| type: string | ||
| description: Human-readable explanation of the error. | ||
| required: | ||
| - error | ||
Uh oh!
There was an error while loading. Please reload this page.