使用OpenId进行身份验证 [英] Authentication using OpenId

查看:128
本文介绍了使用OpenId进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在使用开放ID进行身份验证.我的项目在MVC中.

I am doing authentication using open Id. My project is in MVC.

身份验证正在我的本地上进行,但是当我尝试在服务器上部署它时,它将进入无限循环.

Authentication is working on my local, but when I am trying to deploy it on server, it goes into infinite loop.

我已经浪费了4-5天.请尽快提供帮助.

I have already wasted 4-5 days. Please help as soon as possible.

推荐答案

您可以提供身份验证的代码段吗?另外,请检查您是否在代码中使用了CookieSecurePolicy.SameAsRequest.如果不是,对于HTTP请求,您可能会在验证时看到无限循环.请参考下面的代码摘录 -

Can you provide a code snippet of your authentication? Also, please check if you are using CookieSecurePolicy.SameAsRequest in the code.  If not, for HTTP request you may see an infinite loop while authenticating.  Please refer to below code extract -

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationScheme = "cookies",
                AutomaticAuthenticate = true,
                CookieName = "AuthenticationCookie",
                // if this is "always" we get a infinite loop when authentication on HTTP (HTTPS is fine)
                CookieSecure = CookieSecurePolicy.SameAsRequest
            });


这篇关于使用OpenId进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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