java.lang.Object
com.aoindustries.web.struts.ReCaptcha
Consolidates access to reCAPTCHA services.
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptioncreateSettings
(ServletContext servletContext) Builds the settings with credentials obtained fromgetGoogleCredentialsJson(javax.servlet.ServletContext)
.static String
getGoogleCredentialsJson
(ServletContext servletContext) Gets the path to the Google Credentials JSON file.static ProjectName
getProjectName
(ServletContext servletContext) Gets the project name.static String
getSitekey
(ServletContext servletContext) Gets the site key configured in application init parameters.
-
Method Details
-
getProjectName
Gets the project name.- Throws:
ServletException
- when no project name configured.
-
getSitekey
Gets the site key configured in application init parameters.- Throws:
ServletException
- when no site key configured.
-
getGoogleCredentialsJson
public static String getGoogleCredentialsJson(ServletContext servletContext) throws ServletException Gets the path to the Google Credentials JSON file.- Throws:
ServletException
- when no path configured.
-
createSettings
public static RecaptchaEnterpriseServiceSettings createSettings(ServletContext servletContext) throws IOException, ServletException Builds the settings with credentials obtained fromgetGoogleCredentialsJson(javax.servlet.ServletContext)
.See How to point GOOGLE_APPLICATION_CREDENTIALS to my JSON file? - Stack Overflow.
- Throws:
IOException
ServletException
-