Skip to content

Conversation

atyrode
Copy link
Contributor

@atyrode atyrode commented May 1, 2025

Fixes #39 and vastly improve the whole logging/logout flow of the app with a proper handling of OICD sessions and tokens lifetime.

atyrode added 11 commits May 1, 2025 02:40
- Added a margin of 1px to the GitHubButton for better spacing.
- Reduced font size from 1.05rem to 0.8rem for a more compact appearance.
- Added Redis service to docker-compose for session storage.
- Implemented Redis connection in config.py and updated session management functions.
- Refactored dependencies to utilize Redis for session retrieval and deletion.
- Updated requirements.txt to include Redis library.
- Added functions to check if the access token is expired and to refresh the token using the refresh token.
- Updated dependencies to utilize the new token management functions in the authentication flow.
- Enhanced the login endpoint to support session management with token state.
- Implemented a new GET endpoint `/count` to return the number of active sessions stored in Redis.
- The endpoint requires authentication and returns a dictionary with the active session count and a message.
- Integrated Redis client to facilitate session counting.
- Updated the session management to include token expiration by passing the expiry time to the set_session function.
- Improved the authentication callback to handle token data more effectively.
- Added frontend URL to OIDC configuration for improved redirect handling.
- Updated session management to pass token expiration to the set_session function.
- Modified logout endpoint to return a logout URL for Keycloak, enhancing user experience.
- Adjusted CORS settings to restrict allowed origins for better security.
- Added a new handleLogout function to manage user logout via an iframe for Keycloak.
- Removed the previous inline logout logic from the MainMenu.Item component.
- Enhanced error handling and session invalidation upon logout completion.
…authentication

- Added Redis password configuration to the .env.template file.
- Updated the Redis service command in docker-compose to require the Redis password.
- Enhanced README to include Redis setup instructions and password usage.
- Introduced API_WORKERS variable in .env.template for configurable worker count.
- Updated startup.sh to utilize the API_WORKERS variable when starting the application with uvicorn.
- Updated startup script to include PostHog key and host in runtime configuration.
- Enhanced global TypeScript definitions to accommodate new PostHog properties.
- Modified PostHog initialization to utilize runtime configuration values, improving flexibility.
- Updated the Redis client initialization to include password retrieval from environment variables, enhancing security and flexibility in Redis connections.
@atyrode atyrode merged commit e1c07da into main May 1, 2025
1 check passed
@atyrode atyrode deleted the session-management branch May 1, 2025 10:09
@atyrode atyrode changed the title refactor: improved logging flow refactor: improved login flow May 1, 2025
atyrode added a commit that referenced this pull request May 1, 2025
* style: update GitHubButton styles for improved layout

- Added a margin of 1px to the GitHubButton for better spacing.
- Reduced font size from 1.05rem to 0.8rem for a more compact appearance.

* feat: integrate Redis for session management

- Added Redis service to docker-compose for session storage.
- Implemented Redis connection in config.py and updated session management functions.
- Refactored dependencies to utilize Redis for session retrieval and deletion.
- Updated requirements.txt to include Redis library.

* feat: implement token expiration handling and refresh mechanism

- Added functions to check if the access token is expired and to refresh the token using the refresh token.
- Updated dependencies to utilize the new token management functions in the authentication flow.
- Enhanced the login endpoint to support session management with token state.

* feat: add endpoint to retrieve active session count from Redis

- Implemented a new GET endpoint `/count` to return the number of active sessions stored in Redis.
- The endpoint requires authentication and returns a dictionary with the active session count and a message.
- Integrated Redis client to facilitate session counting.

* feat: enhance session management with token expiration handling

- Updated the session management to include token expiration by passing the expiry time to the set_session function.
- Improved the authentication callback to handle token data more effectively.

* feat: enhance authentication flow and session management

- Added frontend URL to OIDC configuration for improved redirect handling.
- Updated session management to pass token expiration to the set_session function.
- Modified logout endpoint to return a logout URL for Keycloak, enhancing user experience.
- Adjusted CORS settings to restrict allowed origins for better security.

* feat: implement logout functionality with Keycloak iframe handling

- Added a new handleLogout function to manage user logout via an iframe for Keycloak.
- Removed the previous inline logout logic from the MainMenu.Item component.
- Enhanced error handling and session invalidation upon logout completion.

* feat: add Redis configuration and update docker-compose for password authentication

- Added Redis password configuration to the .env.template file.
- Updated the Redis service command in docker-compose to require the Redis password.
- Enhanced README to include Redis setup instructions and password usage.

* feat: add API workers configuration to environment and startup script

- Introduced API_WORKERS variable in .env.template for configurable worker count.
- Updated startup.sh to utilize the API_WORKERS variable when starting the application with uvicorn.

* feat: add PostHog configuration to runtime settings

- Updated startup script to include PostHog key and host in runtime configuration.
- Enhanced global TypeScript definitions to accommodate new PostHog properties.
- Modified PostHog initialization to utilize runtime configuration values, improving flexibility.

* feat: add Redis password configuration to Redis client in config.py

- Updated the Redis client initialization to include password retrieval from environment variables, enhancing security and flexibility in Redis connections.
atyrode added a commit that referenced this pull request May 1, 2025
* style: update GitHubButton styles for improved layout

- Added a margin of 1px to the GitHubButton for better spacing.
- Reduced font size from 1.05rem to 0.8rem for a more compact appearance.

* feat: integrate Redis for session management

- Added Redis service to docker-compose for session storage.
- Implemented Redis connection in config.py and updated session management functions.
- Refactored dependencies to utilize Redis for session retrieval and deletion.
- Updated requirements.txt to include Redis library.

* feat: implement token expiration handling and refresh mechanism

- Added functions to check if the access token is expired and to refresh the token using the refresh token.
- Updated dependencies to utilize the new token management functions in the authentication flow.
- Enhanced the login endpoint to support session management with token state.

* feat: add endpoint to retrieve active session count from Redis

- Implemented a new GET endpoint `/count` to return the number of active sessions stored in Redis.
- The endpoint requires authentication and returns a dictionary with the active session count and a message.
- Integrated Redis client to facilitate session counting.

* feat: enhance session management with token expiration handling

- Updated the session management to include token expiration by passing the expiry time to the set_session function.
- Improved the authentication callback to handle token data more effectively.

* feat: enhance authentication flow and session management

- Added frontend URL to OIDC configuration for improved redirect handling.
- Updated session management to pass token expiration to the set_session function.
- Modified logout endpoint to return a logout URL for Keycloak, enhancing user experience.
- Adjusted CORS settings to restrict allowed origins for better security.

* feat: implement logout functionality with Keycloak iframe handling

- Added a new handleLogout function to manage user logout via an iframe for Keycloak.
- Removed the previous inline logout logic from the MainMenu.Item component.
- Enhanced error handling and session invalidation upon logout completion.

* feat: add Redis configuration and update docker-compose for password authentication

- Added Redis password configuration to the .env.template file.
- Updated the Redis service command in docker-compose to require the Redis password.
- Enhanced README to include Redis setup instructions and password usage.

* feat: add API workers configuration to environment and startup script

- Introduced API_WORKERS variable in .env.template for configurable worker count.
- Updated startup.sh to utilize the API_WORKERS variable when starting the application with uvicorn.

* feat: add PostHog configuration to runtime settings

- Updated startup script to include PostHog key and host in runtime configuration.
- Enhanced global TypeScript definitions to accommodate new PostHog properties.
- Modified PostHog initialization to utilize runtime configuration values, improving flexibility.

* feat: add Redis password configuration to Redis client in config.py

- Updated the Redis client initialization to include password retrieval from environment variables, enhancing security and flexibility in Redis connections.

Co-authored-by: cyclotruc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workspace still accessible after logout from pad.ws

1 participant