Add ProfileService to Startup services

This commit is contained in:
SunriseM 2020-10-03 12:38:01 -04:00
parent ad1c23ec43
commit 33638e1b68

View file

@ -8,6 +8,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using IdentityServer4.Services;
using IdentityServer.Services;
namespace SteamOpenIdConnectProvider namespace SteamOpenIdConnectProvider
{ {
@ -26,6 +28,8 @@ namespace SteamOpenIdConnectProvider
services.AddControllers() services.AddControllers()
.AddNewtonsoftJson() .AddNewtonsoftJson()
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0); .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
services.AddSingleton<IConfiguration>(Configuration);
services.AddDbContext<AppInMemoryDbContext>(options => services.AddDbContext<AppInMemoryDbContext>(options =>
options.UseInMemoryDatabase("default")); options.UseInMemoryDatabase("default"));
@ -51,6 +55,8 @@ namespace SteamOpenIdConnectProvider
.AddInMemoryPersistedGrants() .AddInMemoryPersistedGrants()
.AddDeveloperSigningCredential(true) .AddDeveloperSigningCredential(true)
.AddInMemoryIdentityResources(IdentityServerConfig.GetIdentityResources()); .AddInMemoryIdentityResources(IdentityServerConfig.GetIdentityResources());
services.AddScoped<IProfileService, ProfileService>();
services.AddAuthentication() services.AddAuthentication()
.AddCookie(options => .AddCookie(options =>