Spring: Securing REST API with BasicAuth

The simpliest, yet effective way to secure Spring REST API is to use Basic Auth. I'm going to show how to do it with Spring Security. Note Basic Auth is stateless (no need to manage sessions) and simple to implement. However it should be used with https only if outside of a trusted network. Also … Continue reading Spring: Securing REST API with BasicAuth

Apache DefaultHttpClient Tutorial: execute HTTP GET request with params and BasicAuthentication

When dealing with REST webservices, the HTTP GET request is commonly used (very often with params). Apache's DefaultHttpClient has convenient methods that utilize making such requests. This is how I do it: Request data the URL that I am going to execute is: http://www.example.org:8001/rest/sendMessage GET request params are as follows: body: message body (content) from: … Continue reading Apache DefaultHttpClient Tutorial: execute HTTP GET request with params and BasicAuthentication

Android push notification tutorial: C2DM 3rd party Application server implementation

Here is how to implement C2DM server part in java for Google C2DM service using apache http-client and http-implĀ apache libs for REST webservice calls: Server Authentication in C2DM Service In order to send message to C2DM Server, first you have to authenticate your server with valid google account. Here is how to do it. Params: … Continue reading Android push notification tutorial: C2DM 3rd party Application server implementation