Git Product home page Git Product logo

platform-sample-login-restrictions's Introduction

Login Restrictions

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

Objective

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.

Solution

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 com.company.loginrestrictions) we create the security subpackage (to keep clear structure and high code readability).

  2. Under the com.company.loginrestrictions.security 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="com.company.loginworkersample.security.MyLoginWorkerBean"/>. 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 app.properties file of the core module. See the license.concurrentSessionsLimit property.

Based on CUBA Platform 6.0.9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.