FEAT: Adding authentication module and adding new auth types#135
Merged
FEAT: Adding authentication module and adding new auth types#135
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces comprehensive Azure Active Directory (AAD) authentication enhancements to the mssql-python package, expanding authentication method support and implementing a dedicated authentication module for improved connection handling.
- Adds support for three new AAD authentication methods:
ActiveDirectoryInteractive,ActiveDirectoryDeviceCode, andActiveDirectoryDefault - Implements a new authentication module (
auth.py) with token handling and credential management - Integrates the authentication logic into the existing connection initialization process
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| mssql_python/auth.py | New authentication module implementing AAD token handling, credential management, and connection string processing |
| mssql_python/connection.py | Integrates authentication processing into connection initialization with import and conditional logic |
| README.md | Updates documentation to reflect new authentication methods and cross-platform support with usage notes |
bewithgaurav
requested changes
Jul 14, 2025
Collaborator
bewithgaurav
left a comment
There was a problem hiding this comment.
need to add tests here. logic looks good.
This was referenced Jul 16, 2025
…/mssql-python into jahnvi/new_auth_module
bewithgaurav
previously approved these changes
Jul 16, 2025
sumitmsft
reviewed
Jul 16, 2025
sumitmsft
reviewed
Jul 16, 2025
sumitmsft
reviewed
Jul 16, 2025
bewithgaurav
approved these changes
Jul 17, 2025
gargsaumya
approved these changes
Jul 17, 2025
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.
ADO Work Item Reference
Summary
This pull request introduces significant enhancements to the
mssql-pythonpackage, focusing on expanding authentication support and improving connection string handling. The most notable changes include adding support for new Azure Active Directory (AAD) authentication methods, implementing a dedicated authentication module, and integrating these updates into the connection handling logic.Authentication Enhancements:
Expanded AAD Authentication Methods: The documentation (
README.md) now reflects support for additional authentication methods, includingActiveDirectoryInteractive(via browser),ActiveDirectoryDeviceCode(for environments without browser access), andActiveDirectoryDefault(which selects the best method based on the environment). Notes were added to clarify usage and constraints for these methods.New
auth.pyModule: Introduced a dedicated module (mssql_python/auth.py) to handle AAD authentication. This module includes:DefaultAzureCredential,DeviceCodeCredential, andInteractiveBrowserCredentialfor token retrieval.Connection Handling Updates:
Integration of Authentication Logic: The
process_connection_stringfunction from the newauth.pymodule was integrated into the connection initialization process inmssql_python/connection.py. If the connection string specifies an AAD authentication type, it is processed to remove sensitive parameters and include the appropriate authentication token inattrs_before.Import Update: The
process_connection_stringfunction was imported intomssql_python/connection.pyto enable the integration of the new authentication logic.