【问题标题】:Why asp.net core 3.x use resource owner?为什么 asp.net core 3.x 使用资源所有者?
【发布时间】:2020-04-27 12:02:15
【问题描述】:

一些专家说resource owner 是一种不好的身份验证做法

Scoot Brady - IdentityServer Team for example

为什么微软在asp.net core 3.0 中使用resource owner 作为默认流?

链接:https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-3.1

使用resource owner 安全吗?

什么时候使用?

什么时候不使用?

【问题讨论】:

  • 是吗?是什么让您说这是默认设置?
  • @KirkLarkin 我添加了链接

标签: asp.net asp.net-core oauth-2.0 identityserver4 openid


【解决方案1】:

NO,新的Angular模板(Individual authentication template)没有使用资源所有者流程,实际上是使用Auth Code Flow + PKCE(PROOF Key for Code Exchange) ,这已经是原生应用和 SPA 的官方推荐。您可以使用 Fiddler 来跟踪身份验证请求:

授权端点的登录请求:

检查 code_challengecode_challenge_method ,这是使用 PKCE 的代码流。另请参阅令牌请求:

注意grant_type

在代码流+PKCE中:

  • 代替client_secret(在正常的代码流中),客户端应用程序创建一个随机值code_verifier,并将其散列并编码为code_challenge

  • 授权服务器存储散列值(Code Challenge)以供以后验证,并在用户进行身份验证后,使用授权码重定向回应用程序。

  • 应用程序发出将代码交换为令牌的请求,但它只发送代码验证器而不是固定密钥。

【讨论】:

  • 谢谢。 Asp.net core spa 使用“帐户”区域进行视图渲染
猜你喜欢
  • 1970-01-01
  • 2016-03-03
  • 1970-01-01
  • 2020-03-20
  • 2013-08-11
  • 1970-01-01
  • 2017-03-28
  • 2020-12-25
  • 2020-01-13
相关资源
最近更新 更多