Does the Ratchet connectioninterface has other properties than resourceId? - websocket

When you use WebSockets in PHP with Ratchet you can use $conn->resourceId to get the resource ID from the connection.
Does the connection has other properties or is the resource ID the only one?

Related

SAPUI5 WebSocket authentication

I have created a service in SAP backend that serves for websocket connections. I wanna connect to that service from SAPUI5 application. I connect to the service like this:
sap.ui.require("sap/ui/core/ws/WebSocket");
var socket = new WebSocket(
'ws://<host>:<port>/sap/bc/apc/sap/z_reg_test_push_ch');
When this piece of code is called I get:
WebSocket connection to 'ws://<host>:<port>/sap/bc/apc/sap/z_reg_test_push_ch' failed: HTTP Authentication failed; no valid credentials available
When I test the service from backend it will open the service url in chrome and asks me for credentials. Then when I refresh the UI5 app the webservice connection is established because the user has already logged in the same session in chrome when testing the service from backend.
In SAPUI5 app I can access the security token which was returned when connecting to oData service. I can access is like this:
var oModel = sap.ui.getCore().getModel();
oModel.getSecurityToken();
the token looks like this: cKYPxpo7-BELSah1D1WRgg==
I have found a thread that I should create the websocket connection like this:
new WebSocket('ws://<host>:<port>/sap/bc/apc/sap/z_reg_test_push_ch',["access_token", oModel.getSecurityToken()]);
But I get this message:
Uncaught DOMException: Failed to construct 'WebSocket': The subprotocol 'cKYPxpo7-BELSah1D1WRgg==' is invalid.
To sum it up. I am authenticated by the oData service via basic auth and I want to pass to the socket the authentication info.
I have found that to pass user credentials to the ICF service, you have to create the websocket like this:
new WebSocket('ws://<username>:<password>#<host>:<port>/<path_to_service>')
This, however, raises a security problem, since the connection is not secured, so every one can read the user credentials.
But I did not find any other solution of the authenticate a user.

Issue with connecting to magento connector in mule

I am trying to configure a magento connector into my anypoint studio.
I have a magento instance running locally and I have created a user and role for the SOAP requests.
On adding the magento connector to the flow, I try to test the connection using the following properties
Url: http://localhost/magento/api/v2_soap
magento user name and password which is the api key.
However when I test the connection, I get an error
org.mule.api.ConnectionException:(301) Moved Permanently
I also tried giving the url http://localhost/magento/index.php/ap...
However it gives the same error.
Is there any way to resolve this problem?
Username and API key will allows you to connect using Magento connector
EX: https://sashistore.gostorego.com + /api/v2_soap?wsdl is url
For Reference Please go through : http://www.magentocommerce.com/api/soap/introduction.html
Let me know if it works

how to make stateless web app with laravel

I will be using stateless web app architecture. For authentication I will be encrypting the authenticationid and putting it in client cookie and sending it to client as described here.
But I see that when a get request is send to the server, the response contains a cookie named laravel_session. I've read that for a stateless architecture, there should be no session as otherwise it would mean that session state is stored at server.
How to remove any kind of session from laravel to make my app stateless?
Set session driver:
Laravel v5.7.0: config/session.php
Laravel v4.2.0: app/config/session.php
cookie - a cookie-based session driver where session data is encrypted in the user's cookies.
array - session data is saved in a PHP array. Take note that the array session driver does not support persistence and is usually only used in console commands and tests.

How use in Mule ESB session like in web app?

in Mule ESB I use Object Store, but variable in Object store is global for all connection on my TCP connection, how do it different from other connection? Like session in PHP?
Just use a unique Object Store key as an access token you provide to each client. That's what a PHP session does: it provides a token in a cookie or the url and stores session data using that token as a key.

j_security_check returns 500 (Internal Server Error)

Im trying to do a Worklight form based authentication following this guide:
Using WebSphere DataPower as a Security Gateway for Protecting Mobile Traffic.
Iim using a WebSphere Application Server 8.0.0.6, Worklight 6.0.0(EE)and when i tried to login using the app, the console on the navigator returns this:
POST http:// localhost :9081/probandoEldap/apps/services/j_security_check 500 (Internal Server Error) "
and the following message:
"com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException: SESN0008E: An user authentication with anonymous has tried to access to a session which is property of user :defaultWIMFileBasedRealm/uid=wasadmin,o=defaultWIMFileBasedRealm.
IBM WebSphere Application Server"
Is there anything that I must config on my websphere to make it work?
This seems to be a problem associated with wrong cookie. If you look into the j_security_check call you will see LTPA [most probably by the name LTPA2] cookies going with it. The cookie contains id of user 'wasadmin'. If you remove this cookie from request the problem will go away. Are you using local file based authentication?
Ajitabh

Resources