Once we have created the authSsessionManager
we can get the username of the current signed in user using authSsessionManager.username()
. This method returns an empty string if no user is signed in.
username = authSsessionManager.username()
Usernames are case insensitive but are always stored in the driver as lowercase.
We then need to double check the user exists. We do this using the AuthManager
object created in the section on administering the auth environment.
if username and authManager.userExists(username): user = authManager.getUser(username) print 'Username %s is signed in'%user.username
The object returned by the authManager.getUser() method has the following properties:
Stores read only information about a user. You cannot set the values of the user with this class. Instead you should use the manager object described earlier in the documentation.
username = username.lower()