JCaptchaLoginModule

Last modified by RaffaelloPelagalli on 2007/12/01 02:31

JCaptchaLoginModule

Since jGuard 0.80, this loginModule permits to validate a user against a CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart), to determine if the user is human or not.

Captcha example

Here is an example of a challenge generated by JCaptcha:

SimpleListImageCaptchaEngineCaptcha_0.jpg

Only human people should be capable of reading quzXgwzG

generate the Captcha

To use this loginModule, you need firstly to insert in your login page, this kind of code to generate an image containing the challenge:

<img id="captcha" src="<html:rewrite action='/Captcha.do'/>" />

Note this code is used with the Struts framework, because we use the html:rewrite taglib to generate the url to access to the Captcha Action which will generate the image but you can use any framework to do the same thing.

To permit the user to answer to the challenge, you need also to insert in your login form the related fields:

<div>
    <label for="captchaAnswer">captchaAnswer(required)</label>
    <input id="captchaAnswer" type="text" value="" size="30" name="captchaAnswer"  tabindex="3" />
</div>

Validate the Captcha

To use this loginMoule, you need to insert in your JGuardConfiguration.xml file, this declaration:

<loginModule>
    		<name>net.sf.jguard.authentication.loginmodules.JCaptchaLoginModule</name>
		   	<flag>REQUIRED</flag>
		</loginModule>
Note that you can use other flags,depending on your needs.

Captcha library used

This loginModule use to generate and validate the Captcha, the JCaptcha open source library.

Note that the archive shipped with the distribution is not the last release; we use only the JCaptcha 1.0 RC2 release: since the release 1.0 RC3, the JCaptcha project has changed its licence from LGPL to GPL, which prevents us to ship it with jGuard (licensed under the LGPL). We've tested jGuard with JCaptcha 1.0 RC3 successfully, so we advice you to use this JCaptcha release if you accept that your application will be under the GPL umbrella.

Tags:
Created by diabolo512 on 2006/06/13 12:17

jGuard team copyright 2004-2009
3.1.1