简体   繁体   English

GoogleAuthUtil就像iOS的设备身份验证一样,可以验证请求是否来自Apple设备

[英]GoogleAuthUtil like device authentication for iOS to verify that requests originate from an Apple device

Google Auth Util lets Android developers verify that the requests their servers receive come from an Android device. Google Auth Util允许Android开发人员验证其服务器收到的请求来自Android设备。

The device gets a token from Google based on the Google account associated with the device, then the requests from the device are sent with that token to the server, where the server then asks Google if the token is valid. 设备会根据与设备关联的Google帐户从Google获取令牌,然后设备的请求会随该令牌一起发送到服务器,然后服务器会询问Google是否有效。 Any keys are kept out of the app source, so malicious folks cannot crack the app and access private keys and fudge requests to the server. 任何密钥都不在应用程序源之外,因此恶意用户无法破解应用程序并访问私钥和软件请求到服务器。

I've looked for a while and it seems Apple doesn't offer anything like this but I was hoping there was something functionally similar I could use for iOS. 我已经看了一段时间,似乎Apple没有提供这样的东西,但我希望有一些功能相似的功能,我可以用于iOS。

Update 更新

While the implicit assumption in the question seems reasonable, it is not actually true. 虽然问题中隐含的假设似乎是合理的,但事实并非如此。 Further readings of the Google sources reveal that the purpose of the Auth Util (and later Firebase) are to authenticate the user and secure the server. 进一步阅读Google消息来源表明,Auth Util(以及后来的Firebase)的目的是验证用户身份并保护服务器。 Given that the server only sees network traffic, it's possible to replicate the traffic from another client. 鉴于服务器只能看到网络流量,因此可以复制来自其他客户端的流量。

In addition, the definition of Android is fairly blurry, as OEM modify the base OS to suit their needs. 此外,Android的定义相当模糊,因为OEM修改基本操作系统以满足他们的需求。

This is likely wrong 这可能是错的

One option is to use the Apple Push Notification . 一种选择是使用 Apple推送通知 You can register a device and push notifications specifically to it . 您可以注册设备并 专门向其发送通知 When your app loads, it sends a request to the server with its device token and receives what is essentially a session cookie via the APN. 当您的应用加载时,它会向服务器发送带有 设备令牌的请求,并通过APN接收基本上是会话cookie的内容。

One caveat is that it is not encrypted . 一个警告是 它没有加密 You can easily solve this by sending a randomly generated symmetric key in the request. 您可以通过在请求中发送随机生成的对称密钥来轻松解决此问题。 The cookie you get would be encrypted on the server and decrypted using the same key in the iOS device. 您获得的cookie将在服务器上加密,并使用iOS设备中的相同密钥进行解密。

This solves the issue of storing keys in the source and proves the requests came from an iOS device. 这解决了在源中存储密钥的问题,并证明请求来自iOS设备。

Of course, this can be simplified by generating a certificate, storing it in the key chain and sending the private key to the server for storage during registration. 当然,这可以通过生成证书,将其存储在密钥链中并在注册期间将私钥发送到服务器以进行存储来简化。 After the initial registration and validation using APN, subsequent messages can be signed using the device id + certificate public key. 在使用APN进行初始注册和验证之后,可以使用设备ID +证书公钥对后续消息进行签名。

One last issue is that APN can also be used to register OSX devices. 最后一个问题是APN也可用于注册OSX设备。 I haven't been able to figure out how to exclude those (yet). 我还没弄清楚如何排除那些(还)。

Disclaimer: It's been a long day of writing specs. 免责声明:编写规范已经过了漫长的一天。 I'm reasonably comfortable with the mechanism of initially registering the iOS device using APN. 我对使用APN初始注册iOS设备的机制感到相当满意。 I may have gotten the encryption parts wrong. 我可能已经将加密部分弄错了。 If so, comment gently, please. 如果是这样,请轻轻评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 验证 fcm 令牌是否属于 android 或 ios 设备 - Verify if fcm token belongs to an android or ios device 将内容从Android设备流式传输到Apple TV - Stream content from Android device to Apple TV 如何从服务器验证/信任iOS或Android设备的位置? - How can I verify / trust the location of an iOS or Android device from the server? 如何使用 22571267 之类的 uiautomator 在真实的 android 设备中验证 xpath - How to verify xpath in real android device using uiautomator like 22571267 Android(例如iOS)中是否有设备和界面方向? - Is there a device and interface orientation in Android (like in iOS)? 如何检测用户是否在 PHP 或 Jquery 中使用 Apple 设备 [不仅是 iOS] - How to detect if user is using an Apple device [Not only iOS] in PHP or Jquery 使用Titanium进行设备身份验证 - Device authentication with Titanium 如何在设备上组织身份验证? - How to organize authentication on a device? 强制 Flutter Android 应用程序的行为就像在 iOS 设备上一样 - Force Flutter Android Application to behave like it is on an iOS Device 在 iOS 设备上使用 Apple Signin 创建帐户后在其他平台上进行身份验证 - Authenticate on other platform after creating account using Apple Signin on iOS device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM