add more flexibility to endpoint naming for KYC
This commit is contained in:
parent
fc1383ebd1
commit
b496b8fed5
@ -1413,12 +1413,12 @@ parse_kyc_oauth_cfg (void)
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CONFIGURATION_get_value_string (TEH_cfg,
|
||||
"exchange-kyc-oauth2",
|
||||
"KYC_OAUTH2_URL",
|
||||
"KYC_OAUTH2_AUTH_URL",
|
||||
&s))
|
||||
{
|
||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||
"exchange-kyc-oauth2",
|
||||
"KYC_OAUTH2_URL");
|
||||
"KYC_OAUTH2_AUTH_URL");
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if ( (! TALER_url_valid_charset (s)) ||
|
||||
@ -1431,12 +1431,40 @@ parse_kyc_oauth_cfg (void)
|
||||
{
|
||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||
"exchange-kyc-oauth2",
|
||||
"KYC_OAUTH2_URL",
|
||||
"KYC_OAUTH2_AUTH_URL",
|
||||
"not a valid URL");
|
||||
GNUNET_free (s);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
TEH_kyc_config.details.oauth2.url = s;
|
||||
TEH_kyc_config.details.oauth2.auth_url = s;
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CONFIGURATION_get_value_string (TEH_cfg,
|
||||
"exchange-kyc-oauth2",
|
||||
"KYC_OAUTH2_LOGIN_URL",
|
||||
&s))
|
||||
{
|
||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||
"exchange-kyc-oauth2",
|
||||
"KYC_OAUTH2_LOGIN_URL");
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if ( (! TALER_url_valid_charset (s)) ||
|
||||
( (0 != strncasecmp (s,
|
||||
"http://",
|
||||
strlen ("http://"))) &&
|
||||
(0 != strncasecmp (s,
|
||||
"https://",
|
||||
strlen ("https://"))) ) )
|
||||
{
|
||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||
"exchange-kyc-oauth2",
|
||||
"KYC_OAUTH2_LOGIN_URL",
|
||||
"not a valid URL");
|
||||
GNUNET_free (s);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
TEH_kyc_config.details.oauth2.login_url = s;
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CONFIGURATION_get_value_string (TEH_cfg,
|
||||
|
@ -93,8 +93,14 @@ struct TEH_KycOptions
|
||||
|
||||
/**
|
||||
* URL of the OAuth2.0 endpoint for KYC checks.
|
||||
* (token/auth)
|
||||
*/
|
||||
char *url;
|
||||
char *auth_url;
|
||||
|
||||
/**
|
||||
* URL of the OAuth2.0 endpoint for KYC checks.
|
||||
*/
|
||||
char *login_url;
|
||||
|
||||
/**
|
||||
* URL of the user info access endpoint.
|
||||
|
@ -395,8 +395,8 @@ TEH_handler_kyc_check (
|
||||
redirect_uri_encoded = TALER_urlencode (redirect_uri);
|
||||
GNUNET_free (redirect_uri);
|
||||
GNUNET_asprintf (&url,
|
||||
"%s/login?client_id=%s&redirect_uri=%s",
|
||||
TEH_kyc_config.details.oauth2.url,
|
||||
"%s?client_id=%s&redirect_uri=%s",
|
||||
TEH_kyc_config.details.oauth2.login_url,
|
||||
TEH_kyc_config.details.oauth2.client_id,
|
||||
redirect_uri_encoded);
|
||||
GNUNET_free (redirect_uri_encoded);
|
||||
|
@ -579,8 +579,8 @@ TEH_handler_kyc_proof (
|
||||
"curl_easy_init");
|
||||
}
|
||||
GNUNET_asprintf (&kpc->token_url,
|
||||
"%stoken",
|
||||
TEH_kyc_config.details.oauth2.url);
|
||||
"%s",
|
||||
TEH_kyc_config.details.oauth2.auth_url);
|
||||
GNUNET_assert (CURLE_OK ==
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_URL,
|
||||
@ -603,8 +603,8 @@ TEH_handler_kyc_proof (
|
||||
char *request_uri;
|
||||
|
||||
GNUNET_asprintf (&request_uri,
|
||||
"%slogin?client_id=%s",
|
||||
TEH_kyc_config.details.oauth2.url,
|
||||
"%s?client_id=%s",
|
||||
TEH_kyc_config.details.oauth2.login_url,
|
||||
TEH_kyc_config.details.oauth2.client_id);
|
||||
redirect_uri = curl_easy_escape (eh,
|
||||
request_uri,
|
||||
|
@ -432,7 +432,7 @@ run (void *cls,
|
||||
/* Try resolving a deposit's WTID, as we never triggered
|
||||
* execution of transactions, the answer should be that
|
||||
* the exchange knows about the deposit, but has no WTID yet.
|
||||
*///
|
||||
*/
|
||||
TALER_TESTING_cmd_track_transaction ("deposit-wtid-found",
|
||||
"deposit-simple",
|
||||
0,
|
||||
@ -458,7 +458,7 @@ run (void *cls,
|
||||
* happen here, as each deposit operation is run with a
|
||||
* fresh merchant public key, so the aggregator will treat
|
||||
* them as "different" merchants and do the wire transfers
|
||||
* individually. *///
|
||||
* individually. */
|
||||
CMD_EXEC_AGGREGATOR ("run-aggregator"),
|
||||
/**
|
||||
* Check all the transfers took place.
|
||||
|
@ -56,7 +56,8 @@ KYC_WITHDRAW_LIMIT = EUR:8
|
||||
|
||||
[exchange-kyc-oauth2]
|
||||
|
||||
KYC_OAUTH2_URL = http://localhost:6666/oauth/v2/login
|
||||
KYC_OAUTH2_AUTH_URL = http://localhost:6666/oauth/v2/token
|
||||
KYC_OAUTH2_LOGIN_URL = http://localhost:6666/oauth/v2/login
|
||||
KYC_INFO_URL = http://localhost:6666/api/user/me
|
||||
KYC_OAUTH2_CLIENT_ID = taler-exchange
|
||||
KYC_OAUTH2_CLIENT_SECRET = exchange-secret
|
||||
|
Loading…
Reference in New Issue
Block a user