First of all, I know similar questions have been posted here before but hear me out. After all the posted solutions failed for me I am posting this. So the scenario is as follows: I have SAML integration in my ASP.Net Core 6.0 MVC Web Application. After authentication with the Service Provider, I am calling HttpContext.SignInAsync. I expect the name of the authenticated user (In my case the official email Id) to be returned. But I am getting an empty string. On IIS I have Anonymous and Windows Authentication set to true. When I disable Anonymous authentication as suggested in other solutions I can no longer reach the Controller that triggers SSO. And the browser starts prompting for Windows Credentials. Do let me know if more details are required I will share all that I can.
Asked
Active
Viewed 70 times
0
-
which `Service Provider` you are using for the authentication and it doesn't provide you a way to get the current user? For example, with Azure AD, user name can be get by [@User.Identity.Name](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/master/1-WebApp-OIDC/1-1-MyOrg/Views/Shared/_LoginPartial.cshtml#L7) – Tiny Wang Mar 14 '23 at 08:43
-
I am using Jumpcloud ... It returns a result object in the assertion URL which contains user's email address ... I use it to build a claims Principle with which I sign in ... HttpContext.SignInAsync("Cookies", principle); – Siddharth Seth Mar 14 '23 at 08:58
-
I'm sorry that I never heard about jumpcloud... so I don't have any idea about it. but I think this cloud service should provide with a way to get the signed-in user information. – Tiny Wang Mar 14 '23 at 09:32