Worklight Adapter Basic Authentication Caching?

孤街醉人 提交于 2019-12-24 10:56:28

问题


I'm having an issue with basic authentication using a Worklight adapter. Whenever I authenticate to a REST URL, it authenticates fine. However, the authentication seems to create a session within the Worklight server.

Example Call

function getTaskList(username,password) {

    var input = {
        method : 'post',
        returnedContentType : 'json',
        path : 'rest/url',
        headers: {
            'Authorization': 'Basic '+base64Encode(username+':'+password),
        }   
    };

    return WL.Server.invokeHttp(input);
}

Whenver I attempt to login from another device, Worklight server thinks I'm already signed in. Can you turn off session support in Worklight server or prevent caching? I want to authenticate every time to the REST URL. How is this possible?


回答1:


in the <procedure> element of the adapter XML file you should add connectAs="endUser". The connection to the back end will be created with the user's identity.

I am sorry, I did not understand your question.

In order to authenticate every time what you need to do is in the connectionPolicy in the adapter XML file you need to change your cookiePolicy Attribute to IGNORE_COOKIES

<connectionPolicy xsi:type="http:HTTPConnectionPolicyType" cookiePolicy="IGNORE_COOKIES" maxRedirects="int"></connectionPolicy>


来源:https://stackoverflow.com/questions/14838087/worklight-adapter-basic-authentication-caching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!