diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2018-09-29 10:39:02 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2018-09-29 10:39:02 +0200 |
commit | 13274f4bd2009dd928e91f0b6e056cee7f7975a5 (patch) | |
tree | 879436cd490918ffe22cffc4afb69e8001688a97 /src/rest-plugins | |
parent | 6b4ba60da04f3fd799007b3f1890bf156a60d406 (diff) | |
download | gnunet-13274f4bd2009dd928e91f0b6e056cee7f7975a5.tar.gz gnunet-13274f4bd2009dd928e91f0b6e056cee7f7975a5.zip |
add tld handling from config
Diffstat (limited to 'src/rest-plugins')
-rw-r--r-- | src/rest-plugins/plugin_rest_openid_connect.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/rest-plugins/plugin_rest_openid_connect.c b/src/rest-plugins/plugin_rest_openid_connect.c index 2bb60efce..2bcf576fb 100644 --- a/src/rest-plugins/plugin_rest_openid_connect.c +++ b/src/rest-plugins/plugin_rest_openid_connect.c | |||
@@ -1205,6 +1205,33 @@ build_authz_response (void *cls) | |||
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | /** | 1207 | /** |
1208 | * Iterate over tlds in config | ||
1209 | */ | ||
1210 | static void | ||
1211 | tld_iter (void *cls, | ||
1212 | const char *section, | ||
1213 | const char *option, | ||
1214 | const char *value) | ||
1215 | { | ||
1216 | struct RequestHandle *handle = cls; | ||
1217 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | ||
1218 | |||
1219 | if (GNUNET_OK != | ||
1220 | GNUNET_CRYPTO_ecdsa_public_key_from_string (value, | ||
1221 | strlen (value), | ||
1222 | &pkey)) | ||
1223 | { | ||
1224 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1225 | "Skipping non key %s\n", | ||
1226 | value); | ||
1227 | return; | ||
1228 | } | ||
1229 | if ( 0 == memcmp (&pkey, &handle->oidc->client_pkey, | ||
1230 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) ) | ||
1231 | handle->tld = GNUNET_strdup (option+1); | ||
1232 | } | ||
1233 | |||
1234 | /** | ||
1208 | * Responds to authorization GET and url-encoded POST request | 1235 | * Responds to authorization GET and url-encoded POST request |
1209 | * | 1236 | * |
1210 | * @param con_handle the connection handle | 1237 | * @param con_handle the connection handle |
@@ -1287,7 +1314,14 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
1287 | handle->tld = GNUNET_strdup (tmp_ego->identifier); | 1314 | handle->tld = GNUNET_strdup (tmp_ego->identifier); |
1288 | handle->ego_entry = handle->ego_tail; | 1315 | handle->ego_entry = handle->ego_tail; |
1289 | } | 1316 | } |
1290 | } | 1317 | } |
1318 | if (NULL == handle->tld) | ||
1319 | GNUNET_CONFIGURATION_iterate_section_values (cfg, | ||
1320 | "gns", | ||
1321 | tld_iter, | ||
1322 | handle); | ||
1323 | if (NULL == handle->tld) | ||
1324 | handle->tld = GNUNET_strdup (tmp_ego->keystring); | ||
1291 | GNUNET_SCHEDULER_add_now (&build_authz_response, handle); | 1325 | GNUNET_SCHEDULER_add_now (&build_authz_response, handle); |
1292 | } | 1326 | } |
1293 | 1327 | ||