Showing posts with label reCaptcha. Show all posts
Showing posts with label reCaptcha. Show all posts

Wednesday, March 23, 2011

Integration reCaptcha with Spring MVC

When I was explaining about reCaptcha on my previous entry, I made reference to my little-store example app, which basically has a bunch of frameworks (the idea is implement those technologies that I want to learn or just practice).

What I did is really simple, the first step was adding my new dependency to my POM
Then add to my webApplicationContext.xml my new reCaptcha bean
You must get the keys from the official website by adding your site. On my case I put the keys in a properties file, and then by using spring I loaded that file


Next in my Controller I used my ReCaptcha bean, like this
As you could see, this code populates a variable (reCaptcha) which I'm going to display on my JSP using JSTL:
${requestScope.reCaptcha}
Inside of a HTML FORM

Finally, this is how I validated the confirmation text (you must be expecting these 2 params: recaptcha_challenge_field and recaptcha_response_field)

The only problem I faced was related to my flow (which screen should I display), but besides that the implementation is really straight forward, simple!

Sunday, March 20, 2011

reCaptcha - FREE anti-bot service that helps digitize books

Did you remember one of my entries where I implemented jCaptcha???
If you don't know what I'm talking about this is the entry

Now that we understand each other, just for things of the destiny (¬¬ yeah of course!), I found something about "Digitizing Books One Word at a Time" from Google and how many times you've seen this Captcha.


Actually, you can implement it on the same way with jCaptcha, but you need more customization, at the end it has Pros and Cons both solutions, but as an Architect, I take in consideration 2 main factors:
  • Is your App going to be in a closed environment?? Is it going to have access to Internet?? (One thing is that you can access your app through web and something else is that your Network and Server configuration doesn't allow your app to interact with other websites)
  • Do you want to have full control of your App?? Then you don't want to share anything about your app with any external entity, you don't need external Black Boxes (you can re-invent the wheel for you, can't you?)
For this particular situation, I'd prefer to share something with the world, I mean I don't care if Google knows that I'm using its service, My App can share and cooperate with the rest of the world, because I'm not using critical information (for my purposes: Educational)

Then let's begin...
.
What is reCAPTCHA?
reCAPTCHA is a free CAPTCHA service that protects your site against spam, malicious registrations and other forms of attacks where computers try to disguise themselves as a human; a CAPTCHA is a Completely Automated Public Turing test to tell Computers and Human Apart. reCAPTCHA comes in the form of a widget that you can easily add to your blog, forum, registration form, etc.


In my next entry I'll be implementing this reCaptcha in my little-store app :)
So I'll see how it works and how hard is to implement it (obviously I'll need to install the library on my local Maven Repo) and use Scriptlets "duh!"
But as people say, if life gives you lemons, make lemonade and that's what I'm going to do