IdentityServer3:本地数据库+ Active Directory

时间:2016-09-28 07:22:56

标签: active-directory asp.net-identity identityserver3

我目前使用IdentityServer3和AspNetIdentity。现在我想将身份验证扩展到活动目录。为此,我想在登录屏幕上创建一个复选框,用户可以在其中决定是否要对活动目录或本地数据库进行身份验证:

enter image description here

现在我的问题是:

  1. 如果选中了Windows身份验证的复选框,我在自定义用户服务中需要这些信息。然后我可以编写以下代码:

    public async override Task AuthenticateLocalAsync(LocalAuthenticationContext context)
    {
            // check if the option for windows authentication is set
            // Yes: Authenticate over active directory: UserPrincipal.FindByIdentity(principalContext, username)
            // No: Authenticate over local database 
    }
    
  2. 这是解决我的要求的好方法还是有更好的解决方案?我想为用户设计尽可能简单。

  3. 感谢您的帮助!!

0 个答案:

没有答案