Google reCAPTCHA

reCAPTCHA is a Google service that protects your CAS deployment from spam and abuse. It uses advanced risk analysis techniques to tell humans and bots apart. CAS supports the reCAPTCHA API v2 and v3.

Support is enabled by including the following module in the WAR Overlay:

1
2
3
4
5
<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-support-captcha</artifactId>
    <version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-captcha:${project.'cas.version'}"
1
2
3
4
5
6
7
8
9
dependencyManagement {
    imports {
        mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"
    }
}

dependencies {
    implementation "org.apereo.cas:cas-server-support-captcha"
}
1
2
3
4
5
6
7
8
9
10
dependencies {
    /*
    The following platform references should be included automatically and are listed here for reference only.
            
    implementation enforcedPlatform("org.apereo.cas:cas-server-support-bom:${project.'cas.version'}")
    implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
    */

    implementation "org.apereo.cas:cas-server-support-captcha"
}

The following settings and properties are available from the CAS configuration catalog:

The configuration settings listed below are tagged as Required in the CAS configuration metadata. This flag indicates that the presence of the setting may be needed to activate or affect the behavior of the CAS feature and generally should be reviewed, possibly owned and adjusted. If the setting is assigned a default value, you do not need to strictly put the setting in your copy of the configuration, but should review it nonetheless to make sure it matches your deployment expectations.

  • cas.google-recaptcha.enabled=true
  • Whether google reCAPTCHA should be enabled.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?

  • cas.google-recaptcha.score=0.5
  • reCAPTCHA v3 returns a score (1.0 is very likely a good interaction, 0.0 is very likely a bot). reCAPTCHA learns by seeing real traffic on your site. For this reason, scores in a staging environment or soon after implementing may differ from production. As reCAPTCHA v3 doesn't ever interrupt the user flow, you can first run reCAPTCHA without taking action and then decide on thresholds by looking at your traffic in the admin console. By default, you can use a threshold of 0.5.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?

  • cas.google-recaptcha.secret=
  • The google reCAPTCHA site secret.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?

  • cas.google-recaptcha.site-key=
  • The google reCAPTCHA site key.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?

    The configuration settings listed below are tagged as Optional in the CAS configuration metadata. This flag indicates that the presence of the setting is not immediately necessary in the end-user CAS configuration, because a default value is assigned or the activation of the feature is not conditionally controlled by the setting value. You should only include this field in your configuration if you need to modify the default value.

  • cas.google-recaptcha.activate-for-ip-address-pattern=
  • A regular expression pattern to indicate that captcha should be activated when the remote IP address matches this pattern, and otherwise skipped and disabled.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?

  • cas.google-recaptcha.invisible=false
  • Whether google reCAPTCHA invisible should be enabled.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?

  • cas.google-recaptcha.position=bottomright
  • The google reCAPTCHA badge position (only if invisible is enabled). Accepted values are:

    • bottomright: bottom right corner, default value.
    • bottomleft: bottom left corner
    • inline: allows to control the CSS.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?

  • cas.google-recaptcha.verify-url=https://www.google.com/recaptcha/api/siteverify
  • The google reCAPTCHA endpoint for verification of tokens and input.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?

  • cas.google-recaptcha.version=GOOGLE_RECAPTCHA_V2
  • Indicate the version of the recaptcha api. Accepted values are: V2, V3. Available values are as follows:

    • GOOGLE_RECAPTCHA_V2: V2 version of the recaptcha API.
    • GOOGLE_RECAPTCHA_V3: V3 version of the recaptcha API.
    • HCAPTCHA: hCaptcha.

    org.apereo.cas.configuration.model.support.captcha.GoogleRecaptchaProperties.

    How can I configure this property?