Ticket T1285606
Visible to All Users

XAF - Forceful logout after inactivity does not work if user has unsaved changes

created 7 days ago

Hi,

For security reasons we wish to implement a forceful logout with a corresponding redirect after a configurable amount of time (i.e., "Session Timeout" after 15 minutes of inactivity). This works reasonably well, unless the user has unsaved changes when the forced logoff occurs. In that case the browser generates a Javascript alert (see screenshot below) and does not perform the redirect.

We are already calling IUnsavedChangesConfirmationService.ClearState() before the forced logoff which makes the Blazor confirmation dialog disappear, but the JavaScript-one from the browser remains.

After this forceful logout we want to redirect to a specific page notifying the user that we quit their session due to inactivity. Out-of-the-box this is currently not really configurable if using external authentication (single-sign-on using OAuth). There is apparently a way to do it with for Win-Auth with WindowsActiveDirectoryAuthenticationProviderOptions.SignOutRedirect which would be nice to have in the base-class ExternalAuthenticationProviderOptions instead. This way it could also work for other SSO methods without much changes to your code and probably without breaking compatibility.

To Reproduce
Open the attached sample solution based on your MainDemo and reproduce the behavior as follows:

  1. Login as 'Sam'
  2. Open any employee
  3. Make changes to the employee without saving them
  4. Wait for about a minute before the timeout occurs
  5. A browser popup prevents the forced sign out from occurring

Expected behavior
User should be logged out and redirected to the logout page without any questions asked.

Screenshots
Clipboard-File-1.png

Additional context

  • The demo implementation here performs a forced logout after 1 minute of the ForceLogOffController becoming active (basically after login), so you need to be quick about making changes.
  • The forced logoff works if no unsaved changes exist.
  • Of course our actual implementation tracks user activity and multiple blazor sessions of the same user, etc. but the actual force logout problem remains the same.

Looking forward to your suggestions,
Kind regards
Chris

Show previous comments (4)
Andrey K (DevExpress Support) 3 days ago

    Hello,

    Thank you for your suggestion. In v24.2.6, we adjusted the behavior of the LogOff() method, so there is no need to call any additional code (such as IUnsavedChangesConfirmationService.ClearState) to permit an application to log off. Please update your app and test it.

    Let me know if this helps.

    Regards,
    Andrey

    C C
    Christoph Weinzierl-Heigl [msg] 2 days ago

      Hi Andrey,

      it seems the adjusted behavior you mention for 24.2.6 does not work if we're editing a ListView in BatchEdit mode (inside a popup).
      In this case a manual call to ClearState is still required to make the forced logout work. So sadly we still can't remove that workaround.

      All the best,
      Chris

      Herman (DevExpress Support) a day ago

        Hello Christoph,

        Thank you for the update.

        Please allow us additional time to discuss this within our team. We will update this ticket once we have information to share or if we require clarification.

        Best regards,
        Herman

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.