Skip to content

Instantly share code, notes, and snippets.

@vmandic
Created May 23, 2019 13:28
Show Gist options
  • Save vmandic/b590744cce2c1aec35c7e7f1bfbccff0 to your computer and use it in GitHub Desktop.
Save vmandic/b590744cce2c1aec35c7e7f1bfbccff0 to your computer and use it in GitHub Desktop.
meds-processor, part/4, snippet #18
services.AddSwaggerGen(opts =>
{
opts.SwaggerDoc(
"v1-0",
new Info
{
Title = "HZZO meds-processor v1.0",
Version = "1.0"
});
// Setup swagger to use msbuild documentation:
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
opts.IncludeXmlComments(xmlPath);
opts.AddSecurityDefinition("Bearer", new ApiKeyScheme
{
In = "header",
Description = "Please insert JWT with Bearer into field",
Name = "Authorization",
Type = "apiKey"
});
opts.AddSecurityRequirement(new Dictionary<string, IEnumerable<string>>
{ { "Bearer", new string[] { } }
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment