Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Authentication Owin和Windows身份验证(mvc5)-使用Windows身份验证作为登录的一部分_Authentication_Windows Authentication_Asp.net Mvc 5_Owin - Fatal编程技术网

Authentication Owin和Windows身份验证(mvc5)-使用Windows身份验证作为登录的一部分

Authentication Owin和Windows身份验证(mvc5)-使用Windows身份验证作为登录的一部分,authentication,windows-authentication,asp.net-mvc-5,owin,Authentication,Windows Authentication,Asp.net Mvc 5,Owin,我正在尝试一个MVC5网络应用程序,它部分使用Windows Auth 我的意思是,它实际上是基于表单/cookie的身份验证,但请求用户的Windows主体构成了其登录凭据的一部分 例如,登录页面将显示“您已被识别为somedomain\kierenj。请输入要登录的密码。”如果他们输入了正确的密码,则cookie已设置并已登录 如果Windows身份验证失败,则登录页面仍会显示,但会被禁用 我曾经用WindowsPrincipalHandler做过如下实验: 其要点是,如果我启用Window

我正在尝试一个MVC5网络应用程序,它部分使用Windows Auth

我的意思是,它实际上是基于表单/cookie的身份验证,但请求用户的Windows主体构成了其登录凭据的一部分

例如,登录页面将显示“您已被识别为somedomain\kierenj。请输入要登录的密码。”如果他们输入了正确的密码,则cookie已设置并已登录

如果Windows身份验证失败,则登录页面仍会显示,但会被禁用

我曾经用WindowsPrincipalHandler做过如下实验:

其要点是,如果我启用Windows身份验证并禁用匿名身份验证,那么Owin(或者可能是其中的cookie auth部分)将重定向到登录页面-这将重定向到登录页面-这是一个重定向循环

注意,我使用的是非常简化的Owin设置
UseCookieAuthentication
,并指定
ApplicationOkie
类型和
LoginPath
;然后我从我的账户控制员处这样呼叫
sign

        var claims = new[] {
            new Claim(ClaimTypes.Name, "Username"),
            new Claim(ClaimTypes.Role, "AuthenticatedUser")
        };
        AuthenticationManager.SignIn(new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie));
(例如,首先选中了
WindowsIdentity.GetCurrent()


我真的需要编写自己版本的Owin cookie身份验证中间件吗?我可以获取源代码以便调试/派生吗?

为了避免重定向循环,在为登录页提供服务的控制器的构造函数中,尝试设置当前HttpContext的响应。SuppressFormsAuthenticationRedirect到
true

这根本没有帮助您是否能够找到此问题的答案?这有帮助吗?