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

查看:106
本文介绍了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).

推荐答案

单向或者,您需要一种方法来识别用户。它将归结为您认为是'userID'的内容。有一种方法可以在不使用永久用户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即可生成userID。

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天全站免登陆