Saturday, November 15, 2014

Implementing Token based Authentication and Form Authentication using Spring Security

In today's world, where technological ecosystem has developed so much that no system can work independently. Systems are integrated together to work in tandem and serve value to their users. Rather than users going to several systems to gather information, the concept has evolved to integrate all the required system together and present the information in simple consumable form for the user. Due to this paradigm shift, the systems are developed using Service Oriented Architecture (SOA). They expose services for their consumers to get information from the system without involving any complexity of integrating two heterogeneous systems.


The systems will have their regular login form for allowing users to login directly into it and get the required information. Along with this, the information retrieval can also be automated using APIs (REST, SOAP etc) and these APIs must be secured to allow authorized access.This post would demonstrate how Spring Security can be used to setup Form Authentication as well as Token based Authentication for REST Services. Here, I am making REST APIs as stateless endpoints and hence every access to APIs would be sending an authentication token along with it.

Saturday, November 1, 2014

Publish and Consume messages to RabbitMQ with Spring AMQP

Earlier in this post, I have demonstrated publishing and consuming messages to RabbitMQ message broker using RabbitMQ client library. When we are working on application which uses Spring framework, it makes sense to use spring-amqp library instead. However, it is not to say RabbitMQ client library cannot be used with Spring. Using spring-amqp offers advantages of loose coupling with message broker which enables to switch from one Message Broker to another without any major changes in the code.