我们正在使用 Notification Hub 连接字符串(截至目前为静态代码)作为 NotificationHubSDK 注册方法的输入。Connection 字符串由两个参数 Service Bus Endpoint URI Shared Access Key 组成
问题陈述 - 我们在连接字符串中使用上述参数,它使用 react-native-azurenotificationhub 在我们的代码库中公开 URI+共享访问密钥,因此如果有人看到代码库,将能够通过此信息访问通知中心。这些可能导致以下威胁 如果有人可以访问代码,则可以向通知中心提出未经授权的注册请求。
可能的解决方案 -
Microsoft 推荐的安全性是创建仅用于侦听的访问策略,并建议不要使用完整的访问密钥进行客户端注册。(这必须在通知中心配置d,我一直在谈论) https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-security
官方文档建议仅在代码库中使用具有 Listen 访问权限的连接字符串。 https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-android-push-notification-google-fcm-get-started
从后端代码(我们自己的 API)处理注册过程,实习生使用 Notification Hub Rest Api 的,设备将调用平台服务(FCM 或 APS)并获取设备令牌,然后将设备令牌传递给后端 API,
For achieving above, we need to write our own code, and we cannot utilize the Azure SDK.
创建一个 Web API,它将根据环境从应用设置 JSON 返回连接字符串。将从设备调用此 API 以动态获取连接字符串。
We have discussed and finalized this solution as a workaround, and we are implementing the Web API part. However, this also has below downside -
a. Need one extra API call in order to perform the device registration to notification hub
b. At this point of time, our API is also not secure so anyone having access to the codebase can still access the final connection string. So the problem statement in the first place still not resolved.
请为我们提供最好的解决方案,让移动客户端可以安全地注册到通知中心。
请让我知道什么是最好的解决方案,