nitros1980
(Matteo Natali)
November 21, 2023, 10:35am
#1
Hello everyone, I need to limit login, I’ll try to explain. I would like a user not to be able to log in at the same time (for example by another location) if it is already logged in.
it’s possible?
Sorry for the convoluted question
Bye
albudarov
(Alexander Budarov)
November 22, 2023, 9:48am
#2
Hi,
You can use authentication events to interrupt login process:
https://doc.cuba-platform.com/manual-7.2/login.html#login_events
Use UserSessionsAPI bean to traverse existing user sessions:
/*
* Copyright (c) 2008-2017 Haulmont.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.haulmont.cuba.security.app;
import com.haulmont.cuba.core.sys.UserSessionFinder;
import com.haulmont.cuba.security.entity.UserSessionEntity;
import com.haulmont.cuba.security.global.NoUserSessionException;
This file has been truncated. show original
nitros1980
(Matteo Natali)
November 22, 2023, 7:07pm
#3
Thank you Alexander…with usersessionapi how i can get the User’s Session’s Last Used to understand if a user is doing something?
Ciao
albudarov
(Alexander Budarov)
November 23, 2023, 9:25am
#4
Call method getUserSessionInfo(), and then UserSessionEntity.getLastUsedTs()