Как я могу сделать мое приложение SpringBoot доступным через HTTPS-форму HubSpot в качестве веб-крючка? - PullRequest
0 голосов
/ 30 января 2020

Мне удалось создать webhook в HubSpot CRM. Веб-хуки HubSpot будут запрашиваться ТОЛЬКО с использованием HTTPS. Поэтому я настроил минималистичное c приложение Spring Boot 2, настроенное для использования HTTPS.

Контроллер:

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value="/", produces=MediaType.APPLICATION_JSON_VALUE)
public class HubSpotServiceController {

    @GetMapping("/hubspot")
    public void halthcheck() {
        System.out.println ("Service is available.");
    }
    @PostMapping("/hubspot")
    public void hubSpotChange() {
        System.out.println ("HubSpot notification received.");
    }
}

Я создал сертификат с помощью:

keytool -genkeypair -alias hubspot -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore duit.p12 -validity 3650

и сохранил его в

src / main / resources / keystore.

В свойствах приложения я указал:

server.port=${APPLICATION_PORT:8888}
# The format used for the keystore.
server.ssl.key-store-type=PKCS12
# The path to the keystore containing the certificate
server.ssl.key-store=classpath:keystore/duit.p12
# The password used to generate the certificate
server.ssl.key-store-password=hubspot
# The alias mapped to the certificate
server.ssl.key-alias=hubspot

Когда я вхожу URL-адрес в браузере Я получаю предупреждение безопасности, но я могу продолжить, и моя конечная точка введена.

Я хочу, чтобы изменения свойств в HubSpot распространялись на мое приложение Spring Boot (веб-крючок), но в инструменте мониторинга HubSpots я вижу:

Попытка веб-крюка не удалась из-за отказ в соединении.

... и моя конечная точка НЕ введена.

Что мне делать? Как может HubSpot аутентифицироваться при вызове webhook (приложение Spring Boot)?

...