Class ReCaptchaResponse

java.lang.Object
com.oorian.recaptcha.ReCaptchaResponse

public class ReCaptchaResponse extends Object
Represents the response from the Google reCAPTCHA verification API.

Contains the verification result, score, action name, and other metadata returned by the API.

Since:
1.0
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • ReCaptchaResponse

      public ReCaptchaResponse(com.oorian.json.JsonObject json)
      Creates a ReCaptchaResponse from the parsed JSON returned by the Google API.
      Parameters:
      json - the parsed JSON response object
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Returns whether the reCAPTCHA verification was successful.
      Returns:
      true if the token was valid
    • getScore

      public double getScore()
      Returns the reCAPTCHA score.

      The score ranges from 0.0 to 1.0, where 1.0 indicates the highest confidence that the interaction is from a human. Google recommends a threshold of 0.5 as a starting point.

      Returns:
      the score (0.0 to 1.0)
    • getAction

      public String getAction()
      Returns the action name that was passed when generating the token.
      Returns:
      the action name, or null if not present
    • getChallengeTimestamp

      public String getChallengeTimestamp()
      Returns the timestamp of the challenge in ISO 8601 format.
      Returns:
      the challenge timestamp
    • getHostname

      public String getHostname()
      Returns the hostname of the site where the token was generated.
      Returns:
      the hostname