Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
Loading...
Searching...
No Matches
authenticate.c File Reference
Include dependency graph for authenticate.c:

Functions

int8_t IBM_HandleAuth (IBM_AuthHandle_TypeDef *auth_handle)
 Authentication handler for IBM EIS. More...
 
CURLcode IBM_Authenticate (const char *token, IBM_AuthHandle_TypeDef *auth_handle)
 Authenticate with IBM's Environmental Intelligence Suite (EIS). More...
 
CURLcode IBM_Refresh (IBM_AuthHandle_TypeDef *auth_handle)
 Obtain a new access token from IBM's EMS. More...
 

Function Documentation

◆ IBM_Authenticate()

CURLcode IBM_Authenticate ( const char *  token,
IBM_AuthHandle_TypeDef auth_handle 
)

Authenticate with IBM's Environmental Intelligence Suite (EIS).

Authenticate with IBM's Enviornmental Monitoring Suite.

IBM used OAuth2 for authentication. This function takes care of this process. The lengths of the tokens are:

  • Access token = 1861 bytes
  • Refresh token = 43 bytes
Parameters
tokenIBM API key to use.
auth_handleAuthenication handler for IBM tokens
Returns
CURLcode error message

◆ IBM_HandleAuth()

int8_t IBM_HandleAuth ( IBM_AuthHandle_TypeDef auth_handle)

Authentication handler for IBM EIS.

Handles authentication, checking and re-authentication of IBM EIS access tokens.

IBM_AuthHandle_TypeDef auth_handle = {0};
if(IBM_HandleAuth(&auth_handle) != 0){
return 1;
}
int8_t IBM_HandleAuth(IBM_AuthHandle_TypeDef *auth_handle)
Authentication handler for IBM EIS.
Definition: authenticate.c:19
IBM token handler.
Definition: authenticate.h:25
Note
Authentication handler must be initialised to zero.
Parameters
auth_handleAuthentication hander with tokens and expiry information.
Returns
Error code. 0 = OK 1 = ERROR

Check if initialised already

◆ IBM_Refresh()

CURLcode IBM_Refresh ( IBM_AuthHandle_TypeDef auth_handle)

Obtain a new access token from IBM's EMS.

Re-authenticate with IBM's Enviornmental Monitoring Suite.

IBM used OAuth2 for re-authentication. This function takes care of this process. The access_token length is at least 1861 characters.

char* access_token[IBM_ACCESS_TOKEN_SIZE]; // Access token to populate
IBM_Refresh(refresh_token, access_token);
CURLcode IBM_Refresh(IBM_AuthHandle_TypeDef *auth_handle)
Obtain a new access token from IBM's EMS.
Definition: authenticate.c:139
#define IBM_ACCESS_TOKEN_SIZE
Buffer size to hold access token.
Definition: authenticate.h:16
Note
Ensure malloc size if large enough to hold the returned access token (at least 1861 bytes).
Parameters
auth_handleIBM EIS authentication handler.
Returns
CURLcode error message