Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 17: Web Applications with Spring > Securing a Web Application with Spri...

Securing a Web Application with Spring Security

Suppose now we want to secure our contact application. Only those users who logged into the application with a valid user ID can add a new contact or update existing contacts. Other users, known as anonymous users, can only view contact information.

Spring Security is the best choice for securing Spring-based applications. Although mostly used in the presentation layer, Spring Security can help secure all layers within the application, including the service layer. In the following sections, we will demonstrate how to use Spring Security to secure the contact application.

Table 17-8 lists the dependencies required for Spring Security.

images

Configuring Spring Security

To configure Spring Security, first we need to configure a filter in the web deployment descriptor (web.xml). Listing 17-57 shows the code snippet you need to add to the web.xml file.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial