Skip to content
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
8 changes: 7 additions & 1 deletion src/Npgsql/Internal/NpgsqlConnector.Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,14 @@ async Task AuthenticateMD5(string username, byte[] salt, bool async, Cancellatio
internal async ValueTask AuthenticateGSS(bool async, CancellationToken cancellationToken)
{
var targetName = $"{KerberosServiceName}/{Host}";
// See https://github.com/postgres/postgres/blob/a0dd0702e464f206b08c99a74cb58809c51aafa5/src/interfaces/libpq/fe-auth.c#L111-L123
// We do not support delegation (TokenImpersonationLevel.Delegation) for now (#6540)
var clientOptions = new NegotiateAuthenticationClientOptions
{
TargetName = targetName,
RequireMutualAuthentication = true
};

var clientOptions = new NegotiateAuthenticationClientOptions { TargetName = targetName };
NegotiateOptionsCallback?.Invoke(clientOptions);

using var authContext = new NegotiateAuthentication(clientOptions);
Expand Down
9 changes: 8 additions & 1 deletion src/Npgsql/Internal/NpgsqlConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,14 @@ internal async ValueTask<GssEncryptionResult> GSSEncrypt(bool async, bool isRequ
ConnectionLogger.LogTrace("Negotiating GSS encryption");

var targetName = $"{KerberosServiceName}/{Host}";
var clientOptions = new NegotiateAuthenticationClientOptions { TargetName = targetName };
// See https://github.com/postgres/postgres/blob/a0dd0702e464f206b08c99a74cb58809c51aafa5/src/interfaces/libpq/fe-secure-gssapi.c#L651-L658
// We do not support delegation (TokenImpersonationLevel.Delegation) for now (#6540)
var clientOptions = new NegotiateAuthenticationClientOptions
{
TargetName = targetName,
RequireMutualAuthentication = true,
RequiredProtectionLevel = ProtectionLevel.EncryptAndSign
};

NegotiateOptionsCallback?.Invoke(clientOptions);

Expand Down
Loading