Created
October 15, 2020 07:54
-
-
Save umayeras/decdcc38abceb8c25e38ec7ea2d3ff22 to your computer and use it in GitHub Desktop.
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
services.AddSwaggerGen(c => | |
{ | |
c.SwaggerDoc("v1", new OpenApiInfo | |
{ | |
Version = "v1", | |
Title = "Web Api Swagger", | |
Description = "Sample ASP.NET Core Web API Swagger implementation", | |
Contact = new OpenApiContact | |
{ | |
Name = "Umay ERAS", | |
Email = "umayeras@hotmail.com", | |
Url = new Uri("http://umayeras.com"), | |
}, | |
License = new OpenApiLicense | |
{ | |
Name = "Use under MIT", | |
Url = new Uri("https://license-url"), | |
}, | |
}); | |
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme | |
{ | |
Description = "JWT Authorization header using the Bearer scheme. Example: \"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