OpenAPITools / OpenAPITools/openapi-generator

[REQ] [typescript-angular]: Support securityScheme type 'openIdConnect' like type 'oauth2' is already supported

Open
#4,406 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Client: TypeScript Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

Support securityScheme type 'openIdConnect' like type 'oauth2' is already supported.

If your securitrySchemes includes something like:

    "securitySchemes": {
      "oAuth2Flows": {
        "type": "oauth2",
        "flows": {
          "implicit": {
            "authorizationUrl": "${KEYCLOAK_BASE_URL}/auth/realms/zap/protocol/openid-connect/auth",
            "scopes": {
              "openid": "description"
            }
          }
        }
      }

openapi-generator emits the following inside API calls:

        // authentication (oAuth2Flows) required
        if (this.configuration.accessToken) {
            const accessToken = typeof this.configuration.accessToken === 'function'
                ? this.configuration.accessToken()
                : this.configuration.accessToken;
            headers = headers.set('Authorization', 'Bearer ' + accessToken);
        }

This is all right, as the client needs to send the (OAuth2) bearer token to the server.

However, for the type 'openIdConnect', the code is not generated.

    "securitySchemes": {
      "kcqs": {
        "type": "openIdConnect",
        "openIdConnectUrl": "\${KEYCLOAK_BASE_URL}/auth/realms/zap/.well-known/openid-configuration"
      }
    }

Result:

        // authentication (kcqs) required
        // nothing follows

Describe the solution you'd like

The very same code must be generated for type 'openIdConnect' and type 'oauth2'.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by locating the typescript-angular generator code that emits the shown authentication block, then compare its oauth2 and openIdConnect handling. Verify generated API calls for an openIdConnect security scheme emit the bearer-token block rather than “nothing follows.”

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, openapi, typescript
Domain
api, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.