加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scala – 使用akka-http执行OAuth2身份验证的最佳方式是什么?

发布时间:2020-12-16 09:16:14 所属栏目:安全 来源:网络整理
导读:Akka HTTP和Spray提供了一个authenticateOAuth2指令,但是 their documentation states表示 This directive does not implement the complete OAuth2 protocol,but instead enables implementing it,by extracting the needed token from the HTTP headers.
Akka HTTP和Spray提供了一个authenticateOAuth2指令,但是 their documentation states表示

This directive does not implement the complete OAuth2 protocol,but instead enables implementing it,by extracting the needed token from the HTTP headers.

我也找不到任何为Akka HTTP或Spray实现OAuth2的库.有没有我想念的东西,还是这只是现在这些图书馆的状态?

解决方法

我认为最大的问题是OAuth2本身并没有真正告诉你实现细节的样子.

引用the RFC:

The token may denote an identifier used to retrieve the authorization
information or may self-contain the authorization information in a
verifiable manner (i.e.,a token string consisting of some data and a
signature). Additional authentication credentials,which are beyond
the scope of this specification,may be required in order for the
client to use a token.

Access tokens can have different formats,structures,and methods of
utilization (e.g.,cryptographic properties) based on the resource
server security requirements. Access token attributes and the
methods used to access protected resources are beyond the scope of
this specification and are defined by companion specifications such
as [RFC6750].

例如,您可以使用JWT验证请求,或者您可以将令牌仅用作标识符,并向该资源请求服务.

根据您的OAuth2提供程序,实现可能会有所不同,所以我的猜测是框架只能为您提供常见的东西(为您提取令牌),或者它必须实现所有可能的OAuth2实现,这在现在似乎不可行.

过去我个人使用了pauldijou/jwt-scala,你可能想看看.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读