OAuth2服务器设置“CLIENT_ID'广告''client_secret”的“密码”交付式 [英] OAuth2 Server setup 'client_id' ad ''client_secret' for 'password' grant type

查看:3021
本文介绍了OAuth2服务器设置“CLIENT_ID'广告''client_secret”的“密码”交付式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是相当新的设立Oath2服务器,并希望有人能够帮助我摆脱上有两件事情的一些情况。

I'm fairly new to setting up an Oath2 server, and was hoping that someone could help me shed some light on a couple things.

这是我在执行软件包:
https://github.com/lucadegasperi/oauth2-server-laravel

This is the package that I am implementing:
https://github.com/lucadegasperi/oauth2-server-laravel

从我读过关于这个包,林pretty的确认密码/资源Ownnergrant_type是我应该使用设立一个移动应用程序的API访问就像一个移动银行应用程序是什么(敏感数据)

引用的OAuth2规范
http://tool​​s.ietf.org/html/rfc6749#section-4.3

From what I've read about this package, Im pretty sure that the 'password' / 'Resource Ownner' grant_type is what I should be using for setting up a mobile app's API access much like a mobile banking app (sensitive data)

Referencing the OAuth2 spec:
http://tools.ietf.org/html/rfc6749#section-4.3

在OAth2规范指出客户端必须已经通过认证,因此是必须传递给被授予一个访问令牌5总参数:
- grant_type('密码')
- 用户名
- 密码
- CLIENT_ID
- client_secret

The OAth2 spec states that the client must already be authenticated, so there are 5 total parameters that must be passed to be granted an access token:
- grant_type ('password')
- username
- password
- client_id
- client_secret

我有2个问题,关于这个

  1. 是Android和iOS的应用程序能够保持一个'CLIENT_ID'和'client_secret的机密呢? (客户是应用程序或设备本身,而不是用户)
  2. 如果'CLIENT_ID'和'client_secret是每台设备独特之处? (我应该创建一个新的控制器,用于产生每个设备client_ids和client_secrets在一个单独的请求,或使用相同的CLIENT_ID和client_secret被内置到应用程序。)

最后,我试图找出最佳做法,在oath_clients表得到的记录,如果这些项目应该是每个设备唯一的。

Ultimately, I'm trying to figure out best practices for getting records in the 'oath_clients' table and if those entries should be unique per device.

感谢您的帮助!

推荐答案

是否所有设备应共享同一对CLIENT_ID和client_secret还是每个设备应该有不同的对CLIENT_ID和client_secret的是你。从2.0的OAuth的角度看,它们之间没有什么区别,因为的OAuth 2.0并不怎么关心每一个应用程序实例获得一对CLIENT_ID和client_secret的。您可以

Whether all devices should share the same pair of client_id and client_secret or whether each device should have a different pair of client_id and client_secret is up to you. From a viewpoint of OAuth 2.0, there is no difference between them because OAuth 2.0 does not care about how each application instance obtains a pair of client_id and client_secret. You may

  1. 嵌入一对CLIENT_ID和client_secret在你的应用程序的源$ C ​​$ C,或
  2. 让你的应用程序与服务器通信,以便将分配一个新的对CLIENT_ID和client_secret的。

如果你想分配一个不同的对CLIENT_ID和client_secret每个设备,流量会像下面这样。

If you wanted to assign a different pair of client_id and client_secret to each device, the flow would be like the following.

  1. 您的应用程序连接到你的服务器。
  2. 您的应用程序发送的设备ID到服务器。
  3. 您的服务器接收的设备ID。
  4. 您的服务器产生一对CLIENT_ID和client_secret的。
  5. 您的服务器发送该货币对返回到您的应用程序。
  6. 您的应用程序收到对。

如果你想通过CLIENT_ID识别设备,则需要在每个CLIENT_ID与每个设备相关联。但是,如果你只是想知道哪些设备正在访问受保护的资源,它可能是足够的,要求DEVICE_ID参数或类似的东西,当一个客户端应用程序访问受保护资源的端点。要具体:

If you want to identify a device by a client_id, you need to associate each client_id with each device. However, if you just want to know which device is accessing protected resources, it may be enough to require 'device_id' parameter or something similar when a client application accesses endpoints of protected resources. To be concrete:

GET /protected_resource?access_token=.....&device_id=.....

最后,关于第一个问题。的OAuth 2.0并不认为本机应用程序可以让客户端凭据保密。下面是 9.本机应用程序的的摘录。

使用授权code交付式
本机应用程序   应该这样做,而无需使用客户端凭据,由于本地
  应用程序无法将客户证书保密。

Native applications that use the authorization code grant type
SHOULD do so without using client credentials, due to the native
application's inability to keep client credentials confidential.

这篇关于OAuth2服务器设置“CLIENT_ID'广告''client_secret”的“密码”交付式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆