Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release 1.1] Allow username with Active Directory Interactive Authentication #493

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public override Task<SqlAuthenticationToken> AcquireTokenAsync(SqlAuthentication
{
result = await app.AcquireTokenInteractive(scopes)
.WithUseEmbeddedWebView(true)
.WithLoginHint(parameters.UserId)
.ExecuteAsync();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,9 @@ internal SqlConnectionString(string connectionString) : base(connectionString, G
throw SQL.IntegratedWithUserIDAndPassword();
}

if (Authentication == SqlAuthenticationMethod.ActiveDirectoryInteractive && (HasUserIdKeyword || HasPasswordKeyword))
if (Authentication == SqlAuthenticationMethod.ActiveDirectoryInteractive && (HasPasswordKeyword))
{
throw SQL.InteractiveWithUserIDAndPassword();
throw SQL.InteractiveWithPassword();
}

#if ADONET_CERT_AUTH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ static internal Exception IntegratedWithUserIDAndPassword()
return ADP.Argument(StringsHelper.GetString(Strings.SQL_IntegratedWithUserIDAndPassword));
}

static internal Exception InteractiveWithUserIDAndPassword()
static internal Exception InteractiveWithPassword()
{
return ADP.Argument(StringsHelper.GetString(Strings.SQL_InteractiveWithUserIDAndPassword));
return ADP.Argument(StringsHelper.GetString(Strings.SQL_InteractiveWithPassword));
}

static internal Exception SettingIntegratedWithCredential()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2496,8 +2496,8 @@
<data name="SQL_IntegratedWithUserIDAndPassword" xml:space="preserve">
<value>Cannot use 'Authentication=Active Directory Integrated' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords.</value>
</data>
<data name="SQL_InteractiveWithUserIDAndPassword" xml:space="preserve">
<value>Cannot use 'Authentication=Active Directory Interactive' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords.</value>
<data name="SQL_InteractiveWithPassword" xml:space="preserve">
<value>Cannot use 'Authentication=Active Directory Interactive' with 'Password' or 'PWD' connection string keywords.</value>
</data>
<data name="SQL_SettingIntegratedWithCredential" xml:space="preserve">
<value>Cannot use 'Authentication=Active Directory Integrated', if the Credential property has been set.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ public static void IntegratedAuthWithCred()

[ConditionalFact(nameof(IsAADConnStringsSetup))]
[SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp)]
public static void MFAAuthWithCred()
public static void MFAAuthWithPassword()
{
// connection fails with expected error message.
string[] AuthKey = { "Authentication" };
string connStr = RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, AuthKey) + "Authentication=Active Directory Interactive;";
ArgumentException e = Assert.Throws<ArgumentException>(() => ConnectAndDisconnect(connStr));

string expectedMessage = "Cannot use 'Authentication=Active Directory Interactive' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords.";
string expectedMessage = "Cannot use 'Authentication=Active Directory Interactive' with 'Password' or 'PWD' connection string keywords.";
Assert.Contains(expectedMessage, e.Message);
}

Expand Down