@@ -142,42 +142,6 @@ size_t writeCallback(void *contents, size_t size, size_t nmemb, void *userp)
142142 return size * nmemb;
143143}
144144
145- int PrivacyIDEA::validateCheck (const string &user, const string &pass, const string &transactionID,
146- Response &response)
147- {
148- int retval = 0 ;
149- string strResponse;
150- map<string, string> param{make_pair (" user" , user), make_pair (" pass" , pass)};
151-
152- if (!transactionID.empty ())
153- {
154- param.emplace (" transaction_id" , transactionID);
155- }
156-
157- if (!realm.empty ())
158- {
159- param.emplace (" realm" , realm);
160- }
161-
162- map<string, string> headers;
163-
164- retval = sendRequest (baseURL + " /validate/check" , param, headers, strResponse);
165- if (retval != 0 )
166- {
167- // The request failed. Log a descriptive error and return immediately.
168- pam_syslog (pamh, LOG_ERR, " validateCheck: The request to the server failed with cURL error: %d (%s)" , retval, curl_easy_strerror ((CURLcode)retval));
169- return retval;
170- }
171-
172- retval = parseResponse (strResponse, response);
173- if (retval != 0 )
174- {
175- pam_syslog (pamh, LOG_ERR, " validateCheck: Unable to parse the response from the privacyIDEA server. Error %d" , retval);
176- }
177-
178- return retval;
179- }
180-
181145int PrivacyIDEA::sendRequest (const std::string &url, const std::map<std::string, std::string> ¶meters,
182146 const std::map<std::string, std::string> &headers,
183147 std::string &response, bool postRequest)
@@ -314,6 +278,11 @@ int PrivacyIDEA::validateCheckFIDO(const FIDOSignResponse &signResponse, const s
314278 parameters.try_emplace (" user" , user);
315279 }
316280
281+ if (!realm.empty ())
282+ {
283+ parameters.try_emplace (" realm" , realm);
284+ }
285+
317286 std::map<std::string, std::string> headers = {
318287 {" Origin" , origin}};
319288
@@ -508,16 +477,16 @@ int PrivacyIDEA::offlineRefillFIDO(OfflineFIDOCredential &cred)
508477 if (cred.refilltoken .empty ())
509478 {
510479 pam_syslog (pamh, LOG_DEBUG, " FIDO credential with serial '%s' has no refill token, skipping refill." , cred.serial .c_str ());
511- return 0 ; // Not an error, just nothing to refill
480+ return 0 ;
512481 }
513482
514- // The server's /validate/offlinerefill endpoint expects 'pass', 'refilltoken', 'serial'.
515- // For FIDO, 'pass' is not applicable, so we send an empty string.
516483 map<string, string> parameters =
517484 {
518- {" pass" , " " }, // Empty password for FIDO refill
485+ {" pass" , " " },
519486 {" refilltoken" , cred.refilltoken },
520- {" serial" , cred.serial }};
487+ {" serial" , cred.serial }
488+ };
489+
521490 map<string, string> headers;
522491 string response;
523492
0 commit comments