ClaimsPrinciple (logged in user) is being retained across browsers and logins
I have noticed the following behavior when using IndividualAccount authentication on a webapp hosted on Azure.
This only happens when hosted in Azure and I have not been able to replicate this behavior when debugging locally in VS.
Following steps to reproduce the behavior I am seeing: User 1 logins in on Browser 1 User 1 navigates to Contact page
User 2 logins in on Browser 2 User 2 navigates to Contact page User 2 Contact page shows User 1's details in LoginPartial Hit F5 to force refresh Contact page and LoginPartial now displays User 2's details
This was duplicated using the standard ASP.Net Core Web Application template in Visual Studio 2015 Update 3.
I have attached a repo with a sample project here.
@Tratcher any idea how this could happen?
Browser 1 and Browser 2 are just different tabs/windows for the same browser right? (e.g. both are Internet Explorer no). There's no user isolation across browser windows. It may be re-using resources cached on the client.
Another way to check this is to open the tabs in "InPrivate/Incognito" mode.
No this is across different browsers (eg. Chrome and Firefox), also been reproduced using different pc's.
Busy firing up a vm to determine if the issue is unique to Azure web apps.
:( I feel like an absolute chop!
Following on from Tratcher's comment, we've just determined that this only happens on the company network. So the local proxy must be caching the page somewhere and returning it for all requests as url's are not unique.
I'll leave this open until we confirm that the proxy is the issue
@Tratcher Is there a way to use the vary header when the user is authenticated to avoid proxies caching this content? I'm not saying that this should be on by default (A request by an authenticated user doesn't have to be answered with a response that contains content specific to that user) but I can see this being useful as something you can opt-in through a filter or something like that that you can put on the action to get this behavior.
Or at least a sample
I've added this filter to my Controller to prevent caching by the proxy.
[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
This seems to have solved the issue.
@danroth27 @HaoK We need to check what the default caching policy is for those pages in the template.
@blowdart
Its a partial view on the layout, so its "every page", in the first place it shouldn't be served through HTTP if it contains the user credentials and I would think that a proxy wouldn't cache it is HTTPS.
Happy to close, as Javier mentioned this does not happen over https only http and can be solved by adding the no-cache headers