Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IdentityServer 4, how to add Custom Login page

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 !

like image 655
ClubberLang Avatar asked Jan 05 '20 11:01

ClubberLang


People also ask

How do I create an identity server?

Creating the quickstart IdentityServerStart by creating a new ASP.NET Core project. Then select the “Empty Web” option. IdentityServer currently only targets ASP.NET Core 1.1. IdentityServer uses the usual pattern to configure and add services to an ASP.NET Core host.

Is IdentityServer paid?

The new Duende IdentityServer continues to be open source, but now has a dual license. This license allows it to be used for free for development, testing, and learning, free for non-commercial open source, and free for use in commercial settings if the entity or organization makes less than 1 million USD/year.

What is Idsrv session?

In addition to the authentication cookie, IdentityServer will issue an additional cookie which defaults to the name “idsrv. session”. This cookie is derived from the main authentication cookie, and it used for the check session endpoint for browser-based JavaScript clients at signout time.


2 Answers

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

like image 77
Sam Dan Avatar answered Oct 18 '22 01:10

Sam Dan


Just add the following in the Startup.cs

services.ConfigureApplicationCookie(config =>
{
    config.Cookie.Name = "IdentityServer.Cookie";
    config.LoginPath = "/Auth/Login";
    config.LogoutPath = "/Auth/Logout";
});
like image 4
Edi Avatar answered Oct 18 '22 01:10

Edi