org.xwiki.captcha
Interface CaptchaVerifier


@Role
public interface CaptchaVerifier

The CaptchaVerifier interface allows us to check if an answer to a captcha was correct.

Since:
2.2M2
Version:
$Id: a0d936242d71802c686690d934d9829710939944 $

Method Summary
 String getUserId(javax.servlet.http.HttpServletRequest request)
          Uses an HttpServletRequest object to get a unique id string to tell different users apart.
 boolean isAnswerCorrect(String captchaId, String answer)
          Check if the solution to a captcha is correct.
 

Method Detail

isAnswerCorrect

boolean isAnswerCorrect(String captchaId,
                        String answer)
                        throws Exception
Check if the solution to a captcha is correct.

Parameters:
captchaId - A String used to identify the captcha which is to be solved because multiple users may be solving captchas at the same time and which captcha belongs to who can't be confused.
answer - The provided solution.
Returns:
true if the solution is correct for the identified captcha.
Throws:
Exception - If for some reason the CaptchaService fails or cannot be reached, or if the CaptchaService has no record of any captcha gotten with the given captchaId.

getUserId

String getUserId(javax.servlet.http.HttpServletRequest request)
Uses an HttpServletRequest object to get a unique id string to tell different users apart. depending on the implementation, the id may be the servlet id or a generated value passed through a parameter.

Parameters:
request - The HttpServletRequest sent by the user who must be identified.
Returns:
A unique String representing the user who sent the request


Copyright © 2004-2013 XWiki. All Rights Reserved.