This commit is contained in:
Neha Gupta 2022-08-09 12:40:04 -07:00 коммит произвёл GitHub
Родитель 22755731bb
Коммит 4a957e8918
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 19 добавлений и 17 удалений

Просмотреть файл

@ -20,8 +20,7 @@
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.1.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.26.1" />
<PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.9.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="4.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
</ItemGroup>

Просмотреть файл

@ -8,7 +8,6 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using ServerlessLibrary.OAuth.GitHub;
using Swashbuckle.AspNetCore.Swagger;
using System.Threading.Tasks;
namespace ServerlessLibrary
@ -36,7 +35,8 @@ namespace ServerlessLibrary
.AddOAuth<GitHubAuthenticationOptions, GitHubAuthenticationHandler>(
GitHubAuthenticationDefaults.AuthenticationScheme,
GitHubAuthenticationDefaults.DisplayName,
options => {
options =>
{
options.ClientId = Configuration["Authentication:GitHub:ClientId"]; // these settings need to be present in appSettings (or in secrets.json)
options.ClientSecret = Configuration["Authentication:GitHub:ClientSecret"];
});
@ -49,14 +49,15 @@ namespace ServerlessLibrary
configuration.RootPath = "ClientApp/build";
});
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info
{
Title = "ASP.NET Core 2.0 Web API",
Version = "v1"
});
});
// ToDo: re-enable swagger
//services.AddSwaggerGen(c =>
//{
// c.SwaggerDoc("v1", new Info
// {
// Title = "ASP.NET Core 2.0 Web API",
// Version = "v1"
// });
//});
services.AddSingleton<ICacheService, CacheService>();
services.AddSingleton<ILibraryStore, CosmosLibraryStore>();
@ -70,11 +71,13 @@ namespace ServerlessLibrary
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Serverless library API v1");
c.RoutePrefix = "swagger";
});
// ToDo: Re-enable swagger
//app.UseSwaggerUI(c =>
//{
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "Serverless library API v1");
// c.RoutePrefix = "swagger";
//});
app.UseAuthentication();