TrustComponent
Groovy
TrustCaptcha · Bot protection

Groovy CAPTCHA Integration

Protect the forms and logins of your Groovy application with a Groovy CAPTCHA. TrustCaptcha checks each request so you can decide what to allow, block or review. EU-hosted and GDPR-compliant, with no image puzzles.

Quickstart

How the integration works

1. Create a CAPTCHA

Create a user account or log in with an existing one. Then create a new CAPTCHA or pick an existing one. If you want to try TrustCaptcha first, every plan comes with a 14-day free trial.

The CAPTCHA overview page shows your site key and license key, and you create your API key there. Add your website’s domains to the authorized domains in the CAPTCHA security rules so they can use your CAPTCHA.

Start of the CAPTCHA creation form.
CAPTCHA security rules of a demo CAPTCHA.

2. Integrate the CAPTCHA widget into your frontend

Integrate the CAPTCHA widget into your website or app. The CAPTCHA widget guide in our documentation has step-by-step instructions.

Read the documentation

The CAPTCHA widget will then be displayed on your website or app:

CAPTCHA start

Pre-built frontend integrations
Our pre-built frontend integrations add the CAPTCHA widget to your website or application. If there is none for your frontend technology yet, your developers can integrate the widget themselves using our documentation or ask our support team for a pre-built integration.

Angular
Contact Form 7
Craft CMS
JavaScript
Joomla
JTL-Shop
Keycloak
Magento 2
React
Shopware 6
Svelte
TYPO3
Vue
Webflow
WordPress

3. Validate the CAPTCHA result in your backend

The following steps show how a Groovy backend fetches the CAPTCHA verification result from our server and decides what to do with it. For the full instructions, read the CAPTCHA integration guide for Groovy in our documentation.

Read the documentation

First, add our TrustCaptcha dependency for Groovy:

Maven Central
XML
<dependency>
  <groupId>com.trustcomponent</groupId>
  <artifactId>trustcaptcha</artifactId>
  <version>3.0.0</version>
</dependency>

Fetch the verification result from our server with the verification token and your API key:

Fetch Result
Groovy
// Retrieving the verification result
VerificationResult verificationResult
try {
  verificationResult = TrustCaptcha.getVerificationResult("<your_api_key>", "<verification_token_from_your_client>")
} catch (CaptchaFailureException e) {
  // Fetch verification result failed - handle error
}

Based on the verification result and your own requirements, decide how to proceed:

Handle Result
Groovy
// Act on the verification result
if (!verificationResult.isVerificationPassed() || verificationResult.getScore() > 0.5) {
  // Verification failed or bot score > 0.5 - possible automated request
}

Need detailed information about the Groovy CAPTCHA integration?
Our Groovy CAPTCHA integration guide has the detailed instructions, and our CAPTCHA samples repository on GitHub has a complete integration example.

Other backend technology instead of Groovy?
If you run something other than Groovy on your server, or have several backends, pick a different integration here. If we have no pre-built integration for your backend technology yet, your developers can integrate the CAPTCHA verification themselves using our documentation or ask our support team for a pre-built integration.

.NET
Go
Groovy
Java
Kotlin
Node.js
PHP
Python
Ruby
Rust
Scala

4. Test your integration

TrustCaptcha is now active. Send a test request and check that it goes through.

CAPTCHA done

FAQs

How does a Groovy CAPTCHA check work?
A Groovy CAPTCHA is a check your backend runs before it processes a request. In the browser, the widget solves a short proof-of-work task, sends signals for the risk assessment and adds a verification token to the form. Your Groovy backend passes that token and your API key to TrustCaptcha.getVerificationResult and learns whether the human verification passed, plus a bot score. That stops credential stuffing, spam and scraping before your code processes the request, and real visitors see no puzzle.
Can I use it in Grails, Micronaut or Spring Boot?
Yes. It is a plain JVM library from Maven Central (com.trustcomponent:trustcaptcha), so it works in Grails controllers, Micronaut and Spring Boot apps and plain Groovy code alike, with Gradle or Maven. Call it in the controller action or service that handles the form, before you save anything. For Micronaut and Spring Boot we have dedicated guides.
Where should I keep the API key in a Groovy app?
Keep it out of your source code. Read it from an environment variable or from your framework's configuration, for example application.yml in Grails or Micronaut with the value taken from the environment, and keep the real key in your secret store. If you need a custom API host, timeouts or a proxy, build one instance with TrustCaptcha.builder(apiKey) at startup; it is immutable and thread-safe.
Which exceptions should I catch?
All exceptions extend CaptchaFailureException, so one catch block covers a failed check. To handle outages separately, catch the two failover exceptions first. ServerUnreachableException means your server could not reach our API at all, and our documentation suggests allowing the request and logging the incident. ClientReportedServerUnreachableException means the widget reported an outage your server cannot confirm, so reject the request or ask for another check.
Is TrustCaptcha GDPR-compliant for EU deployments?
TrustCaptcha processes and stores all data exclusively in the EU on ISO 27001-certified infrastructure, so no data goes to the USA. It sets no cookies, and you can sign the Data Processing Agreement online. Whether your deployment is compliant also depends on your setup; this is not legal advice, so check the details with your data protection officer.
Can I customize the look and feel of TrustCaptcha?
Yes. The widget has 37+ languages ready to use, you can add any other language and override every text, and it comes in a light or dark theme or follows the system setting. From the Team plan you can change colors, borders and corner radius to match your Groovy or Grails UI. Removing our branding or hiding the widget completely is the paid Captcha Branding add-on.
How does TrustCaptcha keep bots out without hurting user experience?
The widget runs a proof-of-work in the background, and the bot score rates each request from multiple signals. When a request looks risky, the proof-of-work gets harder and the request can fail your threshold, while ordinary visitors never see a puzzle. Because attackers pay in computing time for every attempt, large-scale attacks become expensive.
Losing leads to CAPTCHAs?

TrustCaptcha blocks spam and bots, not customers. No puzzles, GDPR-compliant, EU-hosted.

CAPTCHA start
CAPTCHA done
No puzzles for visitors
The check runs in the background while visitors type, so more people finish your forms instead of giving up.
GDPR-compliant
Hosted in the EU, no cookies, encrypted transmission and automatic data deletion. Every customer gets a Data Processing Agreement.
Multi-layer security
Adaptive proof-of-work and risk scoring stop abuse early, even when attack traffic spikes.
Full control
Set the sensitivity, keep allow and block lists and use geoblocking. You decide how strict the check is.

Protect your Groovy application with TrustCaptcha in just a few steps!

  • EU-hosted & GDPR-compliant
  • No puzzles
  • Try free for 14 days