选择使用OAuth2安全验证移动接入 [英] Options to securely authenticate mobile access using OAuth2

查看:166
本文介绍了选择使用OAuth2安全验证移动接入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我们正在实施OAuth2,以确保我们的新API和不知道如何安全地提供所需的功能的过程。我们需要允许从移动设备执行以下操作:

We're currently in the process of implementing OAuth2 to secure our new API and not sure how to securely provide required functionality. We need to allow the following from a mobile device:

后立即下载该应用程序,用户能够拍摄一张照片,并提交无需先登录。

Immediately after downloading the app the user is able to take a picture and submit it without having to first log in.

虽然我们希望允许匿名用户访问,其中一个用户并不需要登录或注册使用某些功能,我们不希望允许未经授权的访问API。这通常会使用客户端证书的授权流程获取和应用程序访问令牌,然而,这需要知道客户的秘密。从我读过,移动设备不被认为是一个值得信赖的客户端,不应包含客户端密钥,因此不应该能够产生一个应用程序的访问令牌自己。

While we want to allow anonymous user access, where a user does not need to log in or register to use certain functionality, we do not want to allow unauthenticated access to the API. This would normally be accomplished using the client credentials authorization flow to obtain and app access token, however this requires knowing the client secret. From what I've read, a mobile device is not considered a trusted client and should not contain the client secret, and hence should not be able to generate an app access token on its own.

我们已经想出了几个选项来完成这一要求,但希望对他们一些输入:

We've come up with a few options to accomplish this requirement, but would like some input on them:

  1. 嵌入到应用程序的客户端秘密。似乎没有从安全角度来看理想,但也许我们缺少以确保它的一个显而易见的方法?我们至少定位iOS和Android平台。
  2. 生成一个应用程序的访问令牌脱机,并嵌入在应用程序。仍然不是很安全,但至少这个秘密不会暴露。
  3. 仅使用客户端ID,而不是一个访问令牌允许访问特定功能。这可能是最简单的,但它引入了不一致,并且需要认证所述客户机的多种方式。
  4. 在建立和使用配套的Web应用程序生成的移动应用程序的访问令牌。从表面上看似乎是一个赢家,但现在你必须安全地访问配套应用!

如何将安全的身份验证访问使用OAuth2从移动设备的API,而无需用户首次登录?

How would you securely authenticate access to an API using OAuth2 from a mobile device without requiring the user to first log in?

推荐答案

同意就问:无论是评论:

Agree with the comments on the Q. Either:

1)使用客户证书中的OAuth 2批类型 - 在你的应用程序嵌入的秘密。要知道,这是不是超级安全的,有人会反向工程,最终它。理想的情况是每个客户将获得一个唯一的秘密 - 所以你可以取消一个客户,如果他们滥用其使用

1.) Use Client Credentials grant type in OAuth 2 - with an embedded secret in your App. Understand that this isn't super secure and someone will reverse engineer it eventually. Ideally each client would get a unique secret - so you could revoke a client if they're abusing its use.

2)住在一起的API是开放的 - 因此如果不需要的OAuth 2访问令牌的。也许该API将只知道你的应用程序 - 但同样,它也只是一个时间问题之前,有人逆向工程是

2.) Live with that API being open - thereby not requiring an OAuth 2 access token at all. Maybe that API would be known only to your app - but again, it would only be a matter of time before someone reverse engineers it.

这篇关于选择使用OAuth2安全验证移动接入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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