Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

captcha in login form

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I would like to add captcha to a login form, how can I implement it?
 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although I have not implemented captcha in any login form, but , i do have some fair idea of it. So i am sharing my thoughts on it

a. captcha is any randon alphanumeric string used for authentication in login form. We can write a simple java class to generate random
aplhanumeric strings which can be shown on jsp page. I assume you know how to display a captcha string on jsp page and use it in validation in furthur processing after form submission.

b. you can use website like http://recaptcha.net/ to have autogenerated captcha

Below mentioned is the link of a pdf from "Spring in Practice" book by Manning publication.
Refer to section 4.4 Use CAPTCHAs to prevent automated user account creation where it is mentioned how to use captcha in spring login form.

http://www.manning.com/wheeler/SIP_Wheeler_MEAP_ch4.pdf

Hope all this explanation helps you

~ abhay
 
misha nesterenko
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have already done it.
I have used reCaptcha, no problems here. Main problem was to intercept authentication process to check captcha and reject authentication whenever that is necessary. I don't know if my way is the best one, so if there is better solution I would like to hear it . I had to declare my own authentication provider sublassed from DaoAuthenticationProvider and there I overrode additionalAuthenticationChecks, that is a place where I verify captcha. Moreover I subclassed WebAuthenticationDetails to save captcha from request for subsequent verification. That was a bit difficult to tie together, as I am new to spring and had to search internet for lots of things.
 
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!