volttroncentral.sessions module

class volttroncentral.sessions.SessionHandler(authenticator)[source]

Bases: object

A handler for dealing with authentication of sessions

The SessionHandler requires an authenticator to be handed in to this object in order to authenticate user. The authenticator must implement an interface that expects a method called authenticate with parameters username and password. The return value must be either a list of groups the user belongs two or None.

If successful then the a session token is generated and added to a cache of validated users to be able to be checked against. The user’s ip address is stored with the token for further checking of authentication.

authenticate(username, password, ip)[source]

Authenticates a user with the authenticator.

This is the main login function for the system.

check_session(token, ip)[source]

Check if a user token has been authenticated.

@return:

A users session information or False.

clear()[source]