Skip to content

Commit 8b44bc9

Browse files
committed
validate auth params
1 parent 8937cb7 commit 8b44bc9

File tree

1 file changed

+14
-2
lines changed
  • src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/KerberosTests

1 file changed

+14
-2
lines changed

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/KerberosTests/KerberosTest.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,33 @@ public void CustomSspiContextGeneratorTest(string connectionStr)
4747

4848
Assert.Fail("Expected to use custom SSPI context provider");
4949
}
50-
catch (SspiTestException)
50+
catch (SspiTestException sspi)
5151
{
52+
var builder = new SqlConnectionStringBuilder(connectionStr);
53+
54+
Assert.Equal(sspi.AuthParams.ServerName, builder.DataSource);
55+
Assert.Equal(sspi.AuthParams.DatabaseName, builder.InitialCatalog);
56+
Assert.Equal(sspi.AuthParams.UserId, builder.UserID);
57+
Assert.Equal(sspi.AuthParams.Password, builder.Password);
5258
}
5359
}
5460

5561
private sealed class TestSspiContextProvider : SspiContextProvider
5662
{
5763
protected override bool GenerateContext(ReadOnlySpan<byte> incomingBlob, IBufferWriter<byte> outgoingBlobWriter, SspiAuthenticationParameters authParams)
5864
{
59-
throw new SspiTestException();
65+
throw new SspiTestException(authParams);
6066
}
6167
}
6268

6369
private sealed class SspiTestException : Exception
6470
{
71+
public SspiTestException(SspiAuthenticationParameters authParams)
72+
{
73+
AuthParams = authParams;
74+
}
75+
76+
public SspiAuthenticationParameters AuthParams { get; }
6577
}
6678
}
6779

0 commit comments

Comments
 (0)