Create Session based token management system - #43
Closed
spa-raj wants to merge 0 commit into
Closed
Conversation
Member
|
Hey @spa-raj, thanks for the PR. |
NiveditJain
self-requested a review
July 13, 2025 05:55
NiveditJain
requested changes
Jul 13, 2025
NiveditJain
left a comment
Member
There was a problem hiding this comment.
as discussed over our old discord channel lets move it to redis based approach without a limit on number of tokens per user, we can discuss further in our updated channel here: https://discord.com/channels/816925020973432832/1393988900162371614
Comment on lines
+16
to
+17
| [tool.setuptools.packages.find] | ||
| include = ["app*"] |
Contributor
Author
|
I will create a separate PR for Redis implementation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #42
This pull request introduces significant changes to the
api-serverapplication, focusing on session and token management, as well as configuration updates for the development environment. The most important changes include implementing session and token models, adding services to handle session and token operations, modifying thecreate_tokenflow, and updating project settings for IntelliJ IDEA.Session and Token Management:
api-server/app/auth/models/session_database_model.py): Added aSessionmodel to manage user sessions, including fields for session status, expiration, and last activity. Includes methods for creating and updating sessions.api-server/app/auth/models/token_database_model.py): Added aTokenmodel to manage user tokens, including fields for session association, expiration, and status. Includes indexing for efficient querying.SessionStatusEnumandTokenStatusEnumto define valid statuses for sessions and tokens, such asACTIVE,INACTIVE, andBLACKLISTED. [1] [2]api-server/app/auth/services/session_manager.py): Implemented logic for creating, updating, and ending sessions, including handling token expiration and enforcing a maximum token limit per session.api-server/app/auth/services/token_manager.py): Added functionality to create tokens, retrieve active tokens for a session or user, and blacklist tokens.Updates to
create_tokenFlow:api-server/app/auth/controllers/create_token.py): Updated thecreate_tokenmethod to integrate session creation and token storage in the database. Added error handling for session creation failures. [1] [2]Project Configuration for IntelliJ IDEA:
.idea/.gitignore,.idea/exospherehost.iml,.idea/inspectionProfiles,.idea/misc.xml,.idea/modules.xml,.idea/vcs.xml): Added configuration files for IntelliJ IDEA to ignore default files, define module settings, inspection profiles, and version control mappings. [1] [2] [3] [4] [5] [6] [7]Miscellaneous Changes:
api-server/app/main.py): Updated Beanie initialization to includeSessionandTokenmodels for database operations. [1] [2]api-server/run.py): Added support for configuring the maximum number of tokens per session via a command-line argument and environment variable.api-server/pyproject.toml): Updated packaging settings to include theappdirectory.