Customizing the user login procedure
Latest commit 0c8582a Dec 20, 2016 @natfirst natfirst Upgrade to platform-6.3.5
Failed to load latest commit information.
gradle/wrapper Apache 2.0 License Apr 1, 2016
modules Upgrade to platform-6.3.2 Oct 26, 2016
.gitignore Initial commit Feb 29, 2016
LICENSE Apache 2.0 License Mar 31, 2016 Upgrade to platform-6.3.5 Dec 20, 2016
build.gradle Upgrade to platform-6.3.5 Dec 20, 2016
gradlew.bat Add gradle wrapper Mar 31, 2016
settings.gradle Initial commit Feb 29, 2016

Login Restrictions

This project highlights how developers can customize and manipulate with user login procedure in a CUBA application.


Let’s assume that our CUBA application should be licensed as following:

  • More than X concurrent users cannot access the system.
  • The license has global expiration date when all users will not be able to login.


To add custom behaviour for user login we need to extend the LoginWorkerBean declared in the platform by following the specified steps:

  1. In core module, under the main project package (in our case we create the security subpackage (to keep clear structure and high code readability).

  2. Under the package we create MyLoginWorkerBean to extend the platform’s implementation of the LoginWorkerBean and override login() and loginByRememberMe() methods.

  3. To replace the original worker implementation with our MyLoginWorkerBean we register our class in spring.xml of the core module by adding: <bean id="cuba_LoginWorker" class=""/>. Now the overridden methods of the MyLoginWorkerBean class will be used when user logs in.

  4. To access the license properties we use standard configuration interfaces mechanism provided by the CUBA Platform. See the LicenseConfig interface. It contains the default values of the license parameters.

  5. The default license parameters are overridden in the file of the core module. See the license.concurrentSessionsLimit property.

Based on CUBA Platform 6.3.5