azure-functions-openapi-extension icon indicating copy to clipboard operation
azure-functions-openapi-extension copied to clipboard

OpenApiSecurity Decorator, Multiple Authentication Types

Open aceniko opened this issue 3 years ago • 1 comments

According to the swagger documentation, there is a possibility to use multiple authentication types by combining the security requirements using a logical OR / AND operator. If I set two OpenApiSecurity attributes, i.e:

[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiSecurity("user_auth_header", SecuritySchemeType.Http, Scheme = OpenApiSecuritySchemeType.Bearer, BearerFormat = "JWT", Name = "Authorization")]

the security schema of generated yaml will look like the logical OR is always used.

security:    # function_key OR user_auth_header
  - function_key
  - user_auth_header

Is there any way how can I configure AND operator like:

security:    # function_key AND user_auth_header
  - function_key 
    user_auth_header

aceniko avatar Apr 27 '22 22:04 aceniko

I would love if someone shows me the postman call to test:

[OpenApiSecurity("user_auth_header", SecuritySchemeType.Http, Scheme = OpenApiSecuritySchemeType.Bearer, BearerFormat = "JWT", Name = "Authorization")]

DBJDBJ avatar Jul 19 '22 08:07 DBJDBJ