我們是否知道如何實現基於owin.org的VS 2013中引入的新認證系統的LDAP支持。LDAP支持VS2013中新的認證系統(基於owin(owin.org))
我已經使用Forms身份驗證編寫了自己的提供程序,但它不再工作。
任何方式來擴展此也將非常受歡迎。我看到的所有內容都是爲支持Google,Twitter和Facebook等許多oauth提供商而構建的。
我們是否知道如何實現基於owin.org的VS 2013中引入的新認證系統的LDAP支持。LDAP支持VS2013中新的認證系統(基於owin(owin.org))
我已經使用Forms身份驗證編寫了自己的提供程序,但它不再工作。
任何方式來擴展此也將非常受歡迎。我看到的所有內容都是爲支持Google,Twitter和Facebook等許多oauth提供商而構建的。
這其實很簡單。你只需要覆蓋CheckPasswordAsync method in the provided UserManager。 (完全披露,這是我的博客文章)。
public class ApplicationUserManager : UserManager<ApplicationUser> {
//...SNIP...
public override async Task<bool> CheckPasswordAsync(ApplicationUser user, string password)
{
return await Task.Run(() => {
_context = new PrincipalContext(ContextType.Domain);
return _context.ValidateCredentials(user.UserName, password, ContextOptions.Negotiate)
});
}
}
這是一個非常令人反感的方法,但它應該工作。
使用'Task.Run'會傷害ASP.NET的性能。改用'Task.FromResult'返回一個完成的'Task'。 –
@PauloMorgado你有一個鏈接到關於Tak.Run vs Task.FromResult的更多信息? –
我有幾個關於我的[curation](http://curah.microsoft.com/45553/asyncawait-general)。您可以在[PFX團隊的博客](http://blogs.msdn.com/b/pfxteam/)和[Stephen Clearly的博客](http://blog.stephencleary.com/)上找到更多內容。爲什麼你認爲在ASP.NET應用程序上調用Task.Run是否有用? –
你看看這個:http://blogs.msdn.com/b/webdev/archive/2014/02/21/using-claims-in-your-web-app-is-easier-with-the -new-owin-security-components.aspx – Saravanan