[🐛] 5차 푸시 확인
Signed-off-by: seonkyu.kim <sean.kk@daum.net>
This commit is contained in:
parent
d52ef4ff02
commit
0634f8f156
|
@ -38,14 +38,14 @@ public class PushController : ControllerBase
|
||||||
if (_env.IsDevelopment())
|
if (_env.IsDevelopment())
|
||||||
{
|
{
|
||||||
uri = "https://api.sandbox.push.apple.com";
|
uri = "https://api.sandbox.push.apple.com";
|
||||||
p12FilePath = "/volume1/AcaMate/PROJECT/Application/Back/private/AM_Push_Sandbox.p12";
|
p12FilePath = "/volume1/AcaMate/PROJECT/Application/Back/private/AM_Push_Sandbox.pfx";
|
||||||
// "private/AM_Push_Sandbox.p12";
|
// p12FilePath = "private/AM_Push_Sandbox.p12";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uri = "https://api.push.apple.com";
|
uri = "https://api.push.apple.com";
|
||||||
p12FilePath = "/volume1/AcaMate/PROJECT/Application/Back/private/AM_Push.p12";
|
p12FilePath = "/volume1/AcaMate/PROJECT/Application/Back/private/AM_Push.pfx";
|
||||||
// "private/AM_Push.p12";
|
// p12FilePath = "private/AM_Push.p12";
|
||||||
}
|
}
|
||||||
var apnsTopic = "me.myds.ipstien.acamate.AcaMate";
|
var apnsTopic = "me.myds.ipstien.acamate.AcaMate";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
@ -37,12 +38,26 @@ public class PushServiceWithP12
|
||||||
};
|
};
|
||||||
var jsonPayload = JsonSerializer.Serialize(payload);
|
var jsonPayload = JsonSerializer.Serialize(payload);
|
||||||
|
|
||||||
var certificate = new X509Certificate2(p12Path, p12Password,
|
|
||||||
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable
|
|
||||||
);
|
|
||||||
|
|
||||||
var handler = new HttpClientHandler();
|
var handler = new HttpClientHandler();
|
||||||
handler.ClientCertificates.Add(certificate);
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var certificate = new X509Certificate2(p12Path, p12Password,
|
||||||
|
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
|
||||||
|
|
||||||
|
handler.ClientCertificates.Add(certificate);
|
||||||
|
}
|
||||||
|
catch (CryptographicException ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"CryptographicException: {ex.Message}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Unexpected error: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using var client = new HttpClient(handler)
|
using var client = new HttpClient(handler)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user