实施到Office 365后能够登录但收到错误请求吗? [英] After implementing to office 365 able to login but getting Bad Request?

查看:68
本文介绍了实施到Office 365后能够登录但收到错误请求吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经为我们的应用程序实现了Office 365 Azure AD身份验证.但是,在经过Office 365身份验证之后,它将连续循环进行,直到抛出错误"Bad Request"(错误请求)

We have implemented Office 365 Azure AD authentication for our application. However, after office 365 authentication, it is going in continuous loop till it throws an errors "Bad Request"

推荐答案

显然,此问题已解决:

https://github.com/KentorIT/owin-cookie-saver

从网站上逐字记录:

Microsoft的System.Web的Owin实施中存在一个错误.这 在IIS上运行Owin应用程序时使用的一种.哪一个 如果我们使用的是基于Owin的新产品,我们大概有99%会做 使用ASP.NET MVC5进行身份验证处理.

There is a bug in Microsoft's Owin implementation for System.Web. The one that is being used when running Owin applications on IIS. Which is what probably 99% of us do, if we're using the new Owin-based authentication handling with ASP.NET MVC5.

该错误使Owin设置的Cookie在某些地方神秘地消失了 场合.

The bug makes cookies set by Owin mysteriously disappear on some occasions.

此中间件是针对该错误的修复程序.只需将其添加到任何cookie之前 处理中间件,它将保留身份验证cookie.

This middleware is a fix for that bug. Simple add it before any cookie handling middleware and it will preserve the authentication cookies.

我遵循的过程到目前为止似乎仍然有效:

The process I followed, which appears to work so far is:

  1. 使用项目"/管理NuGet"属性,添加Kentor.OwinCookieSaver
  2. Startup.Auth.cs中的public partial class Startup中,在app.UseCookieAuthentication(new CookieAuthenticationOptions());之前,添加app.UseKentorOwinCookieSaver();
  1. Using Project / Manage NuGet properties, add Kentor.OwinCookieSaver
  2. In Startup.Auth.cs, inside public partial class Startup, before app.UseCookieAuthentication(new CookieAuthenticationOptions());, add app.UseKentorOwinCookieSaver();

节略的代码示例

  public partial class Startup
  {
    // LOTS OF STUFF
    public void ConfigureAuth(IAppBuilder app)
    {
        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseKentorOwinCookieSaver();

        app.UseCookieAuthentication(new CookieAuthenticationOptions());

更新:

此更改后,问题仍然存在

After this change the issue still exists

这篇关于实施到Office 365后能够登录但收到错误请求吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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