{"id":21430076,"url":"https://github.com/cuba-platform/sample-login-restrictions","last_synced_at":"2025-03-16T21:44:50.002Z","repository":{"id":85315556,"uuid":"55236634","full_name":"cuba-platform/sample-login-restrictions","owner":"cuba-platform","description":"Customizing the user login procedure","archived":false,"fork":false,"pushed_at":"2019-09-05T14:59:17.000Z","size":146,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-01-23T08:19:29.248Z","etag":null,"topics":["cuba-sample"],"latest_commit_sha":null,"homepage":"https://www.cuba-platform.com","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cuba-platform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-01T14:02:33.000Z","updated_at":"2020-08-13T18:53:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"223c32e7-96c8-431b-beb1-592729b87737","html_url":"https://github.com/cuba-platform/sample-login-restrictions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fsample-login-restrictions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fsample-login-restrictions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fsample-login-restrictions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuba-platform%2Fsample-login-restrictions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuba-platform","download_url":"https://codeload.github.com/cuba-platform/sample-login-restrictions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243940063,"owners_count":20372044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuba-sample"],"created_at":"2024-11-22T22:20:33.987Z","updated_at":"2025-03-16T21:44:49.980Z","avatar_url":"https://github.com/cuba-platform.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Login Restrictions\n\nThis project highlights how developers can customize and manipulate with user login procedure in a CUBA application.\n\n## Objective\n\nLet’s assume that our CUBA application should be licensed as following:\n\n* More than X concurrent users cannot access the system.\n* The license has global expiration date when all users will not be able to login.\n\n## Solution\n\nTo add custom behaviour for user [login](https://doc.cuba-platform.com/manual-6.10/login.html) we need to create `LoginEventListener` class that will be handle login events in the platform by following the specified steps:\n\n1. 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).\n\n2. Under the `com.company.loginrestrictions.security` package we create `LoginEventListener` class with `@Component` annotation.\n\n3. Create method with `BeforeLoginEvent` input parameter and add `@EventListener` annotation to it. It means this method will be invoked when BeforeLoginEvent is triggered.\n\n4. To access the license properties we use standard [configuration interfaces](https://doc.cuba-platform.com/manual-6.10/config_interfaces.html) mechanism provided by the CUBA Platform. See the `LicenseConfig` interface. It contains the default values of the license parameters.\n\n5. The default license parameters are overridden in the `app.properties` file of the `core` module. See the `license.concurrentSessionsLimit` property.\n\nBased on CUBA Platform 6.10.1\n\n## Issues\nPlease use https://www.cuba-platform.com/discuss for discussion, support, and reporting problems coressponding to this sample.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuba-platform%2Fsample-login-restrictions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuba-platform%2Fsample-login-restrictions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuba-platform%2Fsample-login-restrictions/lists"}