Worklight:没有用户 ID 的推送通知 [英] Worklight: Push notification without User ID

查看:26
本文介绍了Worklight:没有用户 ID 的推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请建议,是否可以在没有用户 ID 的情况下发送推送通知?假设我们想向所有下载我们应用程序的用户发送推送消息.或出于安全原因,用户 ID 不能存储在数据库中(或在应用程序中使用).

Kindly suggest, is it possible to send push notification without having user ID ? Lets say we want to send push messages to all users who have downloaded our App. OR due to security reasons, user IDs can not be stored in the DB (or used within the App).

推荐答案

不管怎样,您都需要一种方法来识别用户.它将归结为您认为是用户 ID"的内容.有一种方法可以在不使用永久用户 ID 的情况下区分用户.您可以使用持久性 cookie 领域.如果您将其添加到您的 authenticationConfig.xml 文件中:

One way or another, you need a way to identify the user. It will come down to what you consider to be a 'userID'. There is a way to distinguish between users without using a permanent userID. You can use the persistent cookie realm. If you add this to your authenticationConfig.xml file:

       <realm name="PersistentCookie" loginModule="WeakDummy">
            <className>com.worklight.core.auth.ext.PersistentCookieAuthenticator</className>
        </realm>

然后,当用户连接到工作灯服务器时,将为用户创建一个基于持久性 cookie 的唯一 ID:

Then a unique ID based on a persistent cookie will be created for the user when they connect to the worklight server:

"PersistentCookie":{"userId":"6410a0f9-98fb-4940-a127-da940c5d7e16","attributes":{},"isUserAuthenticated":1,"displayName":"6410a0f9-98fb-4940-a127-da940c5d7e16"}

用户或开发者不需要进一步的交互.只需将该类添加到 authenticationConfig.xml 即可生成用户 ID.

No further interaction is required by the user or the developer. Simply adding the class to authenticationConfig.xml is enough to generate the userID.

您可以使用此 cookie 为用户订阅推送通知.如果出于安全原因,您不想再通过这个persistentCookieID 标识该用户,那么您只需清除应用程序上的cookie,就会为该用户生成一个新ID.如果生成了新的persistentCookieID,他们将需要重新订阅推送通知.

You can use this cookie to subscribe a user for push notifications. If for security reasons you wish to no longer have this user identified by this persistentCookieID, then you can simply clear the cookies on the application and a new ID will be generated for the user. They will then need to resubscribe for push notifications if a new persistentCookieID is generated.

这篇关于Worklight:没有用户 ID 的推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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