How to configure a GeoEvent Input Connector that’s similar to the built-in "Poll an External Website for JSON” connector, but be able to handle 2-pass authentication of the requests?

1116
1
10-17-2016 02:11 PM
TCFu
by
New Contributor

Our Rest service server requires a Login request first, which returns an authToken, then the authToken will be included in the subsequent requests as cookies with a timeout session of 60 minutes. (In a Web browser, the authToken is automatically included as a Cookie.) When the authToken session expires, we need to make a Login call again and replace the new authToken in the GeoEvent Input Connector configuration.

We could not find any built-in Input connectors that can do what I just described above. So we think we have to use GeoEvent Extension SDK to write our own custom Input Connector. Do you know this is achievable by extending the SDK? If so, do you have any sample code or documented steps to do that?

0 Kudos
1 Reply
TanchiFu
New Contributor

To be a bit more specific, the following steps describe what we want this custom Input Connector to do:

1. Make request to "https://server/rest/getData" with an authToken cookie in the request header.

2. If the request returns 401 or 403, that means the authToken session is expired...

3. Then make a new request to "http://server/rest/login?username=abc&password=xyz", a new authToken will be in the response cookie.

4. Go back to Step 1 with the new authToken.