Search code examples
cas

CAS 3.5.2 - Login workflow Customization


I am using CAS 3.5.2. I have a requirement to send some details to a CAPTCHA third party before authentication and show captcha in login screen if required. How do i customize / override the class that handles the login?


Solution

  • How do i customize / override the class that handles the login?

    The class that handles the login attempt is a Spring Webflow action that is AuthenticationViaFormAction.java and its submit method. Assuming you are using a CAS overlay, you can create the folder structure src/main/java/org/jasig/cas/web/flow/ in the root directory of your overlay, and then copy that Java file in there by its exact name from here. Then customize the class, build and repackage and at runtime, your compiled version of the class will be used instead of the one that ships with CAS by default.

    To make sure the build is successful, you will need to make sure that,

    • Your maven overlay contains the maven compiler plugin
    • Your maven overlay contains all other dependencies that would be required at compile-time to compile the new overlaid class.

    This class is automatically auto-wired into the Spring Webflow definition as a Spring Bean, and so all you need to do is to make sure the build and repackaging of it is successful.