package com.juick.components.configuration; 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_p8_key:}") private String p8key; @Value("${ios_team_id:}") private String teamId; @Value("${ios_key_id:}") private String keyId; @Bean public ApnsClient apns() throws NoSuchAlgorithmException, InvalidKeyException, IOException { return new ApnsClientBuilder() .setApnsServer(ApnsClientBuilder.PRODUCTION_APNS_HOST) .setSigningKey(ApnsSigningKey.loadFromPkcs8File(new File(p8key), teamId, keyId)) .build(); } }