WebExpress 2.0.0‑alpha – The End of Server Sessions

WebExpress currently uses a stateful session model in which a server side session is created for each client. The session ID is stored in a cookie and transmitted with every request. Initially, the session is used solely to recognize the client and is only associated with an identity after successful authentication. User, role, and permission information then becomes available within the session context. As a result, the identity is bound to the session rather than the other way around.


This architectural model clearly separates the technical client context from the user identity and has proven itself in numerous applications. However, as requirements for scalability, containerization, and distributed cloud infrastructures continue to grow, this approach increasingly reaches its limits. Because authentication information is tied to the server side session context, session state must be maintained persistently and synchronized across multiple instances. This increases infrastructure complexity and makes horizontal scaling more difficult.

The next generation of WebExpress removes this coupling. Identities will be represented by cryptographically signed tokens. After a successful login, the IdentityManager generates a standardized token pair consisting of an access token and a refresh token. All information required for authentication and authorization is carried directly within the token and can be validated by the backend without relying on a centralized session store.

User authentication is therefore no longer based on a server side session but on a token based model. Credentials are submitted to the WebExpress login endpoint. The IdentityManager delegates authentication to the configured identity provider, or to the LocalIdentityProvider for local authentication scenarios. Once the username and password have been successfully verified, a standardized identity object containing user, role, and permission information is created. The IdentityManager then generates a cryptographically signed access token and refresh token. The short lived access token contains all claims required for authentication and authorization and represents the user's identity. Both tokens are transmitted to the browser as secure cookies. The access token is used to authenticate subsequent requests, while the refresh token is used exclusively to obtain new access tokens when they expire.

For all subsequent requests, the browser automatically sends the tokens. The backend extracts and validates the access token using its signature and claims. This allows the user's identity to be reconstructed immediately without loading a server side session context. The server only validates the token signature, expiration time, and claims, and then builds the current user identity from this information. Role and permission checks are performed directly on the data contained in the token. Access and refresh tokens are stored as HttpOnly, Secure, and SameSite protected cookies. In addition, the refresh token is restricted to the dedicated refresh endpoint. As a result, neither token is accessible to client side JavaScript and both are transmitted exclusively over HTTPS. Expired access tokens are renewed by means of the refresh token. Token rotation and server side revocation lists provide additional security.

When an access token expires, a new one is automatically requested through a dedicated refresh endpoint. The refresh token is sent by the browser and validated by the IdentityManager. After successful validation, a new access token is issued. Users can continue working without logging in again, while the lifetime of the access tokens actually used for authentication remains intentionally short. A new login is only required if the refresh token has also expired, been revoked, or is otherwise invalid.

The new architecture also provides the foundation for modern REST APIs. Since all information required for identification and authorization is already contained within the access token, every request carries all authentication data needed for processing. REST endpoints can operate entirely statelessly and no longer require a centralized session store or session replication. This significantly simplifies operation in containerized and cloud based environments and enables virtually unlimited horizontal scalability.

In addition to interactive user authentication, the architecture also supports technical clients through Personal Access Tokens. These tokens are intended for automation scenarios, scripts, command line tools, CI/CD pipelines, and server to server communication. A Personal Access Token directly represents an identity and can be configured with a limited lifetime and restricted permissions. It is transmitted as a bearer token in the Authorization header. Unlike access and refresh tokens, Personal Access Tokens are not automatically renewed and must be regenerated after expiration or revocation.

The new architecture establishes a unified foundation for integrating a wide variety of identity sources. Whether authentication is performed through local user management, an OpenID Connect provider such as Keycloak, an enterprise identity management system, or a Personal Access Token is no longer relevant to the application. Each authentication mechanism is transformed into a common identity model by the corresponding IdentityProvider and then exposed through standardized tokens. This abstraction simplifies the development of new applications and makes the framework more flexible, extensible, and future proof.

The new identity and authentication architecture represents an important step toward a modern, scalable, and cloud native platform. It provides the technical foundation for high performance web applications, stateless REST APIs, and flexible integration scenarios. At the same time, we view it as the starting point for the next stage in the evolution of WebExpress. Like every aspect of the framework, this architecture will continue to evolve. New requirements from real world projects, modern security standards, and innovative integration scenarios will continuously shape its development. We therefore welcome the exchange of ideas with developers, solution architects, and technology enthusiasts. Anyone interested in actively shaping the future of WebExpress is encouraged to contribute ideas, challenge existing concepts, and propose improvements. The best platforms emerge through collaboration within an engaged community. Together, we will continue to develop WebExpress into a framework that meets the requirements of both today's and tomorrow's applications.

Comments

Popular posts from this blog

WebExpress – A Moment to Recharge

WebExpress – The Journey

WebExpress 0.0.10-alpha – The REST APIs as the Foundation of the Table Architecture