Skip to content
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

"type" is missing from security definition #5005

Open
ildar945k opened this issue Oct 22, 2024 · 0 comments
Open

"type" is missing from security definition #5005

ildar945k opened this issue Oct 22, 2024 · 0 comments

Comments

@ildar945k
Copy link

Having this code with security setting:

    services.AddOpenApiDocument((configure, provider) =>
          {
              configure.Title = name;
              configure.Description = name;
              configure.Version = "1.0.0";
              configure.UseControllerSummaryAsTagDescription = true;
              configure.AddSecurity("oauth2", new OpenApiSecurityScheme
              {
                  Name = "Authorization",
                  Type = OpenApiSecuritySchemeType.ApiKey,
                  Description = "The Identity Server will return an access token; this should be added to every request, using the Authorization header with the Bearer scheme.",
                  In = OpenApiSecurityApiKeyLocation.Header,
                  ExtensionData = new Dictionary<string, object>
                  {
                      { "x-amazon-apigateway-authtype", "cognito_user_pools" },
                      {
                          "x-amazon-apigateway-authorizer", new Dictionary<string, object> {
                              { "providerARNs", new []{ "${user_pool_arn}" } },
                              { "identitySource", "method.request.header.Authorization" },
                              { "type" , "cognito_user_pools" },
                          }
                      },
                  },
                });
    });

Results in such open api file:

securitySchemes:
  oauth2:
    type: apiKey
    description: The Identity Server will return an access token; this should be added to every request, using the Authorization header with the Bearer scheme.
    name: Authorization
    in: header
    x-amazon-apigateway-authtype: cognito_user_pools
    x-amazon-apigateway-authorizer:
      providerARNs:
      - ${user_pool_arn}
      identitySource: method.request.header.Authorization

i wonder why { "type" , "cognito_user_pools" } is missing from api scec? it is required field for aws api gw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant