Wednesday, February 24, 2016

CAC, PIV, ADFS, LDAP oh my!





Challenge:

Needed an web application to authenticate against Active Directory on premises.  I need to know how to wire up a web application to AD.  Then I need to understand how to read those claims back on the web application I had designed.

Solution:

Went with the solution suggested by Vittorio over on his blog.  We have an on prem AD server which will be sufficient for our needs.  The guide he wrote was straight forward and worked.  The only issues I had was I need to coordinate with our AD team.  Once they understood, they set up the AD Relying Party Trusts between my app and our AD server. 

We chose to use the MVC 5 templates in VS 2013.  The wizard allows you to choose from 4 types of authentication.  
 
I did look at the LDAP option.  It would work but would require a username and password in the call too
 
DirectoryEntry de = new DirectoryEntry ("LDAP://novellBox.sample.com","admin","password",AuthenticationTypes.None);

This is not something I want to be embedding in the code.  I much prefer the using System.DirectoryServices.AccountManagement.  Then all you need is PrincipalContext. 

Source:

  1. http://www.cloudidentity.com/blog/2014/02/12/use-the-on-premises-organizational-authentication-option-adfs-with-asp-net-in-visual-studio-2013/
  2. https://msdn.microsoft.com/en-us/library/ff649227.aspx (Dated but still lots of goodness)
  3. http://forums.asp.net/t/1356598.aspx (DOD guys asking questions)
  4. http://stackoverflow.com/questions/1437250/connecting-to-ldap-from-c-sharp-using-directoryservices  
  5. https://msdn.microsoft.com/en-us/library/87tye19w(v=vs.110).aspx (DirectoryEntry)
  6. http://goodworkaround.com/node/68(Web Forms)
  7. http://www.schiffhauer.com/mvc-5-and-active-directory-authentication/(MVC 5)
  8. https://github.com/aspnet/Identity/issues/387 (MVC 5 and AD)






1 comment:

  1. Thankful to you for sharing of information, I am uncommonly fulfilled by the substance of your article is to a great degree profitable and I sit tight for the accompanying article to upgrade the information yet again.
    Property for sale in carvoeiro

    ReplyDelete