【问题标题】:IdentityServer handling timeouts and subsequent redirectsIdentityServer 处理超时和后续重定向
【发布时间】:2016-08-29 09:58:51
【问题描述】:

我已经在我的应用程序中实现了 IdentityServer3,它运行得非常好。但是最近我遇到了一些我不太明白的行为,所以我希望有人能告诉我我做错了什么或者我应该如何做以下事情:

我有一个使用 IdentityServer 进行身份验证的 ASP.NET MVC 应用程序。用户验证并打开应用程序中的特定页面。他离开他的 PC,稍后回来并单击应用程序中的另一个链接(例如,controller/action/38)。然后应用程序将用户重定向到:

http://localhost/MyIdentityServer/identity/connect/authorize?client_id=myapp&redirect_uri=http://localhost/MyApp/controller/action/38&response_mode=form_post&response_type=id_token&scope=openid+profile+roles etc.

由于只有应用程序的根 url (http://localhost/MyApp) 在 IdentityServer 中注册为 RedirectUrl,因此它会显示以下消息:

客户端应用程序未知或未经授权。

没错,因为控制器 + 动作不是有效的 RedirectUrls。但是,我无法想象我必须将所有控制器和操作添加到 RedirectUrl 属性,特别是因为它们采用与数据相关的参数。我肯定做错了什么,但是什么?

【问题讨论】:

  • 你如何提供redirect_uri?如果您使用的是 OIDC 中间件,能否展示您的 OWIN 启动文件?
  • 当前使用静态类提供客户端,它们在 Startup.cs 中定义和添加如下:application.Map("/identity", configuration => { var factory = InMemoryFactory.Create( clients: Clients.Get(), scopes: Scopes.Get() ); }); Clients.Get() 中的每个客户端都只需设置 RedirectUrl 属性到它的根 URL。
  • 是的,没关系 - 但是 MyApp.. 怎么样?
  • 这有点太大了,放在这里,所以我在这里上传:pastebin.com/d5yRmC18

标签: identityserver3


【解决方案1】:

您正在修改针对 idsrv 的每个请求提供给 idsrv 的重定向URI:

删除这一行:

   notification.ProtocolMessage.RedirectUri = something

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-04
    • 1970-01-01
    • 2013-03-12
    • 1970-01-01
    • 2017-08-02
    • 2019-04-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多