码迷,mamicode.com
首页 > Web开发 > 详细

Asp.net core Authentication and Authorization

时间:2021-02-16 11:58:15      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:私钥   asp   sel   tps   加密   获取   就是   性能   不能   

之前有写过关于这些的文章, 本来想认证写一个系类的,但是感觉非常大. 太多工了.

先记入一些零零散散的. 看看以后要不要整理起来。

 

refer resources : 

https://www.cnblogs.com/stulzq 晓晨博客 

https://www.cnblogs.com/sheng-jie/p/9430920.html 圣杰博客 identity server 4 知多少

https://www.cnblogs.com/sheng-jie/p/6564520.html 圣杰博客 oauth 2.0 知多少

 

Access token type, self-contained (self-encoded type) vs reference (identifier type)

access token 有 2 种, 一种是作为一个 reference key, 每当 resource server 拿到 access token 后并不能知道授权的具体信息. 

而是需要用 token 去访问 autho server 获取授权信息. 这个做法的缺点就是每次都要去访问 autho server 性能可能有点伤, 好处就是可以立刻 revoke token

另一种叫 self-contained 当 resource server 拿到 access token 后它自己就可以解锁. 这里用的是不对称加密. 私钥加密,公钥解锁. 

好处就是不用每次去 autho server 咯, 性能快一点, 坏处就是你无法立刻去 revoke token. 而是需要等它自己过期. 所以 access token 就要设置时间段, 而 refresh token 就需要一直去续命. 

oauth 没有规定用哪一种, 建议大家自己去做 balance 权衡.

相关的资源 : 

https://www.oauth.com/oauth2-servers/listing-authorizations/revoking-access/

https://www.oauth.com/oauth2-servers/access-tokens/self-encoded-access-tokens/

https://darutk.medium.com/oauth-access-token-implementation-30c2e8b90ff0

https://docs.wso2.com/m/mobile.action#page/76748735

https://docs.wso2.com/display/IS540/Self-contained+Access+Tokens

 

Asp.net core Authentication and Authorization

标签:私钥   asp   sel   tps   加密   获取   就是   性能   不能   

原文地址:https://www.cnblogs.com/keatkeat/p/14398753.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!