WL.Client.connect发送请求 [英] WL.Client.connect sending request

查看:271
本文介绍了WL.Client.connect发送请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个问题。

第一个问题:

请求之间有什么区别

I have two questions.
First question:
what is the difference between the request

D/wl.request (16655): WLRequestSender.run in WLRequestSender.java:40 :: Sending request http://mywebseal:80/worklight/authorization/v1/clients/instance

和请求

D/HttpPostRequestSender (3235): WLHybridRequestSender.run in WLHybridRequestSender.java:42 :: Sending request http://mywebseal:80/worklight/apps/services/api/<appname>/Android/init

我正在实现通过反向代理IBM WebSEAL使用登录表单的混合应用程序。我在Android Lollipop设备上进行测试。

测试期间 WL.Client.connect 只运行一次,并且已经执行了类 WLHybridRequestSender 的请求。

在其他尝试中,WL.Client.connect继续使用类 WLRequestSender发出请求并且没有对源代码进行任何修改。

WLRequestSender无法识别从Webseal Http Response返回的登录页面。

该应用已有没有改变,我不明白发生了什么以及为什么。

第二个问题:

WL框架如何使用WLHybridRequestSender或WLRequestSender决定是否发出请求?

I'm implementing hybrid app that uses a login form through a reverse proxy IBM WebSEAL. I'm doing the testing on Android Lollipop devices.
During the tests the WL.Client.connect has worked correctly only once, and has carried out the request with the class WLHybridRequestSender.
In other attempts WL.Client.connect continues to make the request using the class WLRequestSender and without any modification to the source code.
WLRequestSender is not able to recognize the login page that returns from the Webseal Http Response.
The app has not changed and I do not understand what happened and why.
Second question:
how the WL framework decides whether to make the request using WLHybridRequestSender or WLRequestSender?

对于那些希望加深我正在实施 http://www-01.ibm.com/support/docview.wss?uid=swg24034222 。 1.0。

For those wishing to deepen I'm implementing http://www-01.ibm.com/support/docview.wss?uid=swg24034222 with Mobilefirst 7.0.0.00-20150729-1801 and IBM Security Access Manager for Web 8.0.1.0.

logcat错误如下:

The logcat error is the following:

D/NONE(16655): Request [/apps/services/api/ISAMforMobileFirst/android/init]
W/PluginManager(16655): THREAD WARNING: exec() call to WLAuthorizationManagerPlugin.getClientInstanceIdHeader blocked the main thread for 153ms. Plugin should use CordovaInterface.getThreadPool().
D/wl.request(16655): WLRequestSender.run in WLRequestSender.java:40 :: Sending request http://mywebseal:80/worklight/authorization/v1/clients/instance
E/wl.response(16655): WLResponse.responseTextToJSON in WLResponse.java:116 :: Response from MobileFirst Platform server failed because could not read JSON from response with text {
E/wl.response(16655): document.write(warningString);
E/wl.response(16655): }
E/wl.response(16655): else{
E/wl.response(16655): document.cookie = 'acceptsCookies=yes; expires=Fri, 13-Apr-1970 00:00:00 GMT';
E/wl.response(16655): }
E/wl.response(16655): org.json.JSONException: Expected ':' after document.write(warningString) at character 32 of {
E/wl.response(16655): document.write(warningString);
E/wl.response(16655): }
E/wl.response(16655): else{
E/wl.response(16655): document.cookie = 'acceptsCookies=yes; expires=Fri, 13-Apr-1970 00:00:00 GMT';
E/wl.response(16655): }
E/wl.response(16655):   at org.json.JSONTokener.syntaxError(JSONTokener.java:450)
E/wl.response(16655):   at org.json.JSONTokener.readObject(JSONTokener.java:379)
E/wl.response(16655):   at org.json.JSONTokener.nextValue(JSONTokener.java:100)
E/wl.response(16655):   at org.json.JSONObject.<init>(JSONObject.java:155)
E/wl.response(16655):   at org.json.JSONObject.<init>(JSONObject.java:172)
E/wl.response(16655):   at com.worklight.wlclient.api.WLResponse.responseTextToJSON(WLResponse.java:114)
E/wl.response(16655):   at com.worklight.wlclient.api.WLResponse.getResponseJSON(WLResponse.java:269)
E/wl.response(16655):   at com.worklight.wlclient.WLRequest.checkResponseForSuccesses(WLRequest.java:559)
E/wl.response(16655):   at com.worklight.wlclient.WLRequest.requestFinished(WLRequest.java:280)
E/wl.response(16655):   at com.worklight.wlclient.WLRequestSender.run(WLRequestSender.java:52)
E/wl.response(16655):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/wl.response(16655):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/wl.response(16655):   at java.lang.Thread.run(Thread.java:841)

虽然成功的logcat如下:

while the logcat in case of success is the following

D/NONE(3235): Request [/apps/services/api/ISAMforMobileFirst/android/init]
W/PluginManager(16655): THREAD WARNING: exec() call to WLAuthorizationManagerPlugin.getClientInstanceIdHeader blocked the main thread for 149ms. Plugin should use CordovaInterface.getThreadPool().
D/HttpPostRequestSender(3235): WLHybridRequestSender.run in WLHybridRequestSender.java:42 :: Sending request http://mywebseal:80/worklight/apps/services/api/ISAMforMobileFirst/android/init
I/chromium(3235): [INFO:CONSOLE(27)] "Entry: ISAMOAuthChallengeHandler.isCustomResponse()", source: file:///android_asset/www/default/js/ISAMOAuthChallengeHandler/ISAMOAuthChallengeHandler.js (27)
I/chromium(3235): [INFO:CONSOLE(30)] "{"request":{"options":{"method":"post","asynchronous":true,"contentType":"application/x-www-form-urlencoded","encoding":"UTF-8","parameters":{"isAjaxRequest":"true","x":0.858127806102857},"evalJSON":true,"evalJS":true,"timeout":45000,"onAuthentication":null,"isAuthResponse":null,"requestHeaders":{"x-wl-app-version":"3.4","x-wl-app-details":"{\"applicationDetails\":{\"platformVersion\":\"7.0.0.0\",\"nativeVersion\":\"1119668270\",\"skinName\":\"default\",\"skinChecksum\":1215343974}}","x-wl-clientlog-deviceId":"be86efe08752ad62","x-wl-clientlog-appname":"ISAMforMobileFirst","x-wl-clientlog-appversion":"3.4","x-wl-clientlog-osversion":"5.0.2","x-wl-clientlog-env":"android","x-wl-clientlog-model":"Android SDK built for x86","X-WL-ClientId":"29ea85036b812a83f9922245119483e32537ce54","X-WL-Session":"e63ad99f-2453-4bcb-8a7c-f989f8211485"},"optionalHeaders":{"x-wl-clientlog-deviceId":"be86efe08752ad62","x-wl-clientlog-appname":"ISAMforMobileFirst","x-wl-clientlog-appversion":"3.4","x-wl-clientlog-osversion":"5.0.2","x-wl-clientlog-env":"android","x-wl-clientlog-model":"Android SDK built for x86"}},"transport":{"timeout":45000,"status":200,"statusText":"OK","response":"<entire html login page webseal>"              
I/chromium(3235): [INFO:CONSOLE(34)] "Exit: ISAMOAuthChallengeHandler.isCustomResponse(), Response found but not CustomResponse for ISAMOAuthChallengeHandler -  returning false", source: file:///android_asset/www/default/js/ISAMOAuthChallengeHandler/ISAMOAuthChallengeHandler.js (34)
I/chromium(3235): [INFO:CONSOLE(25)] "Entry: ISAMLoginFormChallengeHandler.isCustomResponse()", source: file:///android_asset/www/default/js/ISAMLoginFormChallengeHandler/ISAMLoginFormChallengeHandler.js (25)
I/chromium(3235): [INFO:CONSOLE(29)] "{"request":{"options":{"method":"post","asynchronous":true,"contentType":"application/x-www-form-urlencoded","encoding":"UTF-8","parameters":{"isAjaxRequest":"true","x":0.858127806102857},"evalJSON":true,"evalJS":true,"timeout":45000,"onAuthentication":null,"isAuthResponse":null,"requestHeaders":{"x-wl-app-version":"3.4","x-wl-app-details":"{\"applicationDetails\":{\"platformVersion\":\"7.0.0.0\",\"nativeVersion\":\"1119668270\",\"skinName\":\"default\",\"skinChecksum\":1215343974}}","x-wl-clientlog-deviceId":"be86efe08752ad62","x-wl-clientlog-appname":"ISAMforMobileFirst","x-wl-clientlog-appversion":"3.4","x-wl-clientlog-osversion":"5.0.2","x-wl-clientlog-env":"android","x-wl-clientlog-model":"Android SDK built for x86","X-WL-ClientId":"29ea85036b812a83f9922245119483e32537ce54","X-WL-Session":"e63ad99f-2453-4bcb-8a7c-f989f8211485"},"optionalHeaders":{"x-wl-clientlog-deviceId":"be86efe08752ad62","x-wl-clientlog-appname":"ISAMforMobileFirst","x-wl-clientlog-appversion":"3.4","x-wl-clientlog-osversion":"5.0.2","x-wl-clientlog-env":"android","x-wl-clientlog-model":"Android SDK built for x86"}},"transport":{"timeout":45000,"status":200,"statusText":"OK","response":"<entire html login page webseal>"
I/chromium(3235): [INFO:CONSOLE(209)] "Entry: ISAMLoginFormChallengeHandler.isPasswordChangeResponse()", source: file:///android_asset/www/default/js/ISAMLoginFormChallengeHandler/ISAMLoginFormChallengeHandler.js (209)
I/chromium(3235): [INFO:CONSOLE(259)] "ISAMLoginFormChallengeHandler.isPasswordChangeResponse returning false - not a password change response", source: file:///android_asset/www/default/js/ISAMLoginFormChallengeHandler/ISAMLoginFormChallengeHandler.js (259)
I/chromium(3235): [INFO:CONSOLE(275)] "Entry: ISAMLoginFormChallengeHandler.isLoginFormResponse()", source: file:///android_asset/www/default/js/ISAMLoginFormChallengeHandler/ISAMLoginFormChallengeHandler.js (275)
I/chromium(3235): [INFO:CONSOLE(280)] "ISAMLoginFormChallengeHandler.isLoginFormResponse - pkmslogin.form found in response.", source: file:///android_asset/www/default/js/ISAMLoginFormChallengeHandler/ISAMLoginFormChallengeHandler.js (280)
I/chromium(3235): [INFO:CONSOLE(312)] "ISAMLoginFormChallengeHandler.isLoginFormResponse - Returning true.", source: file:///android_asset/www/default/js/ISAMLoginFormChallengeHandler/ISAMLoginFormChallengeHandler.js (312)

谢谢

在解释Idan之后,如果我通过直接指向MFS构建应用程序,应用程序将获取令牌。
然后我通过指向WebSEAL再次构建并且没有问题,因为它之前已经进行了自我注册。
如果我在Android设备上删除该应用程序的数据,则问题会再次出现,因为该令牌已被删除。

After the explanation of Idan if I build the app by pointing directly at MFS, the app acquires the token. Then I building again by pointing at the WebSEAL and works without problem, just because it has previously conducted the self registration. If I delete the data of the app on the Android device the issue comes up again, because the token is deleted.

所以我们可以通过说WebSEAL联结受到保护,它需要正确的表单身份验证。

So we can sum the problem by saying that the WebSEAL junction being protected, it requires properly form authentication.

但是在这个联结中有两个端点,都注册了连接。

But inside this junction there are both endpoints, both registration that connection.

也许它应该作为初始授权流的ISAM的特定配置?

Perhaps it should be made a specific configuration of ISAM for the initial flow of authorization?

我提到了WebSEAL但实际上是反向代理由IBM Security Access Manager for Web(ISAM)制作,它也拥有WebSEAL的功能。

I referred to the WebSEAL but actually the reverse proxy is made by IBM Security Access Manager for Web (ISAM), which also owns the capabilities of the WebSEAL.

在request.log中出现错误

In request.log on error appears this

unauthenticated 07 / Sep / 2015: 17: 25: 01 +0200 "POST / worklight / authorization / v1 / clients / instance HTTP / 1.1" 200 3552

有用的日志WireShark?也许不会。无论如何你想要发送它,现在我必须生成它。

Is useful log WireShark? Maybe not. If you want to send it anyway, now I've got to produce it.

推荐答案

我解决了问题whit acl make like这个:

I solved the issue whit acl make like this:

pdadmin sec_master> acl create endpoint_auth
pdadmin sec_master> acl modify endpoint_auth set unauthenticated Tr
pdadmin sec_master> acl modify endpoint_auth set any-other Tr
pdadmin sec_master> acl attach /WebSEAL/<myObjectSpace>/worklight/authorization/v1/clients/instance endpoint_auth

现在一切正常;只有注册请求端点可供未经身份验证的用户使用
您对此解决方案有何看法?
问候

Now all work fine; only registration request endpoint is available for the unauthenticated users What do you think about this solution? Regards

这篇关于WL.Client.connect发送请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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