SysSession lets you record user login activity in a Turnkey application, including the client user-agent and IP address, and is intended for developers implementing or reviewing application login tracking.
Purpose
A SysSession represents a tracked user login activity. Use it when you need to identify information about the client that established a login, such as:
- The user-agent, which identifies the client software that made the request.
- The IP address, which identifies the client network address reported for the login activity.
For example, a SysSession record can help you review whether a user logged in from a browser or another client and which IP address was associated with that login.
Relationship to the login model
SysSession is part of the user-login pattern provided by SysUser together with SysSingleton.
- SysUser represents the user in the login model.
- SysSingleton is the primary application object for login information and the root object of a Turnkey application.
- SysSession adds a record of login activity and client details.
Use SysSession for activity tracking. Use SysSingleton when your application needs information about the currently logged-in user.
Add SysSession to a model
The SysSession class was added to the SysUserAuthentication merge file available from GitHub.
- Obtain the SysUserAuthentication merge file.
- Merge its SysSession class into your model.
- Verify that the merged model includes SysSession before relying on session tracking in application logic.
Do not assume SysSession exists in a model that has not been updated with this merge file.
Client details and current session context
SysSession records login activity. If you also need client details in the current application session, SysSingleton optional properties describes optional transient properties that Turnkey can populate:
| Property | Value supplied by Turnkey |
|---|---|
ClientIp
|
Client IP address |
UserAgent
|
Client user-agent |
These SysSingleton properties are transient and provide per-user-session context. They are not a replacement for a SysSession login-activity record.
