Я создал простой Identity Server и теперь пытаюсь аутентифицировать приложение .Net Core. Даже после настройки Startup.cs, когда я запускаю решение, система все еще перемещается в / Account / Login;Я ожидаю, что система перейдет на Identity Server.
Ниже приведен мой код Startup.cs.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultAuthenticateScheme = "oidc";
}).AddCookie(options =>
{
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
options.Cookie.Name = "identitycookie";
}).AddOpenIdConnect("oidc", options =>
{
options.Authority = "https://localhost:44123/identity";
options.ClientId = "wp7jfcxEHaRE8DUIZka";
options.ResponseType = "id_token token";
options.SaveTokens = true;
options.SignInScheme = "Cookies";
options.Configuration = new OpenIdConnectConfiguration
{
AuthorizationEndpoint =
"https://localhost:44123/identity/connect/authorize",
TokenEndpoint =
"https://localhost:44123/identity/connect/token"
};
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseAuthentication();
app.UseMvc();
}
Может кто-нибудь сообщить мне, что я делаю неправильно.
Заранее спасибо