Worklight PushAdapter示例在开发env(即worklight studio)中工作正常,但在转移到生产时会发生夫妇问题。生产环境中的Worklight PushAdapter问题
由于安全问题,后端应用程序无法调用推送过程。如果设置为
securityTest="wl_unprotected"
,这可能是生产风险,还有其他解决方案?在
onPoll
函数eventSource
,如果调用其他适配器的过程,它也会在生产中提高安全性问题,虽然在dev中工作正常。
例如,
PushAdapter:
WL.Server.createEventSource({
name: 'PushEventSource',
onDeviceSubscribe: 'deviceSubscribeFunc',
onDeviceUnsubscribe: 'deviceUnsubscribeFunc',
securityTest:'SingleStepAuthAdapter-securityTest',
poll:{
interval: 120,
onPoll: 'getNotificationFromBackend'
}
});
function getNotificationFromBackend(){
var notifications = WL.Server.invokeProcedure({
adapter : 'MessageAdapter',
procedure : 'getMessages',
parameters : []
});
WL.Logger.error("notifications: " + JSON.stringify(notifications));
...
}
Error Messages:
[14-2-13 9:11:45:382 CST] 0000003d ht.integration.js.JavaScriptIntegrationLibraryImplementation E notifications: {"isSuccessful":false,"errors":["Runtime: The resource 'proc:MessageAdapter.getMessages' should only be accessed when authenticated in realm 'wl_antiXSRFRealm'."],"warnings":[],"info":[]} [project XXX]
你能帮助请?先谢谢了。