获取失败的Active Directory登录尝试数 [英] Get Number of Failed Active Directory Log in Attempts

查看:166
本文介绍了获取失败的Active Directory登录尝试数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我如何让失败AD日志在我的旧的WebForms尝试次数登录应用程序:

Here is how I get the number of failed AD log in attempts in my old webforms log in app:

[Authentication.cs]

[Authentication.cs]

var pc = new PrincipalContext(ContextType.Domain, "blahnet.blahad.com", "dc=blahnet,dc=blahad,dc=org");
bool validated = pc.ValidateCredentials(username, password, ContextOptions.Negotiate);
var ADElement = IdentityType.SamAccountName;
var up = UserPrincipal.FindByIdentity(pc, ADElement, username);
int numberOfFailedLoginAttempts = up.BadLogonCount;

和这里是我迄今为止在我新的MVC 5登录应用程序的认证。

And here is what I have so far for authentication in my new MVC 5 login app.

[web.config文件]

[web.config]

    <membership defaultProvider="ADMembershipProvider">
      <providers>
        <clear />
        <add name="ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="ADConnectionString" attributeMapUsername="SamAccountName" />
      </providers>
    </membership>
  </system.web>
  <connectionStrings>
    <add name="ADConnectionString" connectionString="LDAP://blahnet.blahad.com:389/DC=blahnet,DC=blahad,DC=com" />
  </connectionStrings>

[AccountController.cs]

[AccountController.cs]

bool validated = Membership.ValidateUser(model.UserName, model.Password);

通过这种新方法,我怎么能得到失败AD日志的数量在试图像上面?

With this new method, how can I get the number of failed AD log in attempts like above?

任何帮助将是很大的AP preciated。

Any help would be greatly appreciated.

推荐答案

成员类是通用的。为了得到一个帐户的AD特定的属性,我的猜测是,你仍然要使用的帐户的 UserPrincipal 实例。顺便说一句,如果可能的话,你也可以使用的产品,如管理引擎的审核: HTTP:// WWW .manageengine.com /产品/主动目录审计/

Membership class is generic. To get that AD specific property of an account, my guess is you will still have to use UserPrincipal instance of the account. BTW, if possible you can also use a product like Manage Engine's Auditing: http://www.manageengine.com/products/active-directory-audit/

这篇关于获取失败的Active Directory登录尝试数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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