Sandeep created SSHD-1000:
-----------------------------

             Summary: Limit Max unique user session.
                 Key: SSHD-1000
                 URL: https://issues.apache.org/jira/browse/SSHD-1000
             Project: MINA SSHD
          Issue Type: New Feature
            Reporter: Sandeep


Hi Team we have MAX_CONCURRENT_SESSIONS  property but  I want limit Max unique 
user login.

e.g let say MAX_USER_LOGINS =10  then our server can allow max 10 unique user 
logins only.

Code :

 I have checked library code and created some sudo code using old method for 
max_concurrent_sessions as follows, 

Note * it does not have unique user check we can add it.

 
{code:java}
// code placeholder
public int getActiveSessionUserCount() {       
        IoSession networkSession = getIoSession();
        IoService service = networkSession.getService();
        Map<?, IoSession> sessionsMap = service.getManagedSessions();
        if (GenericUtils.isEmpty(sessionsMap)) {
            return 0;
        }        int totalCount = 0;
        for (IoSession is : sessionsMap.values()) {
            ServerSession session = (ServerSession) getSession(is, true);
            if (session == null) {
                continue;
            }            String sessionUser = session.getUsername();
            if (!GenericUtils.isEmpty(sessionUser)) {
                totalCount++;
            }
        }
        return totalCount;
    }
{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to