fr.cnes.sitools.security.captcha
Class Captcha

java.lang.Object
  extended by fr.cnes.sitools.security.captcha.Captcha

public class Captcha
extends java.lang.Object

Sitools Captcha

Author:
jp.boignard (AKKA Technologies)

Constructor Summary
Captcha(int width, int height, int length)
          Constructor
 
Method Summary
 boolean check(java.lang.String response)
          Compare internal masked answer with a response.
 java.lang.String getAnswer()
          get the answer of the captcha
 java.lang.String getId()
          Get captcha identifier
 java.awt.image.BufferedImage getImage()
          Get the generated image.
 long getTimeMillis()
          get SystemTimeMillis at Captcha new instance Time.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Captcha

public Captcha(int width,
               int height,
               int length)
Constructor

Parameters:
width - int width in pixel of the required generated image
height - int heigth in pixem of the required generated image
length - int number of characters for the generated answer
Method Detail

getId

public java.lang.String getId()
Get captcha identifier

Returns:
String to be used in a Container.

getImage

public java.awt.image.BufferedImage getImage()
Get the generated image. After a first call, the image could be null.

Returns:
BufferedImage

getTimeMillis

public long getTimeMillis()
get SystemTimeMillis at Captcha new instance Time.

Returns:
long

check

public boolean check(java.lang.String response)
Compare internal masked answer with a response.

Parameters:
response - String
Returns:
boolean true if identical

getAnswer

public java.lang.String getAnswer()
get the answer of the captcha

Returns:
String, the answer of the captcha.Useful for tests


Copyright © 2010-2013 CNES. All Rights Reserved.