Code Monkey home page Code Monkey logo

Comments (1)

hiling avatar hiling commented on June 6, 2024

在1.1首次认证授权中,请问OAuth2协议中的Client角色是“浏览器/APP”??

回复:是的。

认证过程中需要带着资源拥有着的用户名密码,还有客户端ID和密匙,用户名密码是用户登录时输入的,但客户端ID和密匙也是保存在“浏览器/APP”??这个是否不安全??

回复:认证需要带用户名、密码、客户端ID,其实就是用户登陆,用户输入用户名+密码,请求带着客户端ID到服务端验证,服务器就知道哪个端发起的登陆请求,Password模式中密钥一般不需要,客户端ID如xxAPP、xxH5、xxWechat等,一般配置在客户端上,不用考虑安全性。

因为无论是“浏览器/APP”端都可能被劫持,我理解之所以有客户端ID和密匙的存在是为了在授权服务器验证用户的账号密码后,同时验证客户端是授信的,达到双保险,而如果用户的账号信息以及客户端ID密匙都在“浏览器/APP”端保存,就无法达到应有的目的??

回复:防止劫持和篡改,这可能不是OAuth2关注的事情了,OAuth2主要是做认证,防劫持和篡改,可以使用https对请求加密,可以通过混淆、加密、加壳等技术对客户端加固。

同样的在用户授权完成了,获得refreshToken,那么refreshToken你是保存在哪儿的??浏览器/APP??

回复:保存在浏览器/APP等客户端,不需要考虑refreshToken在客户端的存储安全问题,因为客户端是通过用户名+密码登陆的,都知道用户名密码了,就没有必要再拿refreshToken。

我印象中accessToken被设计为过期时间较短,目的是即使被窃取也只有一段时间有效,而refreshToken被设计为免去用户再次认证授权的过程,再获得一个新的accessToken,而其中重要的一点是即使refreshToken被窃取,也不能直接得到accessToken,因为还需要客户端ID和密匙,如果refreshToken和客户端ID、密匙都被保存在“浏览器/APP”,那安全性如何保障?

回复:客户端没有获取refreshToken的必要,传输过程中可能有获取refreshToken的可能,这个可以通过https保障。

注:使用Paasword模式的前提是你对客户端是授信的。
不知我的答复和理解是否清晰,有任何疑问可回复。

from mini-platform.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.