Spring Security framework has two key context objects which an application must interact with:
- – contains information about the current security context of the application, which includes detailed information about the user currently working with the application.
- – is used to create a object by implementing the single method of this interface:
There are four steps needed to secure a web application with a login page via the Spring Security framework:
- The user logs in with a name and a password. These two credentials are combined into an instance of the class . Then, they are passed to the for verification.
- If the username does not match the password, the is returned along with the message “Bad Credentials.”
- If the username and password match, it will return a populated instance.
- The user sets a security context by calling the method, where the object that returned from is passed.