简体   繁体   中英

Mixed Forms and LDAP authentication with auto-registration with ASP.NET MVC

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM