diff options
author | Vitaly Takmazov | 2017-10-17 13:50:26 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-10-17 14:27:08 +0300 |
commit | d41e94c835396f5f8b33f8be05dcb76366e06d22 (patch) | |
tree | ec82ffa96068e338a4dd7cfa823e43408c43b868 /juick-notifications/src/main/java/com/juick/components/configuration | |
parent | 9b5db8da41d5c4c5f50012c0055b4008191cdb8f (diff) |
notifications: APNS HTTP API
Diffstat (limited to 'juick-notifications/src/main/java/com/juick/components/configuration')
-rw-r--r-- | juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java index 6ac155a1..43ea3943 100644 --- a/juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java +++ b/juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java @@ -1,23 +1,34 @@ package com.juick.components.configuration; -import com.notnoop.apns.APNS; -import com.notnoop.apns.ApnsService; +import com.turo.pushy.apns.ApnsClient; +import com.turo.pushy.apns.ApnsClientBuilder; +import com.turo.pushy.apns.auth.ApnsSigningKey; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import java.io.File; +import java.io.IOException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + /** * Created by vital on 28.03.2017. */ @Configuration public class APNSConfiguration { - @Value("${ios_pkcs12_file:}") - private String pkcs12File; - @Value("${ios_pkcs12_password:}") - private String pkcs12secret; + @Value("${ios_p8_key:}") + private String p8key; + @Value("${ios_team_id:}") + private String teamId; + @Value("${ios_key_id:}") + private String keyId; @Bean - public ApnsService apns() { - return APNS.newService().withCert(pkcs12File, pkcs12secret) - .withProductionDestination().build(); + public ApnsClient apns() throws NoSuchAlgorithmException, InvalidKeyException, IOException { + return new ApnsClientBuilder() + .setApnsServer(ApnsClientBuilder.PRODUCTION_APNS_HOST) + .setSigningKey(ApnsSigningKey.loadFromPkcs8File(new File(p8key), + teamId, keyId)) + .build(); } } |