Let us demonstrate the integration of Spring Security with Captcha. We have downloaded a
Kaptcha.jar Captcha provider for this purpose. We need to install the jar file into the maven local repository for the application to work.
The example is an extension of the previous recipe where an additional input, mobile number, was considered for authorization and authentication by Spring Security. In this example, we will get the code for username and password from the user along with the Captcha code. The username is authenticated against the database, and the requested Captcha and the Captcha entered by the user are also compared.
When the entire conditions match, the user is said to be authenticated or else the ...