RDEV-1657 getUserIpAddress function added + consumerParams with userIP in init step
This commit is contained in:
parent
3633852c4b
commit
bfd2fa56f9
@ -266,6 +266,14 @@ bool isOneOfSelectedMethods(char *selectedMethod, char *methods[], int methodsSi
|
||||
return false;
|
||||
}
|
||||
|
||||
char *getUserIpAddress(pam_handle_t *pamh) {
|
||||
char *ip = NULL;
|
||||
pam_get_item(pamh, PAM_RHOST, (const void **) &ip);
|
||||
if (ip == NULL)
|
||||
ip = "";
|
||||
return ip;
|
||||
}
|
||||
|
||||
int postInit(pam_handle_t *pamh, cJSON **availableMethods, struct ApplicationInfoStruct* info, char **transactionId, char *systemToken, char *secretKey, const char *appUserId, char *userEmail, char *rublonApiServer) {
|
||||
char *status = NULL;
|
||||
char *transactionStatus = NULL;
|
||||
@ -276,11 +284,12 @@ int postInit(pam_handle_t *pamh, cJSON **availableMethods, struct ApplicationInf
|
||||
char *tid = NULL;
|
||||
char *jsonObj;
|
||||
char *url;
|
||||
char *userIP = getUserIpAddress(pamh);
|
||||
|
||||
asprintf(&jsonObj,"{\"systemToken\":\"%s\",\"appUserId\":\"%s\",\"userEmail\":\"%s\"}",systemToken,appUserId,userEmail);
|
||||
asprintf(&jsonObj,"{\"systemToken\":\"%s\",\"appUserId\":\"%s\",\"userEmail\":\"%s\",\"consumerParams\":{\"userIP\":\"%s\"}}",systemToken,appUserId,userEmail,userIP);
|
||||
asprintf(&url,"%s/api/transaction/init",rublonApiServer);
|
||||
|
||||
char *curlResponse = curlHandler(pamh, jsonObj, url, secretKey);
|
||||
|
||||
if(curlResponse == NULL) {
|
||||
if((strcmp(getConfigValue("failmode"),"secure") != 0))
|
||||
return STATUS_BYPASS;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user