10

I wish to customize the IdentityServer 4 and use custom pages for login / registration / lost password / etc... ( FYI, I use Blazor, but it should be the same ! ).

Example By example, for now, I use the following code:

Challenge(authProps, "oidc");

But it redirects to a pre-defined login page, how can I change this?

Information I have searched for some information, I have seen that some peoples use the following

.UserInteraction.LoginUrl = "http://..../MyLoginPage";

My problem is that I use abp.io, they provides an IdentityServer, but I have no access to the AddIdentityServer code, it is hardcoded somewhere and I have no access to it (AbpIdentityServerDomainModule.cs) !

So, I'm looking for a way to redefine the login page !

ClubberLang
  • 1,624
  • 3
  • 21
  • 45

2 Answers2

7

Just add the following in the Startup.cs

services.ConfigureApplicationCookie(config =>
{
    config.Cookie.Name = "IdentityServer.Cookie";
    config.LoginPath = "/Auth/Login";
    config.LogoutPath = "/Auth/Logout";
});
Edi
  • 1,900
  • 18
  • 27
  • What about using a custom Angular page for login? – Jack Jan 21 '21 at 13:07
  • It does not matter. You can have an API endpoint that maps this route to your function, then you can query the route with fetch or something like that. – Edi Jan 22 '21 at 12:13
  • Any example please? Thanks in advance. – Jack Jan 22 '21 at 12:28
  • 2
    For example you can make an action in a controller like: [Route("Auth/Login")] [HttpPost] public async IActionResult Foo(@Params) { // code logic } Then you can access this from your client side as : http.post('host:port/Auth/Login', {username, password}) – Edi Jan 23 '21 at 15:37
6

You can solve your problem by implementing Scaffolding.

Identity server doc says "Applications that include Identity can apply the scaffolder to selectively add the source code contained in the Identity Razor Class Library (RCL). You might want to generate source code so you can modify the code and change the behavior."

So you can change UI, end point and its behavior as your need.

Here is doc link

Sam Dan
  • 169
  • 2
  • 6