Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS basic authentication using LDAP

I have a web service which needs to use HTTP authentication with IIS. The only hurdle is that the user's credentials are in LDAP. Is there a way to configure IIS to use LDAP credentials for it's basic authentication? I thought I could set the default domain or realm to part of the LDAP connection string, but haven't had any luck. Thanks,

-Will

like image 420
Will Avatar asked Sep 12 '11 19:09

Will


1 Answers

What I would do (I'm assuming you're using a third party LDAP, and that there isn't a built in way of doing this; I haven't checked) is set up MADAM and implement a custom IUserSecurityAuthority by extending Madam.UserSecurityAuthorityBase to check the credentials against LDAP.

All you will have to do is override a handful of methods to authenticate from LDAP. If you happen to be using an LDAP Membership Provider for forms authentication, you can skip implementing that separately and use the example MembershipSecurityAuthority included with MADAM.

Excerpt from that example file here:

protected override bool ValidateUser(string userName, string password)
{
    return MembershipProvider.ValidateUser(userName, password);
}

Potentially useful LDAP user validation code

like image 138
Kevin Stricker Avatar answered Oct 21 '22 05:10

Kevin Stricker