具有自动注册的ASP.NET MVC混合形式和LDAP身份验证 [英] Mixed Forms and LDAP authentication with auto-registration with ASP.NET MVC

查看:318
本文介绍了具有自动注册的ASP.NET MVC混合形式和LDAP身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在一个ASP.NET MVC的网站使用基于表单的认证与LDAP(Active Directory)的后端喜欢的TeamCity的实例。

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

所以我需要首先查询LDAP如果请求的用户是有效的,然后根据LDAP用户认证的​​相关信息,以便为使用混合身份验证自动注册用户数据库:

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 :

用户:

管理(本地网站的用户,存储在数据库中只)

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

有人(LDAP用户,自动注册在第一次登录数据库)

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

感谢。

推荐答案

我有一个隐约类似的设置,但我不当地注册用户为窗体身份验证。当使用Windows身份验证我能得到LDAP用户信息,然后我LDAP查询与该信息(知道用户的sAMAccountName和域)。

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).

我想你会想配置你的应用程序的窗体身份验证,然后让你的登录操作确定是否提供凭证的形式先验证再如果不行,用了一些不错的条件逻辑的LDAP。

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.

您可以验证通过LDAP与这code例如< /一>,然后填充您的本地形式籍数据库相关的用户信息。甚至存储LDAP DN与数据库进行进一步LDAP调用的ASPNET会员用户。

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.

这篇关于具有自动注册的ASP.NET MVC混合形式和LDAP身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆