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

add websocket auth support for .net standard 2.0 support #281

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
9 changes: 5 additions & 4 deletions src/KubernetesClient/Kubernetes.WebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Net;
using System.Net.Http;
using System.Net.WebSockets;
#if NET452
#if (NET452 || NETSTANDARD2_0)
using System.Net.Security;
#endif
using System.Security.Cryptography.X509Certificates;
Expand Down Expand Up @@ -281,7 +281,7 @@ public partial class Kubernetes
}
}

#if NET452
#if (NET452 || NETSTANDARD2_0)
if (this.CaCerts != null)
{
webSocketBuilder.SetServerCertificateValidationCallback(this.ServerCertificateValidationCallback);
Expand Down Expand Up @@ -368,7 +368,8 @@ public partial class Kubernetes
{
ServiceClientTracing.Exit(invocationId, null);
}
#if NET452

#if (NET452 || NETSTANDARD2_0)
if (this.CaCerts != null)
{
webSocketBuilder.CleanupServerCertificateValidationCallback(this.ServerCertificateValidationCallback);
Expand All @@ -378,7 +379,7 @@ public partial class Kubernetes
return webSocket;
}

#if NET452
#if (NET452 || NETSTANDARD2_0)
internal bool ServerCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return Kubernetes.CertificateValidationCallBack(sender, this.CaCerts, certificate, chain, sslPolicyErrors);
Expand Down
4 changes: 2 additions & 2 deletions src/KubernetesClient/WebSocketBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net.WebSockets;
#if NET452
#if (NET452 || NETSTANDARD2_0)
using System.Net.Security;
#endif
using System.Security.Cryptography.X509Certificates;
Expand Down Expand Up @@ -39,7 +39,7 @@ public virtual WebSocketBuilder AddClientCertificate(X509Certificate2 certificat
return this;
}

#if NET452
#if (NET452 || NETSTANDARD2_0)
public WebSocketBuilder SetServerCertificateValidationCallback(RemoteCertificateValidationCallback validationCallback)
{
System.Net.ServicePointManager.ServerCertificateValidationCallback += validationCallback;
Expand Down