Skip to content

vertx-openapi contradicts vertx-auth-oauth2 #122

Description

@shihb

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

     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
    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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions