将IdentityServer4映射到“ / identity”,然后映射UI

Gab*_*ert 5 asp.net-core-mvc identityserver4

我的应用程序基本上就是这个应用程序:https : //github.com/IdentityServer/IdentityServer4.Quickstart.UI

但是我正在尝试使用以下代码将其映射到“ / identity”:

app.Map("/identity", builder => { builder.UseIdentityServer(); });
Run Code Online (Sandbox Code Playgroud)

运行良好,我可以/identity/.well-known/openid-configuration成功访问。

但是,如果我尝试连接,则应用程序会将我重定向到/identity/account/loginIdentityServer一侧的。IdentityServer找不到我的控制器,因此返回404。

我尝试了LoginUrl属性:

services.AddIdentityServer(options =>
{
    options.UserInteraction.LoginUrl = "/bleh/account/login";
})
Run Code Online (Sandbox Code Playgroud)

但它也会返回404。

我还尝试使Quickstart控制器路由与重定向路由相同:

[Route("identity/account/login")]
Run Code Online (Sandbox Code Playgroud)

但它也会返回404。

任何的想法?

小智 6

如果有人还在寻找这个。这为我工作:

app.Map("/identity", builder => {
    builder.UseStaticFiles();
    builder.UseIdentityServer();
    builder.UseMvcWithDefaultRoute();
});
Run Code Online (Sandbox Code Playgroud)