Azure / Azure/azure-functions-openapi-extension

OpenApiSecurity Decorator, Multiple Authentication Types

Open
#427 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

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:
``` c#
[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.
``` yaml
security: # function_key OR user_auth_header
- function_key
- user_auth_header
```
Is there any way how can I configure AND operator like:
``` yaml
security: # function_key AND user_auth_header
- function_key
user_auth_header
```

Contributor guide

Open the contributing guide

Research direction

Start with the OpenApiSecurity attribute behavior and the generated YAML shown in the issue. Check how multiple security requirements are represented in the OpenAPI document, then determine how the attribute configuration should express an AND relationship. Done means the generated security section can represent both function_key and user_auth_header as required together, while preserving the existing OR behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.