c# - 指定 Azure 移动应用网站登录的重定向 url

标签 c# azure authentication azure-mobile-services

当应用服务将“请求未经身份验证时采取的操作”设置为“使用 X 登录”时,任何网页点击都会发送到 X 以供用户登录。用户登录后,用户将被重定向到他们开始的页面。

enter image description here

例如,当社交登录服务为 Active Directory B2C,并且用户从 http://example.com/admin/monitor 开始时用户被发送至https://login.microsoftonline.com/...?...&state=redir%3D%252Fadmin%252Fmonitor

在这个特定实例中,我不希望所有网页都需要身份验证。如何将用户发送到 .auth/login/aad 并指定redirect_uri,以便它返回到正确的页面?如果我不指定任何内容,我最终会在

enter image description here

并且该网站只是原始网站。

我正在寻找类似 https://example.com/.auth/login/aad?return_url=blahblah 的内容- 我当然希望它存在!

顺便说一下,aad 中有一个“redirect_uri”,它会转到/.auth/login/aad/callback。看起来像redirect_uri=https%3A%2F%2Fkamelos-app.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback。这与我所说的不同。转到 AAD 后,它会转到 Azure 移动应用程序并发布 state=redir%3D%252Fadmin%252Fmonitor 以及 token 。

更新。我相信我正在寻找“post_login_redirect_url”

最佳答案

您正在寻找 post_login_redirect_url 我认为没有办法从门户内分配它。
您需要做的是将用户导航到

 /.auth/login/<provider>?post_login_redirect_url=YOUR_URL   

Your application can trigger the same redirect itself by navigating the user to the /.auth/login/ endpoint of your site, where is one of aad, facebook, google, microsoftaccount, and twitter

来自:https://azure.microsoft.com/en-us/blog/announcing-app-service-authentication-authorization/

如果无法编写额外的代码,您可以 configure an advanced authentication使用 AAD(不确定 Google、Facebook 等)

当您这样做时,您可以将 post_login_redirect_url 添加到返回网址。

关于c# - 指定 Azure 移动应用网站登录的重定向 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42824135/

相关文章:

azure : Resource usage API issue

javascript - 使用 JavaScript 验证表单

c# - 混合组和用户的 asp.net mvc [Authorize()] 属性

c# - MongoDB Fluent界面。尝试投影子文档属性,而忽略父文档属性

node.js - 如何在未捕获的异常上优雅地重新启动 NodeJS 服务器?

c# - 使用 Entity Framework 6.1 CodeFirst 的 SQL Server 2014 内存优化表

azure - 在 Azure DevOps 中部署 Kubernetes 模板时如何查找 aadSessionkey 的值

php - 到处注销,我在其他地方登录过

c# - 创建冰冷的 TaskCompletionSource?

c# - 为什么这段代码的执行速度比预期的要快?