Skip to content

Commit

Permalink
fix mtls handler (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhane authored Jul 29, 2024
1 parent a6b3517 commit 1c101fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/App/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private void RegisterLocalServices()

#region Nibblewarden
ServiceContainer.Register<ICertificateService>("certificateService", new CertificateService());
ServiceContainer.Register<IHttpClientHandler>("httpClientHandler", new AndroidHttpsClientHandler());
ServiceContainer.Register<IHttpMessageHandler>("httpMessageHandler", new AndroidHttpsClientHandler());
#endregion

// Push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Bit.Droid.Security
{
// Tag:Nibblewarden
public class AndroidHttpsClientHandler : AndroidClientHandler, IHttpClientHandler
public class AndroidHttpsClientHandler : AndroidMessageHandler, IHttpMessageHandler
{
private X509CertificateChainSpec ClientCertificate;

Expand All @@ -18,7 +18,7 @@ public AndroidHttpsClientHandler() : base()
ClientCertificate = null;
}

public HttpClientHandler AsClientHandler()
public HttpMessageHandler AsMessageHandler()
{
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Bit.Core.Abstractions
{
// Tag:Nibblewarden
public interface IHttpClientHandler
public interface IHttpMessageHandler
{
HttpClientHandler AsClientHandler();
HttpMessageHandler AsMessageHandler();

void UseClientCertificate(ICertificateChainSpec clientCertificate);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Core/Services/ApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public ApiService(
string customUserAgent = null)
{
#region Nibblewarden
_httpClientHandler = ServiceContainer.Resolve<IHttpClientHandler>("httpClientHandler");
_httpClient = new HttpClient(_httpClientHandler.AsClientHandler());
_httpMessageHandler = ServiceContainer.Resolve<IHttpMessageHandler>("httpMessageHandler");
_httpClient = new HttpClient(_httpMessageHandler.AsMessageHandler());
#endregion

_tokenService = tokenService;
Expand All @@ -63,10 +63,10 @@ public ApiService(
public string EventsBaseUrl { get; set; }

#region Nibblewarden
private readonly IHttpClientHandler _httpClientHandler;
private readonly IHttpMessageHandler _httpMessageHandler;
public void UseClientCertificate(ICertificateChainSpec certificateChainSpec)
{
_httpClientHandler.UseClientCertificate(certificateChainSpec);
_httpMessageHandler.UseClientCertificate(certificateChainSpec);
}
#endregion

Expand Down

0 comments on commit 1c101fb

Please sign in to comment.