Skip to content

fix: 🐛 authentication fixes for login and logout functionality#7

Merged
faizanazim11 merged 1 commit intomasterfrom
fix/authentication-implementation
Nov 12, 2025
Merged

fix: 🐛 authentication fixes for login and logout functionality#7
faizanazim11 merged 1 commit intomasterfrom
fix/authentication-implementation

Conversation

@faizanazim11
Copy link
Copy Markdown
Contributor

@faizanazim11 faizanazim11 commented Nov 12, 2025

This pull request introduces a new logout functionality to the authentication utility, allowing users to revoke their authentication and remove session cookies. It also updates dependencies and makes improvements to token handling and configuration.

Authentication and Logout Enhancements

  • Added an add_logout_route function in fastapi_configurer.py to provide a /logout endpoint, which revokes authentication and deletes cookies. The route supports an optional handler for custom logout logic. (src/tp_auth_serverside/core/fastapi_configurer.py)
  • Integrated the logout route into the FastAPI app generation flow, including support for passing custom handlers and async options. (src/tp_auth_serverside/core/fastapi_configurer.py) [1] [2]
  • Implemented revoke_authentication in AuthenticationHandler to call the new revoke_token function and clear session cookies. (src/tp_auth_serverside/core/handler/authentication_handler.py)
  • Added revoke_token to the memory DB login module to support token revocation for a specific user and token. (src/tp_auth_serverside/db/memorydb/login.py)

Token Handling Improvements

  • Changed the short token generation in set_token to use a random UUID instead of a name-based UUID for better uniqueness. (src/tp_auth_serverside/db/memorydb/login.py)

Dependency and Configuration Updates

  • Updated the ruff-pre-commit hook version in .pre-commit-config.yaml for linting improvements. (.pre-commit-config.yaml)
  • Bumped the project version to 0.1.5 in pyproject.toml. (pyproject.toml)
  • Set auto_error=False for the OAuth2 scheme to allow more flexible error handling during authentication. (src/tp_auth_serverside/config.py)

Copilot AI review requested due to automatic review settings November 12, 2025 17:13
@faizanazim11 faizanazim11 self-assigned this Nov 12, 2025
@faizanazim11 faizanazim11 added the bug Something isn't working label Nov 12, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements authentication fixes for login and logout functionality with dependency updates.

  • Adds logout endpoint functionality with session token revocation
  • Fixes short token generation to use random UUIDs instead of name-based UUIDs
  • Updates OAuth2 scheme to not auto-error, allowing optional authentication
  • Updates multiple dependencies including FastAPI, gRPC, Pydantic, and others

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/tp_auth_serverside/db/memorydb/login.py Adds revoke_token function for session cleanup and fixes short token generation
src/tp_auth_serverside/core/handler/authentication_handler.py Adds revoke_authentication method for logout flow
src/tp_auth_serverside/core/fastapi_configurer.py Implements /logout route with optional custom handler support
src/tp_auth_serverside/config.py Sets auto_error=False on OAuth2 scheme for optional authentication
pyproject.toml Bumps version from 0.1.4 to 0.1.5
.pre-commit-config.yaml Updates ruff pre-commit hook from v0.13.0 to v0.14.4
uv.lock Updates multiple dependencies

@faizanazim11 faizanazim11 merged commit d9c4753 into master Nov 12, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants