Securing REST API with Spring Security.

http://www.baeldung.com/securing-a-restful-web-service-with-spring-security