0
votes

I need to use Form-Based authentication on an ASP.NET MVC web site with LDAP (Active Directory) backend like TeamCity for instance.

So i need to query LDAP first if the requested user is valid, then auto-register user in database according to LDAP user authentication infos in order to use mixed authentication :

Users :

Admin (local web site user, stored in database only)

Somebody (LDAP user, auto-registered in database on first login)

Thanks.

1

1 Answers

0
votes

I have a vaguely similar setup but i dont register the users locally for Forms auth. When using Windows Auth i can get the LDAP user info and then i query LDAP with that info (knowing the user's sAMAccountName and domain).

I think you would want to configure your app for Forms auth and then have your login action determine if the credentials supplied validated first in forms then if not, over the LDAP with some nice conditional logic.

You could authenticate over LDAP with this code example and then populate your local Forms Membership db with the relevant user info. Maybe even store the LDAP DN with the aspnet Membership user in the db for further LDAP calls.