feat: add ADO.Net Authentication connection string synonym and spaced value names - #368
David Levy (dlevy-msft-sql) wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #368 +/- ##
===========================================
+ Coverage 77.91% 97.18% +19.27%
===========================================
Files 35 93 +58
Lines 7222 74691 +67469
===========================================
+ Hits 5627 72592 +66965
- Misses 1332 2062 +730
+ Partials 263 37 -226
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
cf87270 to
8c3ed33
Compare
There was a problem hiding this comment.
Pull request overview
Adds ADO.Net-compatible authentication naming to the Go MSSQL driver’s connection-string handling, improving migration ergonomics for users coming from Microsoft.Data.SqlClient.
Changes:
- Add
Authenticationas an ADO-style keyword synonym forfedauthinmsdsnparsing. - Normalize ADO.Net “spaced” authentication method values (e.g.,
Active Directory Default) to the driver’s existingActiveDirectoryDefault-style values inazuread. - Extend
azureadunit tests to cover the new synonym and spaced value mappings (includingSql Passwordmeaning “no fedauth”).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| msdsn/conn_str.go | Adds authentication -> fedauth keyword synonym in ADO-style DSN parsing. |
| azuread/configuration.go | Adds mapping table + normalization step for ADO.Net spaced Authentication values. |
| azuread/configuration_test.go | Adds test cases validating synonym + spaced value support, including Sql Password behavior. |
cf4e65d to
dbfd9a3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
azuread/configuration.go:126
- The ADO.Net value normalization updates the local
fedAuthWorkflowvariable but leavesparams["fedauth"]unchanged. This means the returnedconfig.mssqlConfig.Parameterscan still contain non-canonical values like"Active Directory Default", and in the"Sql Password"case it keeps afedauthparameter even though the function treats it as “no federated auth”. Normalizing (or deleting) the parameter in the map keeps the parsed config internally consistent and avoids passing a misleadingfedauthvalue downstream.
// Normalize ADO.Net-style authentication names to driver names
if mapped, ok := adoNetAuthMap[strings.ToLower(fedAuthWorkflow)]; ok {
if mapped == "" {
// "Sql Password" means standard SQL auth, no federated auth
return nil
}
fedAuthWorkflow = mapped
}
8ca023b to
27692ba
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The change is scoped to connection string normalization, and the new behavior is covered by focused unit tests (including URL-query whitespace cases) without introducing risky protocol or API changes.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
27692ba to
50358bc
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to connection-string parsing/normalization and is backed by targeted unit tests that cover the new synonym, all ADO.Net auth-name mappings, and whitespace edge cases.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
50358bc to
911da2c
Compare
Map matches exact string constants from Microsoft.Data.SqlClient's DbConnectionStringUtilities (e.g. 'Active Directory Password'). Only includes values defined in the ADO.NET SqlAuthenticationMethod enum.
adoNetAuthMap has ten keys and three were exercised. A typo in any of the others leaves that method unmapped and the user gets 'Invalid federated authentication type', so assert all ten against SqlAuthenticationMethod plus casing variants.
msdsn trims semicolon-style connection string values but leaves URL query values as written, so a URL DSN could deliver a padded authentication name to the lookup and have a valid value rejected. Trimming here rather than in msdsn is deliberate: blanket-trimming URL query values would also change password and similar parameters, where surrounding whitespace is significant.
911da2c to
7318df4
Compare
Problem
Users coming from ADO.Net expect to use
Authentication=Active Directory Defaultstyle connection strings, but the driver only supportsfedauth=ActiveDirectoryDefault.Fix
1. Connection string synonym
Added
"authentication"as a synonym for"fedauth"in the ADO-style connection string parser (msdsn/conn_str.go).2. ADO.Net-style value names
Added support for spaced authentication values in the
azureadpackage, matching ADO.Net SqlClient names:Examples
These connection strings are now equivalent:
Tests
Added 4 test cases to
TestValidateParameters:Authenticationsynonym with existing value nameActive Directory Passwordspaced nameActive Directory Managed Identityspaced nameSql Passwordreturns no fedauth configAll existing tests pass.
Fixes #288