Skip to content

Commit

Permalink
Upgrade MSAL library version (#765)
Browse files Browse the repository at this point in the history
Also removed tests that compared error messages not owned by SqlClient.
  • Loading branch information
cheenamalhotra committed Oct 23, 2020
1 parent a947ded commit 2134081
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
Expand Up @@ -211,10 +211,7 @@ public static void ActiveDirectoryPasswordWithNoAuthType()
// connection fails with expected error message.
string[] AuthKey = { "Authentication" };
string connStrWithNoAuthType = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, AuthKey);
SqlException e = Assert.Throws<SqlException>(() => ConnectAndDisconnect(connStrWithNoAuthType));

string expectedMessage = "Cannot open server \"microsoft.com\" requested by the login. The login failed.";
Assert.Contains(expectedMessage, e.Message);
Assert.Throws<SqlException>(() => ConnectAndDisconnect(connStrWithNoAuthType));
}

[ConditionalFact(nameof(IsAADConnStringsSetup))]
Expand Down Expand Up @@ -248,10 +245,7 @@ public static void EmptyPasswordInConnStrAADPassword()
// connection fails with expected error message.
string[] pwdKey = { "Password", "PWD" };
string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, pwdKey) + "Password=;";
AggregateException e = Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr));

string expectedMessage = "ID3242: The security token could not be authenticated or authorized.";
Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message);
Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr));
}

[PlatformSpecific(TestPlatforms.Windows)]
Expand All @@ -261,11 +255,7 @@ public static void EmptyCredInConnStrAADPassword()
// connection fails with expected error message.
string[] removeKeys = { "User ID", "Password", "UID", "PWD" };
string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User ID=; Password=;";
AggregateException e = Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr));

string expectedMessage = "Failed to get user name";

Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message);
Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr));
}

[PlatformSpecific(TestPlatforms.AnyUnix)]
Expand All @@ -275,11 +265,7 @@ public static void EmptyCredInConnStrAADPasswordAnyUnix()
// connection fails with expected error message.
string[] removeKeys = { "User ID", "Password", "UID", "PWD" };
string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User ID=; Password=;";
AggregateException e = Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr));

string expectedMessage = "cannot determine the username";

Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message);
Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr));
}

[ConditionalFact(nameof(IsAADConnStringsSetup))]
Expand All @@ -288,10 +274,7 @@ public static void AADPasswordWithInvalidUser()
// connection fails with expected error message.
string[] removeKeys = { "User ID", "UID" };
string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User ID=testdotnet@microsoft.com";
AggregateException e = Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr));

string expectedMessage = "ID3242: The security token could not be authenticated or authorized.";
Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message);
Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr));
}

[ConditionalFact(nameof(IsAADConnStringsSetup))]
Expand Down
2 changes: 1 addition & 1 deletion tools/props/Versions.props
Expand Up @@ -18,7 +18,7 @@
</PropertyGroup>
<!-- NetFx and NetCore project dependencies -->
<PropertyGroup>
<MicrosoftIdentityClientVersion>4.14.0</MicrosoftIdentityClientVersion>
<MicrosoftIdentityClientVersion>4.21.1</MicrosoftIdentityClientVersion>
<MicrosoftIdentityModelProtocolsOpenIdConnectVersion>5.6.0</MicrosoftIdentityModelProtocolsOpenIdConnectVersion>
<MicrosoftIdentityModelJsonWebTokensVersion>5.6.0</MicrosoftIdentityModelJsonWebTokensVersion>
<SystemBuffersVersion>4.5.1</SystemBuffersVersion>
Expand Down
10 changes: 5 additions & 5 deletions tools/specs/Microsoft.Data.SqlClient.nuspec
Expand Up @@ -28,7 +28,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependencies>
<group targetFramework="net46">
<dependency id="Microsoft.Data.SqlClient.SNI" version="2.1.1" />
<dependency id="Microsoft.Identity.Client" version="4.14.0" />
<dependency id="Microsoft.Identity.Client" version="4.21.1" />
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.6.0" />
<dependency id="Microsoft.IdentityModel.JsonWebTokens" version="5.6.0" />
</group>
Expand All @@ -40,7 +40,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependency id="System.Diagnostics.DiagnosticSource" version="4.7.0" exclude="Compile" />
<dependency id="System.Configuration.ConfigurationManager" version="4.7.0" exclude="Compile" />
<dependency id="System.Runtime.Caching" version="4.7.0" exclude="Compile" />
<dependency id="Microsoft.Identity.Client" version="4.14.0" exclude="Compile"/>
<dependency id="Microsoft.Identity.Client" version="4.21.1" exclude="Compile"/>
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.6.0" />
<dependency id="Microsoft.IdentityModel.JsonWebTokens" version="5.6.0" />
</group>
Expand All @@ -52,7 +52,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependency id="System.Diagnostics.DiagnosticSource" version="4.7.0" exclude="Compile" />
<dependency id="System.Configuration.ConfigurationManager" version="4.7.0" exclude="Compile" />
<dependency id="System.Runtime.Caching" version="4.7.0" exclude="Compile" />
<dependency id="Microsoft.Identity.Client" version="4.14.0" exclude="Compile"/>
<dependency id="Microsoft.Identity.Client" version="4.21.1" exclude="Compile"/>
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.6.0" />
<dependency id="Microsoft.IdentityModel.JsonWebTokens" version="5.6.0" />
</group>
Expand All @@ -63,7 +63,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependency id="System.Memory" version="4.5.4" exclude="Compile" />
<dependency id="System.Security.Principal.Windows" version="4.7.0" exclude="Compile" />
<dependency id="System.Text.Encoding.CodePages" version="4.7.0" exclude="Compile" />
<dependency id="Microsoft.Identity.Client" version="4.14.0" exclude="Compile"/>
<dependency id="Microsoft.Identity.Client" version="4.21.1" exclude="Compile"/>
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.6.0" />
<dependency id="Microsoft.IdentityModel.JsonWebTokens" version="5.6.0" />
</group>
Expand All @@ -74,7 +74,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependency id="System.Memory" version="4.5.4" exclude="Compile" />
<dependency id="System.Security.Principal.Windows" version="4.7.0" exclude="Compile" />
<dependency id="System.Text.Encoding.CodePages" version="4.7.0" exclude="Compile" />
<dependency id="Microsoft.Identity.Client" version="4.14.0" exclude="Compile"/>
<dependency id="Microsoft.Identity.Client" version="4.21.1" exclude="Compile"/>
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.6.0" />
<dependency id="Microsoft.IdentityModel.JsonWebTokens" version="5.6.0" />
</group>
Expand Down

0 comments on commit 2134081

Please sign in to comment.