Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat periodic session checks #2032

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

bjoern-m
Copy link
Contributor

@bjoern-m bjoern-m commented Jan 24, 2025

Description

This PR includes an overhaul of session management within the SDK.

Implementation

  1. Improved Session Validation
  • Updated the Scheduler to support periodic and timeout-based session validation.
  • Added configurable intervals and callback mechanisms for enhanced session handling.
  1. BroadcastChannel Integration
  • Introduced the SessionChannel class to facilitate inter-tab communication for session-related events, including expiration, creation, and leadership requests for session validation.
  1. Visibility and Activity Tracking
  • Developed the WindowActivityManager to monitor window focus, blur, and visibility changes.
  • Ensures session validation occurs only in the active tab or window, optimizing performance and resource usage.
  1. Session Created Event Changes
  • The optional jwt field is no longer included in the session-created-event.
  • The expirationSeconds field has been deprecated.
  • Instead, the token claims are now passed through the session-created-event and shared across all browser windows or tabs.
  1. Deprecation of the is_valid() Function
  • The hanko.session.is_valid() function is now deprecated.
  • It now functions similarly to await hanko.sessionClient.validate() by requesting the API to check the session but blocks the browser threads.
  • Users are advised to use the non-blocking hanko.sessionClient.validate() instead.
  1. Local Storage Clean-Up
  • Removed the need to store session-related information, such as the JWT or its expiry, in local storage.
  • All session-related data is now managed without relying on local storage.

@bjoern-m bjoern-m marked this pull request as ready for review January 24, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant