0

I have a MVC project that users currently can log into automatically via their identity.

The users of this website can only log into their computers by using a smart card, therefor i simply use HttpContext.User.Identity.Name to get their username in the portal which is used as a parameter for various API calls.

Now this has changed and they can now log into their computers with their smart card or a none personal AD user. I need to change the logic so if they are not using a smart card i need to show a login view.

pseudo code for what i want to do:

if(SmartCardInserted)
{
username = HttpContext.User.Identity.Name
}
else
{
//redirect to login page and get username from there
}

My problem is that i can't find a simple solution for SmartCardInserted, i just need to know if there is a smartcard inserted or not. How can i do this?

Lord Vermillion
  • 5,264
  • 20
  • 69
  • 109
  • May help: http://stackoverflow.com/a/7951130/3060520 – huse.ckr May 05 '17 at 06:44
  • 1
    There is no official .NET smart card wrapper or library. You will have to find out how your application is interfacing the Windows Smart Card service. – arminb May 05 '17 at 11:42
  • 1
    What information does HttpContext.User.Identity have for a non personal AD user? Perhaps you should not try to determine if a smart card was used, but rather if you can find a difference. Perhaps some claim that is added or missing. I assume you cannot check if the identity matches an existing user. –  May 07 '17 at 08:18

0 Answers0