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]
你能幫助請?先謝謝了。