Closed artiomchi closed 7 years ago
Why are you loading the MVC client and IdSvr in the same host? Doing this it looks like you want the MVC client to use the same cookie as IdSvr. Normally the MVC client issues its own cookie from the OIDC authentication result. I feel like I'm missing some context to your problem.
@brockallen well, in my project I've got IdSrv and the MVC app in the same host, but that's a separate discussion.
The issue above uses the sample project in your repo (specifically the QuickStart #6), with minimal adjustments. In there, the IdSrv and the MVC client are separate projects. But if I try to use the IdSrv middleware in a subpath, it doesn't work well.
Ultimately, as I understand, most Owin middleware should handle running under a subpath just fine, so that seems like an issue with IdentityServer4.
If you want IdentityServer to run under a Map, that's fine -- it's just that the redirects will be relative to that mapped path. So this means your MVC code for the UI must respond to those correct paths.
So going over the quockstarts once again, and delving more into this, I think I have a slightly clearer view on the situation.
What I'm trying to achieve is to have a web app that users can log in into using ASP.NET Identity (basic local logins), but also host IdentityServer in that app so that it can be the OpenID Connect Authority for the API (and a couple other sites).
For several reasons, when I did this previously, the authority was hosted under a subpath (~/auth/), so I'm trying to replicated that in the migration from ASP.NET to AspNetCore. I'm also trying to have the app have only a single login page (/Account/Login) instead of having two login pages, one for the local login, and one used by the IdentityServer.
What I was hoping to get is have the IdentityServer discovery document be hosted under /auth/.well-known/openid-configuration
, but have it use the existing login page at /Account/Login
My initial attempt was to run IS under a Map, but that screws with the base uri inside IS (is that really necessary?). So maybe there's a different way to achieve what I'm trying to do?
Are you putting MVC in the pipeline twice (once under ~/auth and once under ~/)? Not sure if that's somehow messing with things. MVC is not designed to be in the pipeline twice (from what MSFT has said).
Any update on the issue? closing for now - feel free to re-open if it needs further discussion.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Issue / Steps to reproduce the problem
I'm upgrading an older MVC 5 app to .NET Core, and as part of that upgrading IS3 to IS4. Because of the way it worked (and following guidelines at the time), IdentityServerwas regustered under a subpath (
/auth
). Since I have existing customers authenticating with the app, I want to register IS4 under the same path, to keep compatibility, and not break integrations.I've registered it as follows:
This causes a "idp claim is missing" error, mentioned in #277. Following that discussion, I've been told that
UseIdentityServer()
should be called before the call toUseMvc()
. Since I'm in a subpath, I've been told to callUseMvc()
there as well. I've filtered it to the connect controller, so that it doesn't clash with regular controllers, and I got this:The issue is that the redirects from within IS4 think that the whole website is running under
/auth
. Specifically, when it tries to redirect to the login page, it instead redirects to/auth/account/login
. I've tracked it a little, and I believe that's due to what BaseUrlMiddleware is doing.Relevant parts of the log file
The log isn't much helpful, but it shows the request flow when I'm trying to authenticate. I've copied below the Information lines from the log to display the top level flow, and attached the rest of the log (only contains this request, but has debug lines): identityserver4_log.txt