Conversation
…ility This commit introduces significant improvements to the authentication module (`auth.py`) and its testing infrastructure. Key changes include: - **Enhanced JWT Verification**: Implemented proper caching for validated JWT payloads, ensuring performance for repeated token usage. Corrected `jwt.decode` input handling and added support for configurable `audience_claim_key` in `validate_signature`. - **Refined Authentication Flows**: Streamlined user data processing in both `validate_bearer_with_introspection` and `validate_bearer_with_jwt_verification`, especially when `fetch_user_info` is enabled. - **Improved Testability**: The monolithic `tests/test_auth.py` has been split into granular, focused test files (`test_auth_helpers.py`, `test_auth_introspection.py`, `test_jwt_existing_user.py`, `test_jwt_invalid.py`, `test_jwt_new_user.py`, `test_jwt_userinfo.py`). - **Robust Mocking**: Introduced `tests/conftest.py` with `MockDoc` and an `autouse` `mock_frappe` fixture to provide consistent and isolated testing environments. - **DocType Updates**: Added `audience_claim_key` to the `CFE Identity Provider` DocType to support flexible audience validation. These changes address previous logical flaws, enhance the reliability and testability of the authentication system, and lay the groundwork for future feature development.
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.
No description provided.