← Back to list

πŸ” Enforce Single Active User Sessions in OutSystems with Concurrent Session Control

βœ… Available on OutSystems Forge Β πŸ”— Concurrent Session Control (O11)

Kerollos Adel Β· 2025-07-02 20:40 Β· 1 claps Β· 3.7 min read
#outsystems #web-development #authentication #session-management #low-code
Open on Medium β†—
Wiki topics: BIZ · Business Strategy 🌐 · Web Development

πŸ” Enforce Single Active User Sessions in OutSystems with Concurrent Session Control

βœ… Available on OutSystems Forge πŸ”— Concurrent Session Control (O11)

πŸš€ Introduction

Many business-critical applications require users to have only one active session at a time. Whether for security, licensing, or data integrity, enforcing this rule can protect your system from misuse or unauthorized concurrent access.

That’s why I’ve developed the Concurrent Session Control component β€” now available on OutSystems Forge. This plug-and-play solution helps developers enforce single-session behavior in any OutSystems Reactive Web App with minimal configuration.

🧐 Why Concurrent Session Control?

By default, OutSystems allows users to log in from multiple devices or browsers at the same time. But this behavior is not always desirable in environments such as:

  • Banking and financial systems
  • E-learning platforms
  • Enterprise admin dashboards
  • Government and compliance-driven apps

These systems often require tighter control to prevent:

  • Account sharing
  • Session hijacking
  • Inconsistent data updates
  • Breach of license limits

🧩 What the Component Does

The Concurrent Session Control component handles:

  1. Token Generation: Upon login, a unique session token is created.
  2. Session Storage: The token is stored in an entity (ExclusiveUserSession) with timestamp and user ID.
  3. Session Invalidation: If a token already exists for that user, it is replaced.
  4. Client-Side Validation: A timer on the client continuously checks if the stored token is still valid.
  5. User Sign-Out: If the token is no longer valid (i.e., user logged in elsewhere), the current session is terminated with a notification.

βš™οΈ Key Features: Concurrent Session Control

πŸ—‚οΈ Entity: ExclusiveUserSession

πŸ“Œ Purpose: Stores session-related data πŸ§‘β€πŸ’» Fields: πŸ‘€ User ID πŸ” Token πŸ•’ Token Generation Time & Expiration Time

🧩 Actions

πŸ”„ GenerateUserTokenWithSingleSession

🎯 Generates a unique session token for the user 🚫 Ensures only one active session per user at a time

βœ… ValidateUserToken

πŸ” Checks whether the stored token is still valid πŸ“‰ Prevents usage if the token has expired or is invalidated due to a new login

βš™οΈ Site Properties

πŸ•“ UserTokenValidityDurationMinutes πŸ› οΈ Default Value: 180 minutes ⏱️ Controls how long the generated token remains valid 🧠 Can be customized based on security requirements

🧾 CheckTokenExpiration πŸ” A flag to control whether the system should validate token expiration πŸ“… Used to compare the token’s expiration DateTime against current server time βœ… Type: Boolean

πŸ§ͺ Demo Flow Included

A ready-to-use implementation that demonstrates:

πŸ’Ύ Storing the token in a Client Variable Variable Name: UserToken

πŸš€ Using On Application Ready to: πŸ” Validate the token every few seconds β›” Redirect users to the logout screen if their session becomes invalid

πŸ› οΈ How to Use It

[1] 🧠 Add Client Variable to Store the Current Token

πŸ“¦ Client Variable Name: UserToken 🧾 Type: Text

[2] πŸ” Modify Your Login Logic to Call GenerateUserTokenWithSingleSession

🧩 After a successful login, call the **GenerateUserTokenWithSingleSession** action to issue a unique session token for the user.

[3] πŸ’Ύ Store the Generated Token in a Client Variable

🧩 After calling GenerateUserTokenWithSingleSession, store the returned token in a client variable named UserToken.

[4] πŸš€ Create OnApplicationReady Event

[5] πŸ§ͺ Token Validation Strategy

βœ… Use ValidateUserToken on application load πŸ” Also call it periodically using setInterval() in JavaScript

🧠 Important Check: Before executing the validation, ensure the user is not anonymous and the UserToken exists to avoid unnecessary processing.

[6]πŸšͺ Log Out User if Token is Invalid

πŸ§ͺ This logic should run inside the OnApplicationReady loop (or setInterval) after calling ValidateUserToken.

βœ… Steps:

  1. πŸ” Call ValidateUserToken
  2. πŸ”„ Check the result
  • If the token is valid, do nothing
  • If the token is invalid, proceed with the following steps
  1. ⚠️ Show notification message to the user (e.g., β€œYour session has expired. Please log in again.”)
  2. πŸšͺ Log the user out
  3. πŸ” Redirect to the login screen

All steps are documented clearly in the Forge component.

πŸ’Ό Use Cases

  • Financial Apps: Prevent multiple simultaneous logins for the same user.
  • Admin Portals: Limit per-user access for license control.
  • Online Exams: Ensure a test-taker can’t access from multiple devices.

πŸ“₯ Download & Documentation

You can install the component and view full setup instructions here: πŸ”— Concurrent Session Control on Forge

🧠 Final Thoughts

Managing user sessions is essential to application security and user experience. With this component, you can enforce single-session policies easily in OutSystems without reinventing the wheel.

If you’re building secure apps with OutSystems, this tool can help you simplify session logic and strengthen your authentication strategy.


메타데이터
post_id
8eaab2b682bf
slug
enforce-single-active-user-sessions-in-outsystems-with-concurrent-session-control-8eaab2b682bf
url
https://medium.com/@kiroadel/enforce-single-active-user-sessions-in-outsystems-with-concurrent-session-control-8eaab2b682bf
canonical_url
https://medium.com/@kiroadel/enforce-single-active-user-sessions-in-outsystems-with-concurrent-session-control-8eaab2b682bf
author_url
https://medium.com/@kiroadel
status
ok
fetched_at
2026-06-25 12:15:08