Created
June 4, 2020 17:08
-
-
Save EdCharbeneau/d7c5112033ac7e37f308d92c5d2755a4 to your computer and use it in GitHub Desktop.
Swagger Authorization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme | |
{ | |
Description = | |
"JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below.\r\n\r\nExample: \"Bearer 12345abcdef\"", | |
Name = "Authorization", | |
In = ParameterLocation.Header, | |
Type = SecuritySchemeType.ApiKey, | |
Scheme = "Bearer" | |
}); | |
c.AddSecurityRequirement(new OpenApiSecurityRequirement() | |
{ | |
{ | |
new OpenApiSecurityScheme | |
{ | |
Reference = new OpenApiReference | |
{ | |
Type = ReferenceType.SecurityScheme, | |
Id = "Bearer" | |
}, | |
Scheme = "oauth2", | |
Name = "Bearer", | |
In = ParameterLocation.Header, | |
}, | |
new List<string>() | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment