In my IdentityServer4
project I implement IProfileService
. The IsActiveAsync
method is invoked a number of times after the human-user has successfully authenticated through the login web-page when using Implicit and Hybrid flows.
I've noticed it's invoked when context.Caller
is one of these values:
AuthorizeEndpoint
(with the User's Claims)AuthorizationCodeValidation
(with the User's Claims)AccessTokenValidation
(without the User's Claims)
Due to a bug my code set context.IsActive = false
- and when this happened the web-browser which was used to get to the login-page was just redirected back to the login page with no error message or reason information. Users would be confused why they had successfully authenticated but prompted to login again. No new querystring parameters were added either.
The IdentityServer4
logs do display the reason:
[23:16:40 Information]
IdentityServer4.ResponseHandling.AuthorizeInteractionResponseGenerator
Showing login: User is not active
Now, supposing that my IsActive = false
code was not a bug, but was actually by-design (because, for example, the user's account really was disabled in the microseconds between different OAuth/OpenIDConnect HTTP requests), in which case how can I ensure this message is presented to the user and/or client software?