Atmosphere push - Securing channels - primefaces

My question regarding how to secure the channel in an Application using Atmosphere pub/sub.
I'm using Primefaces 3 & GlassFish server for this purpose.
Whenever I create a channel and subscribe to it, I can always see the WebSocket url in cleartext in the dev console/firebug in chrome (for instance). Can somebody sneak into subscribing to my channel? If yes, How can I secure my channel (SSL/Https maybe?). Or do I need to encrypt the channel name whenever I add new one.
Please let me know If I'm not clear with my query.
Thanks!!!

just use https/wss as URL instead of http/ws (make sure SSL is properly configured with GlassFish)
Thanks
-- Jeanfrancois

Related

Custom Authentication with 2 Sync Gateway

I'm trying add Custom Authentication. I use 2 instances of Sync-Gateway behind an Nginx.
So how can we manage Session with 2 instances of Sync-Gateway?
The custom authentication is achieved by calling the "//_session" endpoint. This then returns a cookie that logs me in for the first Sync-Gateway. If I now want to synchronize the second Sync-Gateway too, I make a call to "//_session" which overrides the first cookie.
Is there any way to create a global Session?
Please see this answer, from bbrks, here: https://forums.couchbase.com/t/custom-authentication-with-2-sync-gateway/29762 :
If you’re using 2 separate CB buckets/SG databases, they’re completely
independent systems and user-information is not shared between them.

Azure fails when try to create a MySQL database

When I try to create a MySQL database on Microsoft Azure using pure REST request (PUT) to:
https://management.azure.com/subscriptions/<subscriptionid>/resourceGroups
/resource-<id>/providers/successbricks.cleardb/databases/<my-database>?
api-version=2014-04-01
I am getting this error:
HTTP STATUS CODE 400 Bad Request
Error message: 'Legal terms have not been accepted for this item on
this subscription. To accept legal terms, please go to the Azure
portal (http://go.microsoft.com/fwlink/?LinkId=534873) and configure
programmatic deployment for the Marketplace item or create it there
for the first time'
So I went to Microsoft Azure Portal, and I accepted the legal terms. I tried again, same error. I searched in almost the entire Azure Portal for some configuration about this and I found nothing.
Someone have the same problem?
Thanks.
you should not only accept the terms but follow the procedure of making the programmatic access possible. It should be on the license page.
Programmatic deployment only can be found in Virtual Machines MySQL, not in Data Storage MySQL Database. Try REST request after you enabled programmatic Deployment.
In addition, I successfully created a MySQL database using REST API without reproducing your question, but note that the request body need to be sent as well when using PUT request.
OK guys, found the solution. I don't know why, but if we change the JSON attribute { "plan.name": "Pay-As-You-Go" } to { "plan.name": "Free" } the database is created successfully.
I opened a support ticket to know which are the MySQL available plans. I will update the answer as soon as possible.

Registering on No-quota push notifications

On my WP8 app, I followed instructions from here to register on push notifications service MPNS.:
HttpNotificationChannel pushChannel;
// The name of our push channel = the CN from certificate
string channelName = "CN-from-cert";
However, channel URI returned from the MPNS is always http:// and it seems like it's not using this secured connection. So, my question is:
How can I verify if my channel is using no-quote (secure) connection
What is needed on the client side (WP8 app)?
What is needed on the server side (sending push notifications)?
Many thanks.
I think you need to set ServiceName property (not channelName) to your service's domain name exactly as it appears on CN property in the server certificate that you will use. P.e., if your certificate's CN=www.mydomain.com, you must set Channel.ServiceName="www.mydomain.com". Channel name my be anyone that you like. This is at client side.
At server side you need to upload your cert file to developer.windowsphone.com dashboard and to your server too (with the private key).
You can check if MPNS recognize your secure channel by checking if channel URI generated starts with https:// instead http://. This not ensure that your server can send trusted notifications since it depends on if you have the same certificate in your server and specify it correctly in all petitions, but tells you that client side is ok.
You have detailed information about how to configure your server here:
http://msdn.microsoft.com/en-US/library/windowsphone/develop/ff941099%28v=vs.105%29.aspx
Best practices to implement a push notification system (including authenticated servers):
http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/10/22/recommended-practices-for-using-microsoft-push-notification-service-mpns.aspx

Neurosky Mindwave & Websockets

I'm currently trying to make a connection to the Neurosky Mindwave sensor using a websocket in HTML5. The Mindwave makes use of the Thinkgear Connector which I in turn use to connect to. I connect to the Thinkgear Connector using the default host address 127.0.0.1 with port 13854.
Basically all I do is this:
var socket = new WebSocket('ws://127.0.0.1:13854');
If I run the script the Thinkgear Connector indicates there's a connection, except the .onopen event is never fired. If I check the readyState I get a value of 0, indicating the connection has not yet been established. I think it's because in order to get one I have to send an authorization request first, which will be in the form of the appName & appKey, for example this:
{"appName":"Brainwave Test","appKey":"0139ccebc1902e0905b11bebc63c82eecada5784"}
The problem though is how to send an authorization request? Anyone have any ideas how to do this?
If you're not wedded to the idea of using the ThinkGear Connector driver, you can connect directly to the Bluetooth headset using the (Java) mindwave-bluetooth library, register a listener for each event type, and push a WebSocket message out for each event. That's not quite what you're asking for, but it's an option in lieu of a full WebSocket-to-ThinkGear Connector solution.

Starting multiple HTTP listeners on IIS using C#.NET 2.0

I have two windows services running on the same machine. Both the services uses
private HttpListener listener;
I specify the baseURL as "http://IPAddress:8080/" & "http://IPAddress:8081/" respectively for each of the services. Then I do the needful and call
listener.Start();
The first service starts successfully at 8080 port. But when I now start the 2nd service,
I get HTTPListenerException "The process cannot access the file because it is being used by another process" for listener object.
Could anybody please tell me:
1) If it is possible to start two HTTP listeners on the same IIS at two different ports.
2) If yes, how can we achecive this?
3) Is there any other way of doing this?
For your information:
I am using C#.NET 2.0 and IIS 6.0 server.
Thanks & Regards,
Hari
Doesn't HttpListener work independently from IIS? Can you stop the IIS service and see what happens?
Or maybe port 8081 is used by another program or process. I suggest to try to set the port to another number. You could open a command line and execute the "netstat" command to see if the port is used before starting your services.
(source: googlepages.com)
The HTTPListener is indeed not a part of the IIS. It's just C# code.
did you do it like this?
String[] prefixes = { "http://localhost:8280/", "http://localhost:8281/"};
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://localhost:8280/");
listener.Start();
1) If it is possible to start two HTTP listeners on the same IIS at two different ports.
Yes, it is. But listeners on the IIS is not made through code, it's through the IIS administration tool, so that's probably not what you're trying to do. IIS is separate from the c# code you're attempting.
2) If yes, how can we achecive this?
Try some other port numbers (like 58080 and 58081) and try replacing "IPAddress" with "localhost". Most likely your port number is used by some other web server
3) Is there any other way of doing this?
If you're trying to serve web pages, you probably wan't to make a web application instead of making your own HTTP server
If you're doing something custom, you might want to take a look at WCF (Windows Communication Foundation), as it's the new framework for web, sockets, web services etc. and it's what MS will be using going forward
It's usually a good idea to take a quick look at this page when using port numbers...just to make sure a temp number you're trying to use isn't in use already.