eclipse-vertx / eclipse-vertx/vertx-openapi
vertx-openapi contradicts vertx-auth-oauth2
- Dominant language
- Java
- Stars
- 15
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the feature
# Vert.x OpenAPI 5.0.8 `application/x-www-form-urlencoded` Support Paradox
## Problem Background
The `MediaType` interface in Vert.x OpenAPI 5.0.8 only supports the following media types:
- `application/json` / `application/json; charset=utf-8`
- `multipart/form-data`
- `application/hal+json`
- `application/octet-stream`
- `text/plain`
**However, it does NOT support** `application/x-www-form-urlencoded`.
Meanwhile, the OAuth2 standard protocol (RFC 6749) specifies that token endpoints **MUST** use `application/x-www-form-urlencoded` format for submissions. This creates a contradiction:
- **vertx-openapi**: Does not support this media type, throws error on startup
I developed a token retrieval service using OpenAPI
Endpoint `/api/sys/oauth/client` type
```yaml
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ClientToken'
```
When using vertx-auth-oauth2 to retrieve a token, it requires `application/x-www-form-urlencoded` format
- **vertx-auth-oauth2** (OAuth2API): Follows the standard, uses `application/x-www-form-urlencoded`
OAuth2API class
```java
headers.put("Content-Type", "application/x-www-form-urlencoded");
final Buffer payload = SimpleHttpClient.jsonToQuery(form);
// specify preferred accepted content type
headers.put("Accept", "application/json,application/x-www-form-urlencoded;q=0.9");
return fetch(HttpMethod.POST, config.getTokenPath(), headers, payload)
```
vertx-openapi contradicts vertx-auth-oauth2
### Contribution
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.