ASP.NET Core OAuth不适用于Safari

问题描述 投票:1回答:1

[我们最近发现,针对OAuth(同时具有facebook / google)的OAuth管道在桌面Safari(12.x和13.x)上无法正常工作。该系统可以在Chrome,Firefox和移动Safari上正常运行。

我们不确定它何时坏了,但它在2周前就可以正常工作,而昨晚它没有正常工作。

这里是我们在Startup.cs中配置OAuth的位置

.AddFacebook(options => {
                    options.AppId = SecretSettings.GetSecret("FacebookAppId");
                    options.AppSecret = SecretSettings.GetSecret("FacebookAppSecret");
                    options.Scope.Add("email");
                    options.AuthorizationEndpoint = "https://www.facebook.com/v2.8/dialog/oauth";
                    options.TokenEndpoint = "https://graph.facebook.com/v2.8/oauth/access_token";
                    options.BackchannelHttpHandler = new FacebookBackChannelHandler();
                    options.UserInformationEndpoint = "https://graph.facebook.com/v2.8/me?fields=id,name,email,first_name,last_name";
                    options.RemoteAuthenticationTimeout = remoteAuthTimeout;
                    options.SignInScheme = IdentityConstants.ExternalScheme;
                    options.AccessDeniedPath = "/account/login?returnUrl=%2F";
                })
                .AddGoogle(options => {
                    options.ClientId = SecretSettings.GetSecret("GoogleOAuth2ClientId");
                    options.ClientSecret = SecretSettings.GetSecret("GoogleOAuth2ClientSecret");
                    options.RemoteAuthenticationTimeout = remoteAuthTimeout;
                    options.SignInScheme = IdentityConstants.ExternalScheme;
                    options.AccessDeniedPath = "/account/login?returnUrl=%2F";
                })

并且我们使用以下代码生成挑战:

return Challenge(new AuthenticationProperties { RedirectUri = redirectUrl }, authenticationScheme);

据我们所知,通常的流程是:

  1. 使用Google进行登录,生成质询令牌
  2. 重定向到google oauth,用户登录并返回
  3. 重定向到/ signin-google(中间件路由)以确认给出的代码
  4. 重定向到sso返回操作,处理用户登录或注册

Chrome正确地满足了所有这些要求,但是Safari卡在了3上。浏览器没有重定向回我们的sso return操作,而是从站点的主页上删除。

我检查了所涉及的URL,看起来状态,范围和代码已正确传递,只是中间件内部发生了一些事情,将用户踢到了站点的根目录。

我们正在使用ASP.NET Core 3.0

有人对可能出什么问题有任何想法吗?还是我们可以探索找出答案的途径?

asp.net-core oauth-2.0 safari
1个回答
0
投票

我可能是错的,但这与ITP(智能跟踪预防)和您在尝试进行重定向时丢失用户手势有关吗?https://webkit.org/blog/9521/intelligent-tracking-prevention-2-3/

这种类型的东西通常是由供应商介绍的,对于我们这些使用现代应用程序安全标准的人来说,很少考虑。

© www.soinside.com 2019 - 2024. All rights reserved.