-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #339 from raffacabofrio/master
Publicando .net core 3.1 em produção.
- Loading branch information
Showing
42 changed files
with
521 additions
and
385 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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
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
59 changes: 59 additions & 0 deletions
59
ShareBook/ShareBook.Api/Configuration/SwaggerConfiguration.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.OpenApi.Models; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace ShareBook.Api.Configuration | ||
{ | ||
public static class SwaggerConfiguration | ||
{ | ||
public static IServiceCollection RegisterSwagger(this IServiceCollection services) | ||
{ | ||
services.AddSwaggerGen(swagger => | ||
{ | ||
swagger.SwaggerDoc("v1", new OpenApiInfo | ||
{ | ||
Title = "SHAREBOOK API", | ||
Version = "v1", | ||
Description = "Open Source project", | ||
Contact = new OpenApiContact | ||
{ | ||
Name = "", | ||
Email = "", | ||
}, | ||
License = new OpenApiLicense | ||
{ | ||
Name = "MIT License", | ||
Url = new Uri("https://opensource.org/licenses/MIT") | ||
} | ||
}); | ||
swagger.ResolveConflictingActions(x => x.First()); | ||
swagger.AddSecurityDefinition("Bearer", | ||
new OpenApiSecurityScheme | ||
{ | ||
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", | ||
Name = "Authorization", | ||
In = ParameterLocation.Header, | ||
Type = SecuritySchemeType.ApiKey | ||
} | ||
); | ||
swagger.AddSecurityRequirement( | ||
new OpenApiSecurityRequirement { | ||
{ | ||
new OpenApiSecurityScheme | ||
{ | ||
Reference = new OpenApiReference | ||
{ | ||
Type = ReferenceType.SecurityScheme, | ||
Id = "Bearer" | ||
} | ||
}, | ||
new string[] { } | ||
} | ||
} | ||
); | ||
}); | ||
return services; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.