How to restart Partial Login mechanism in Identity Server 3

798 Views Asked by At

Hi everyone

Summary:

Our project that we develop uses Identity Server 3 in conjunction with MembershipReboot. We have next login workflow:

  1. Login page (email, password)
  2. Some custom User Service has override PostAuthenticateLocalAsync (layer after validation user credentials and before being issued a login cookie for IdentityServer) method which has our business and validation logic. This logic redirects the user to additional page via AuthenticateResult and triggers Partial Login mechanism (Partial SignIn Authentication Type)
  3. After success Partial Login passage (via GetPartialLoginResumeUrlAsync) and another login process User gets token.

This is all good work and we are happy, but here comes the problem when we need new case.

Question:

Our new case requires to restart login process but after Login page, that is from the moment PostAuthenticateLocalAsync. User does not have to reauthorize and enter credential and go directly to step 2. In other words, we want to get Partial Login again. How can we do this?

I will be very grateful for any advice and help. Thanks.

1

There are 1 best solutions below

1
On

You should probably look into implementing your own ICustomRequestValidator.ValidateAuthorizeRequestAsync and examine the incoming request. If it turns out you want to re-authenticate, you could do something like return Task.FromResult(new AuthorizeRequestValidationResult { IsError = true });