Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
Loading...
Searching...
No Matches
authenticate.h
Go to the documentation of this file.
1#ifndef HA_CLOSURE_ANALYSIS_AUTHENTICATE_H_
2#define HA_CLOSURE_ANALYSIS_AUTHENTICATE_H_
3
4#include <curl/curl.h>
5#include <cjson/cJSON.h>
6#include <time.h>
7#include <log.h>
8
9#include "http.h"
10#include "utils.h"
11
13#define IBM_DEFAULT_TOKEN_NAME "IBM_TOKEN"
14
16#define IBM_ACCESS_TOKEN_SIZE 2000
17
19#define IBM_REFRESH_TOKEN_SIZE 50
20
22static const char* IBM_TOKEN_URL = "https://auth-b2b-twc.ibm.com/connect/token";
23
25typedef struct {
26 time_t token_expiry;
27 char access_token[IBM_ACCESS_TOKEN_SIZE];
28 char refresh_token[IBM_REFRESH_TOKEN_SIZE];
30
32int8_t IBM_HandleAuth(IBM_AuthHandle_TypeDef *auth_handle);
33
35CURLcode IBM_Authenticate(const char* token,
36 IBM_AuthHandle_TypeDef* auth_handle);
37
39CURLcode IBM_Refresh(IBM_AuthHandle_TypeDef *auth_handle);
40
41#endif //HA_CLOSURE_ANALYSIS_AUTHENTICATE_H_
CURLcode IBM_Refresh(IBM_AuthHandle_TypeDef *auth_handle)
Obtain a new access token from IBM's EMS.
Definition: authenticate.c:139
int8_t IBM_HandleAuth(IBM_AuthHandle_TypeDef *auth_handle)
Authentication handler for IBM EIS.
Definition: authenticate.c:19
CURLcode IBM_Authenticate(const char *token, IBM_AuthHandle_TypeDef *auth_handle)
Authenticate with IBM's Environmental Intelligence Suite (EIS).
Definition: authenticate.c:62
static const char * IBM_TOKEN_URL
IBM authenticate (token) URL.
Definition: authenticate.h:22
#define IBM_REFRESH_TOKEN_SIZE
Buffer size of hold refresh token.
Definition: authenticate.h:19
#define IBM_ACCESS_TOKEN_SIZE
Buffer size to hold access token.
Definition: authenticate.h:16
IBM token handler.
Definition: authenticate.h:25
time_t token_expiry
Time until token expires.
Definition: authenticate.h:26