【问题标题】:OWIN MVC5 with AAD RedirectUri not being redirected没有重定向 AAD RedirectUri 的 OWIN MVC5
【发布时间】:2018-12-22 09:17:26
【问题描述】:

将 OOTB MVC5 与 AAD 模板一起使用,无需任何修改。

我想要做的是在 AAD 的身份验证后将其他自定义声明添加回我的应用程序。 ConfigureAuth:

public void ConfigureAuth(IAppBuilder app)
    {
        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseCookieAuthentication(new CookieAuthenticationOptions()
        {
            AuthenticationType = CookieAuthenticationDefaults.AuthenticationType,
        });

        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                ClientId = clientId,
                Authority = authority,
                RedirectUri = "https://localhost:44336/Account/Signin",
                PostLogoutRedirectUri = postLogoutRedirectUri
            });
    }

在 Azure 门户中,应用程序的回复 URL 也按上述方式输入。应用程序的实际行为是,在 AAD 登录后,重定向只是回到应用程序的根 /,并且没有命中 Account 控制器上的 Signin 操作。

任何想法为什么?我错过了什么?

【问题讨论】:

    标签: asp.net-mvc asp.net-mvc-5 azure-active-directory owin


    【解决方案1】:
    1. 您是否还有设置了回复 url/redirecturi 的 web.config 或 appsettings.json?如果是这样,请确保它也在那里匹配。
    2. 您是仅在本地工作还是这是一个已发布的应用程序?确保在应用注册和配置中也包含已发布的应用 URL。还要确保这些都是 https 而不是 http(看起来很明显但很容易错过)。
    3. 确保您的主页 URL 正确列出。
    4. 如果没有看到您的帐户控制器,很难诊断出此问题。你能在这里提供这个吗?

    如果您还没有,请查看this repository。它详细描述了如何完成您想要实现的目标。

    还可以查看Youtube tutorial

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-09
      • 1970-01-01
      • 1970-01-01
      • 2015-08-19
      • 2014-08-10
      • 2014-03-07
      • 1970-01-01
      • 2022-12-10
      相关资源
      最近更新 更多