Below are the Powershell commands that enables you to close the session of a login user after a defined time frame, if the user is idle or not doing any activity on the SharePoint Site.
  1. $sts = Get-SPSecurityTokenServiceConfig
  2. $sts.UseSessionCookies = $true
  3. $sts.FormsTokenLifetime = (New-Timespan –Minutes 5)
  4. $sts.LogonTokenCacheExpirationWindow = (New-Timespan –Minutes 5)
  5. $sts.Update()
  6. iisreset