feat: implement authentication module with Basic and Bearer policies#15
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request implements a comprehensive authentication system for the gavaconnect Python SDK, introducing support for both Basic and Bearer (OAuth2) authentication schemes. The implementation focuses on per-resource authentication policies, thread-safe token management, and extensible design patterns.
- Implements pluggable authentication policies for Basic and Bearer token authentication
- Adds OAuth2 client credentials provider with concurrency-safe token caching and early refresh
- Provides comprehensive test coverage for all authentication components with async testing support
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| gavaconnect/auth/init.py | Exposes authentication classes and protocols as public API |
| gavaconnect/auth/basic.py | Implements BasicAuthPolicy and immutable BasicCredentials for HTTP Basic authentication |
| gavaconnect/auth/bearer.py | Defines AuthPolicy protocol and BearerAuthPolicy for bearer token authentication |
| gavaconnect/auth/providers.py | Implements ClientCredentialsProvider for OAuth2 client credentials flow with caching |
| gavaconnect/auth/README.md | Documents authentication architecture and design rationale |
| tests/test_auth_basic.py | Unit tests for basic authentication implementation |
| tests/test_auth_bearer.py | Unit tests for bearer authentication with mock and integration scenarios |
| tests/test_auth_providers.py | Comprehensive tests for token provider implementations |
| tests/test_auth_module.py | Tests for module imports and exports |
| pyproject.toml | Adds async testing dependencies and configuration |
| coverage.xml | Updated coverage report reflecting new authentication modules |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
This pull request introduces a new, extensible authentication system for the
gavaconnectPython SDK, supporting both Basic and Bearer (OAuth2) authentication schemes. It adds dedicated modules for authentication logic, provides concurrency-safe token management, and includes comprehensive tests and documentation. The changes also update development dependencies and testing configuration to support asynchronous code.Authentication System Implementation:
gavaconnect/auth/basic.pyimplementingBasicAuthPolicyand immutableBasicCredentialsfor HTTP Basic authentication.gavaconnect/auth/bearer.pydefining a pluggableAuthPolicyprotocol,BearerAuthPolicyfor bearer tokens, and aTokenProviderprotocol for token management.gavaconnect/auth/providers.pywithClientCredentialsProviderfor OAuth2 client credentials flow, supporting concurrency-safe caching and early refresh.gavaconnect/auth/__init__.pyto expose authentication classes and protocols as the public API.Documentation:
gavaconnect/auth/README.mddetailing the authentication architecture, design goals, and rationale for per-resource authentication.Testing and Coverage:
tests/test_auth_basic.pywith thorough unit tests forBasicCredentialsandBasicAuthPolicy, including immutability, header formation, and async methods.coverage.xmlto reflect new modules and increased test coverage across authentication code. [1] [2]Development and Testing Configuration:
pyproject.tomlto addpytest-asyncioandrespxfor async and HTTP mocking support, and configured pytest for asyncio mode and markers. [1] [2] [3]