Skip to content

Commit

Permalink
Support TLS1.3 in APNs
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell committed Oct 2, 2023
1 parent ef8eb74 commit 4c1daf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,6 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

.idea
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ public static IHttpClientBuilder AddApnsNotifier(this IServiceCollection service
var builder = services.AddNotifier<ApnsNotifier, ApnsNotifierOptions>(configure)
.AddAuthenticationHandler<ApnsAuthenticationHandler>();

// APNS requires TLS 1.2
builder.ConfigurePrimaryHttpMessageHandler(() =>
// APNS requires TLS 1.2 or later
// https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns#2947606
builder.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
return new HttpClientHandler
{
SslProtocols = System.Security.Authentication.SslProtocols.Tls12
};
SslProtocols = System.Security.Authentication.SslProtocols.Tls12
| System.Security.Authentication.SslProtocols.Tls13,
});

return builder;
Expand Down

0 comments on commit 4c1daf1

Please sign in to comment.