POS_Sprint_3 #5
@ -42,6 +42,27 @@ namespace Serwer.Api
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Serwer.Api", Version = "v1" });
|
||||
var jwtSecurityScheme = new OpenApiSecurityScheme
|
||||
{
|
||||
Scheme = "bearer",
|
||||
BearerFormat = "JWT",
|
||||
Name = "JWT Authentication",
|
||||
In = ParameterLocation.Header,
|
||||
Type = SecuritySchemeType.Http,
|
||||
Description = "Put **_ONLY_** your JWT Bearer token on textbox below!",
|
||||
|
||||
Reference = new OpenApiReference
|
||||
{
|
||||
Id = JwtBearerDefaults.AuthenticationScheme,
|
||||
Type = ReferenceType.SecurityScheme
|
||||
}
|
||||
};
|
||||
|
||||
c.AddSecurityDefinition(jwtSecurityScheme.Reference.Id, jwtSecurityScheme);
|
||||
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||
{
|
||||
{ jwtSecurityScheme, Array.Empty<string>() }
|
||||
});
|
||||
});
|
||||
|
||||
var hostEnviroment = new HostEnviroment { RootPath = WebRootPath };
|
||||
|
Loading…
Reference in New Issue
Block a user