diff options
Diffstat (limited to 'src/exchange')
-rw-r--r-- | src/exchange/taler-exchange-httpd.c | 36 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd.h | 8 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-check.c | 4 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-proof.c | 8 |
4 files changed, 45 insertions, 11 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index aa3a7c412..fb3129591 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -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, diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h index ffbce0e9b..deb5b3e02 100644 --- a/src/exchange/taler-exchange-httpd.h +++ b/src/exchange/taler-exchange-httpd.h @@ -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. diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c index 62ecbaab9..8bc2ac196 100644 --- a/src/exchange/taler-exchange-httpd_kyc-check.c +++ b/src/exchange/taler-exchange-httpd_kyc-check.c @@ -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); diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c b/src/exchange/taler-exchange-httpd_kyc-proof.c index f561a95a8..75ff81e96 100644 --- a/src/exchange/taler-exchange-httpd_kyc-proof.c +++ b/src/exchange/taler-exchange-httpd_kyc-proof.c @@ -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, |