|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.weborganic.bastille.recaptcha.ReCaptcha
public final class ReCaptcha
A simple object encapsulating the ReCaptcha configuration.
Field Summary | |
---|---|
static String |
DEFAULT_HTTP_SERVER
The default URL to connect to. |
static String |
DEFAULT_HTTPS_SERVER
The default secure URL to connect to. |
static String |
VERIFY_URL
The verify URL to use. |
Method Summary | |
---|---|
static ReCaptcha |
newReCaptcha()
Creates a new ReCaptcha instance from the Bastille properties. |
String |
privateKey()
Returns the private key to connect to the ReCapatcha server. |
String |
publicKey()
Returns the public key to connect to the ReCapatcha server.. |
String |
server()
Returns the URL of the reCaptcha server. |
void |
toXHTMLForm(XMLWriter xml,
String message)
Writes the form to display the captcha as XHTML. |
static ReCaptchaResult |
verify(ContentRequest req)
Automatically create a ReCaptcha instance and verify the standard parameters send. |
ReCaptchaResult |
verify(String remoteAddr,
String challenge,
String response)
Invoke the reCaptcha Verify API to check whether the challenge has been passed by the user. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_HTTP_SERVER
public static final String DEFAULT_HTTPS_SERVER
public static final String VERIFY_URL
Method Detail |
---|
public String publicKey()
public String privateKey()
public String server()
public ReCaptchaResult verify(String remoteAddr, String challenge, String response) throws ReCaptchaException
All three parameters are required by the ReCaptcha server.
remoteAddr
- The remote addresschallenge
- the challenge (supplied by the original ReCaptcha form)response
- The response to the challenge (from the user)
ReCaptchaException
- if either argument is null
public void toXHTMLForm(XMLWriter xml, String message) throws IOException
xml
- The XML outputmessage
- the error message from the server (may be null
)
IOException
- if thrown while writing the XMLpublic static ReCaptcha newReCaptcha() throws ReCaptchaException
bastille.recaptcha.public-key
bastille.recaptcha.private-key
bastille.recaptcha.server
bastille.recaptcha.secure
ReCaptchaException
- If the server has not been configured properlypublic static ReCaptchaResult verify(ContentRequest req) throws ReCaptchaException
req
- The content request.
ReCaptchaException
- If the server has not been configured properly
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |