-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDependencyInjectionSwagger.cs
39 lines (36 loc) · 1.25 KB
/
DependencyInjectionSwagger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Microsoft.OpenApi.Models;
namespace DesafioBalta
{
public static class DependencyInjectionSwagger
{
public static IServiceCollection AddInfrastructureSwagger(this IServiceCollection services)
{
services.AddSwaggerGen(c =>
{
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme()
{
Name = "Authorization",
Type = SecuritySchemeType.ApiKey,
BearerFormat = "JWT",
In = ParameterLocation.Header,
Description = "JWT Token"
});
c.AddSecurityRequirement(new OpenApiSecurityRequirement()
{
{
new OpenApiSecurityScheme()
{
Reference = new OpenApiReference()
{
Type = ReferenceType.SecurityScheme,
Id = "Bearer"
}
},
new string[] {}
}
});
});
return services;
}
}
}