Finbuckle / Finbuckle.MultiTenant

Finbuckle.MultiTenant is an open-source multitenancy middleware library for .NET. It enables tenant resolution, per-tenant app behavior, and per-tenant data isolation.
https://www.finbuckle.com/multitenant
Apache License 2.0
1.25k stars 255 forks source link

Cookies and Identity Server #842

Open goforebroke opened 2 weeks ago

goforebroke commented 2 weeks ago

Hi Andrew,

Having problems logging into identity server after a tenant identifier is updated by a user. I am hoping to get some guidance/assistance

When a new tenant is created an identifier is automatically created for them. I allow tenants to update their identifier. Once their identifier is updated the user can initiate a logout, which logs them out and redirects them to the start page with the updated identifier in the url.

e.g user is logged in with this url

http://appurl/1B8E302B-B931-4CAE-B404-A42B7D1E8895/Dashboard/Settings/Identifier

user then updates their identifier to "ABC" and initiates a logout. The user is then redirected to this url

http://appurl/ABC

At this point the user then tries to log back in, but instead of logging into identity server with the new identifier

http://identityserver/abc

the user is redirected to identity server with the old url

http://identityserver/1B8E302B-B931-4CAE-B404-A42B7D1E8895

resulting in invalid redirect uri error in identity server since the urls dont match...."ABC" does not match "1B8E302B-B931-4CAE-B404-A42B7D1E8895"

I suspect it has to do with the identity server session created with the first login prior to updating the identifier?

My signout code in the application

public IActionResult OnGet()
{
      var redirectUri = Url.Page("/", null, null, Request.Scheme);
       return SignOut(new AuthenticationProperties() 
      { 
                RedirectUri = redirectUri
       }, CookieAuthenticationDefaults.AuthenticationScheme,
                OpenIdConnectDefaults.AuthenticationScheme);
}

Any help appreciated.

AndrewTriesToCode commented 6 days ago

Hi friend. I haven’t forgotten you. I’m catching up on things and will take a look. Have you made any progress in the mean time?

goforebroke commented 3 days ago

Hi Andrew,

At this time no, but I currently have a work around.