Skip to content

Commit 9ddac1a

Browse files
rojiWhatzGames
authored andcommitted
Use Npgsql 9.0.0-preview.1-ci.20241025T100626 (npgsql#3330)
1 parent 7bbb129 commit 9ddac1a

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<EFCoreVersion>[9.0.0-rc.2.24474.1]</EFCoreVersion>
44
<MicrosoftExtensionsVersion>9.0.0-rc.2.24473.5</MicrosoftExtensionsVersion>
5-
<NpgsqlVersion>8.0.5</NpgsqlVersion>
5+
<NpgsqlVersion>9.0.0-preview.1-ci.20241025T100626</NpgsqlVersion>
66
</PropertyGroup>
77

88
<ItemGroup>

src/EFCore.PG/Storage/Internal/NpgsqlDataSourceManager.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,19 @@ enumDefinition.StoreTypeSchema is null
136136
}
137137

138138
// Legacy authentication-related callbacks at the EF level; apply these when building a data source as well.
139-
if (npgsqlOptionsExtension.ProvideClientCertificatesCallback is not null)
139+
if (npgsqlOptionsExtension.ProvideClientCertificatesCallback is not null
140+
|| npgsqlOptionsExtension.RemoteCertificateValidationCallback is not null)
140141
{
141-
dataSourceBuilder.UseClientCertificatesCallback(x => npgsqlOptionsExtension.ProvideClientCertificatesCallback(x));
142-
}
143-
144-
if (npgsqlOptionsExtension.RemoteCertificateValidationCallback is not null)
145-
{
146-
dataSourceBuilder.UseUserCertificateValidationCallback(npgsqlOptionsExtension.RemoteCertificateValidationCallback);
142+
dataSourceBuilder.UseSslClientAuthenticationOptionsCallback(o =>
143+
{
144+
if (npgsqlOptionsExtension.ProvideClientCertificatesCallback is not null)
145+
{
146+
o.ClientCertificates ??= new();
147+
npgsqlOptionsExtension.ProvideClientCertificatesCallback(o.ClientCertificates);
148+
}
149+
150+
o.RemoteCertificateValidationCallback = npgsqlOptionsExtension.RemoteCertificateValidationCallback;
151+
});
147152
}
148153

149154
// Finally, if the user has provided a data source builder configuration action, invoke it.

src/EFCore.PG/Storage/Internal/NpgsqlRelationalConnection.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,18 @@ protected override DbConnection CreateDbConnection()
9999

100100
var conn = new NpgsqlConnection(ConnectionString);
101101

102-
if (_provideClientCertificatesCallback is not null)
102+
if (_provideClientCertificatesCallback is not null || _remoteCertificateValidationCallback is not null)
103103
{
104-
conn.ProvideClientCertificatesCallback = _provideClientCertificatesCallback;
105-
}
106-
107-
if (_remoteCertificateValidationCallback is not null)
108-
{
109-
conn.UserCertificateValidationCallback = _remoteCertificateValidationCallback;
104+
conn.SslClientAuthenticationOptionsCallback = o =>
105+
{
106+
if (_provideClientCertificatesCallback is not null)
107+
{
108+
o.ClientCertificates ??= new();
109+
_provideClientCertificatesCallback(o.ClientCertificates);
110+
}
111+
112+
o.RemoteCertificateValidationCallback = _remoteCertificateValidationCallback;
113+
};
110114
}
111115

112116
if (_providePasswordCallback is not null)

0 commit comments

Comments
 (0)