Integrating Spring Security with Apache CXF RESTful web service
In this section let us create an Apache CXF RESTful web service. It is an open source web service framework. Let's use BASIC authentication for this demonstration.
CXF supports contract-first and contract-last web services. It also supports RESTful web services.
Let us integrate Spring Security with CXF and authorize a RESTful web service.
Getting ready
Add the
cxf
dependency to thepom
fileSet up the RESTful web service with CXF
Configure the
spring-security.xml
file
How to do it...
The following are the steps to integrate Spring Security with Apache CXF RESTful web services:
Configure the
Book
POJO class.@XmlRootElement(name = "book") public class Book { private int book_id; private String book_name; private String book_publication; private String book_author; public Book(int book_id, String book_name, String book_publication, String book_author) { this.book_id = book_id; this.book_name = book_name...