1.2.7.2 AuthSession Object

The AuthSession object is aliased as web.auth.session and should be used as web.auth.session.

class AuthSession( store, [expire=0], [idle=0])

store
A valid web.session Store object.

expire
An integer specifying the number of seconds before the user is signed out. A value of 0 disables the expire functionality and the user will be signed in until they sign out. Note: If the underlying session expires, the cookie is removed or the sign in idles before the expire time specified in expire the user will be signed out.

idle
An integer specifying the maximum number of seconds between requests before the user is automatically signed out. A value of 0 disables the idle functionality allowing an unlimited amount of time between user requests. Note: If the underlying session expires, the cookie is removed or the sign in expires before the idle time specified in idle the user will be signed out.

For managing the auth information stored in the session store.

Has the following attributes which should not be set.

store
The session store used to store the auth session information

expire
The expire time

store
The idle time

Has the following methods:

username( )
Returns the username as a string if a user is signed in, otherwise returns an empty string ''.

signIn( username)
Sign in the user with username username.

signOut( )
Sign out the signed in user.

userInfo( )
If a user is signed in, returns a dictionary with the following keys: 'username', 'started', 'accessed', 'expire', 'idle'. If no user is signed in returns None.