I have an ASP.NET Core app which uses Mvc and OpenID Connect Auth.
In OpenID Events handler I want to handle the case when user declines consent screen on auth server, and I want to redirect the user to specific page, generating the redirect URL using router. I just don't like hardcoded URLs.
So, I had to implement the custom UseMvc method that returns IRouter back to calling method via out-parameter. Then I can save it to Startup method's property and use from every method inside it.
The problem is that my solutions seems incorrect to me, like there should be a simpler way to accomplish what I want. Just curious if someone could point me in right direction.
My code is here. The custom method I mentioned is here. And it is called there, so that the resolved router can be further used here.