1 Reply Latest reply on Feb 22, 2017 4:29 PM by David Lustig

    [Keycloak] - Captcha on Login Page

    David Lustig Newbie

      I have recently been tasked with enhancing our Keycloak 2.5.1 login page with ReCaptcha functionality.  We currently are planning to use the default login page, and were originally under the impression that fields could be added to it using a FormAction provider.  It appears that login page is not compatible with the FormAction provider, though.  Various comments, including those on https://issues.jboss.org/browse/KEYCLOAK-4379 , have noted that the Authentication SPI should be used instead.  The problem I am running into is that it appears the Authentication SPI is only for adding new pages to the login flow; it does not appear to support modifying the existing login page, unless I'm missing something.  Is there a way to modify the existing login page and logic such that no attempts will be made to log the user in unless he enters the correct captcha, similar to the way ReCaptcha is implemented in the registration flow?

        • 1. Re: [Keycloak] - Captcha on Login Page
          David Lustig Newbie

          Someone from the Keycloak mail list contacted me and notified me that "You'll need to extend the user/password authenticator implementation to add the recaptcha stuff and at the same time add it to the freemarker template. That's it."  Extending the UsernamePasswordForm (and associated Factory), integrating the ReCaptcha code from the registration form action, deploying the jar just like any other custom authenticator, and updating login.ftl with the ReCaptcha div did the trick.