Spring Security with MongoDB
In this section let's see how Spring Security works with MongoDB. MongoDB is a popular NOSQL database. It is a document based database. MongoDB is written in the popular C++ database which makes it an object oriented document based database. In MongoDB queries are also document based, and it also provides indexing using JSON style to store and retrieve data. The latest Spring version available is Version 3.2 has been included in the POC.
Getting ready
Download the MongoDB database
Configure the data folder
Start MongoDB in command prompt
Start MongoDB in another command prompt
Create
horrordb
database by inserting data into itExecute the command
use horrordb
Add MongoDB dependency to the POM (Project Object Model) file
Add JSON dependency to the POM file
Upgrade the Spring Version to 3.2.0 and Spring Security to 1.4
Create a
MongoUserDetails
classEdit the
horror-movie
servletEdit the
Application-security.xml
file
How to do it...
The following steps use Mongo with Spring...