aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_rest_openid_connect.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-10-15 09:09:23 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-10-15 12:11:22 +0200
commit5680378974db794d67b75473435a0651fad0cd24 (patch)
tree06e1426049f9604114f9328554dc324b422052f4 /src/reclaim/plugin_rest_openid_connect.c
parent7b992510c25c0081c59c4b1f61fe42ff5dc7680d (diff)
downloadgnunet-5680378974db794d67b75473435a0651fad0cd24.tar.gz
gnunet-5680378974db794d67b75473435a0651fad0cd24.zip
- towards fix reclaim
Diffstat (limited to 'src/reclaim/plugin_rest_openid_connect.c')
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c
index 5b0bb2b6f..7a8a886bd 100644
--- a/src/reclaim/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -300,7 +300,7 @@ struct OIDC_Variables
300 /** 300 /**
301 * The RP client public key 301 * The RP client public key
302 */ 302 */
303 struct GNUNET_CRYPTO_EcdsaPublicKey client_pkey; 303 struct GNUNET_IDENTITY_PublicKey client_pkey;
304 304
305 /** 305 /**
306 * The OIDC client id of the RP 306 * The OIDC client id of the RP
@@ -411,7 +411,7 @@ struct RequestHandle
411 /** 411 /**
412 * Pointer to ego private key 412 * Pointer to ego private key
413 */ 413 */
414 struct GNUNET_CRYPTO_EcdsaPrivateKey priv_key; 414 struct GNUNET_IDENTITY_PrivateKey priv_key;
415 415
416 /** 416 /**
417 * OIDC variables 417 * OIDC variables
@@ -972,7 +972,7 @@ oidc_ticket_issue_cb (void *cls,
972 (NULL != handle->tld)) 972 (NULL != handle->tld))
973 { 973 {
974 GNUNET_asprintf (&redirect_uri, 974 GNUNET_asprintf (&redirect_uri,
975 "%s.%s/%s?%s=%s&state=%s", 975 "%s.%s/%s%s%s=%s&state=%s",
976 handle->redirect_prefix, 976 handle->redirect_prefix,
977 handle->tld, 977 handle->tld,
978 handle->redirect_suffix, 978 handle->redirect_suffix,
@@ -1087,7 +1087,7 @@ oidc_cred_collect_finished_cb (void *cls)
1087 */ 1087 */
1088static void 1088static void
1089oidc_cred_collect (void *cls, 1089oidc_cred_collect (void *cls,
1090 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1090 const struct GNUNET_IDENTITY_PublicKey *identity,
1091 const struct GNUNET_RECLAIM_Credential *cred) 1091 const struct GNUNET_RECLAIM_Credential *cred)
1092{ 1092{
1093 struct RequestHandle *handle = cls; 1093 struct RequestHandle *handle = cls;
@@ -1211,7 +1211,7 @@ attr_in_userinfo_request (struct RequestHandle *handle,
1211 */ 1211 */
1212static void 1212static void
1213oidc_attr_collect (void *cls, 1213oidc_attr_collect (void *cls,
1214 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1214 const struct GNUNET_IDENTITY_PublicKey *identity,
1215 const struct GNUNET_RECLAIM_Attribute *attr) 1215 const struct GNUNET_RECLAIM_Attribute *attr)
1216{ 1216{
1217 struct RequestHandle *handle = cls; 1217 struct RequestHandle *handle = cls;
@@ -1260,8 +1260,8 @@ code_redirect (void *cls)
1260 struct RequestHandle *handle = cls; 1260 struct RequestHandle *handle = cls;
1261 struct GNUNET_TIME_Absolute current_time; 1261 struct GNUNET_TIME_Absolute current_time;
1262 struct GNUNET_TIME_Absolute *relog_time; 1262 struct GNUNET_TIME_Absolute *relog_time;
1263 struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 1263 struct GNUNET_IDENTITY_PublicKey pubkey;
1264 struct GNUNET_CRYPTO_EcdsaPublicKey ego_pkey; 1264 struct GNUNET_IDENTITY_PublicKey ego_pkey;
1265 struct GNUNET_HashCode cache_key; 1265 struct GNUNET_HashCode cache_key;
1266 char *identity_cookie; 1266 char *identity_cookie;
1267 1267
@@ -1281,11 +1281,8 @@ code_redirect (void *cls)
1281 if (current_time.abs_value_us <= relog_time->abs_value_us) 1281 if (current_time.abs_value_us <= relog_time->abs_value_us)
1282 { 1282 {
1283 if (GNUNET_OK != 1283 if (GNUNET_OK !=
1284 GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc 1284 GNUNET_IDENTITY_public_key_from_string (handle->oidc
1285 ->login_identity, 1285 ->login_identity,
1286 strlen (
1287 handle->oidc
1288 ->login_identity),
1289 &pubkey)) 1286 &pubkey))
1290 { 1287 {
1291 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE); 1288 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE);
@@ -1376,7 +1373,7 @@ lookup_redirect_uri_result (void *cls,
1376 char *tmp; 1373 char *tmp;
1377 char *tmp_key_str; 1374 char *tmp_key_str;
1378 char *pos; 1375 char *pos;
1379 struct GNUNET_CRYPTO_EcdsaPublicKey redirect_zone; 1376 struct GNUNET_IDENTITY_PublicKey redirect_zone;
1380 1377
1381 handle->gns_op = NULL; 1378 handle->gns_op = NULL;
1382 if (0 == rd_count) 1379 if (0 == rd_count)
@@ -1608,10 +1605,10 @@ static void
1608tld_iter (void *cls, const char *section, const char *option, const char *value) 1605tld_iter (void *cls, const char *section, const char *option, const char *value)
1609{ 1606{
1610 struct RequestHandle *handle = cls; 1607 struct RequestHandle *handle = cls;
1611 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 1608 struct GNUNET_IDENTITY_PublicKey pkey;
1612 1609
1613 if (GNUNET_OK != 1610 if (GNUNET_OK !=
1614 GNUNET_CRYPTO_ecdsa_public_key_from_string (value, strlen (value), &pkey)) 1611 GNUNET_IDENTITY_public_key_from_string (value, &pkey))
1615 { 1612 {
1616 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Skipping non key %s\n", value); 1613 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Skipping non key %s\n", value);
1617 return; 1614 return;
@@ -1635,8 +1632,8 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1635{ 1632{
1636 struct RequestHandle *handle = cls; 1633 struct RequestHandle *handle = cls;
1637 struct EgoEntry *tmp_ego; 1634 struct EgoEntry *tmp_ego;
1638 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 1635 const struct GNUNET_IDENTITY_PrivateKey *priv_key;
1639 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 1636 struct GNUNET_IDENTITY_PublicKey pkey;
1640 1637
1641 cookie_identity_interpretation (handle); 1638 cookie_identity_interpretation (handle);
1642 1639
@@ -1664,9 +1661,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1664 } 1661 }
1665 1662
1666 if (GNUNET_OK != 1663 if (GNUNET_OK !=
1667 GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc->client_id, 1664 GNUNET_IDENTITY_public_key_from_string (handle->oidc->client_id,
1668 strlen (
1669 handle->oidc->client_id),
1670 &handle->oidc->client_pkey)) 1665 &handle->oidc->client_pkey))
1671 { 1666 {
1672 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT); 1667 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT);
@@ -1682,7 +1677,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1682 for (tmp_ego = ego_head; NULL != tmp_ego; tmp_ego = tmp_ego->next) 1677 for (tmp_ego = ego_head; NULL != tmp_ego; tmp_ego = tmp_ego->next)
1683 { 1678 {
1684 priv_key = GNUNET_IDENTITY_ego_get_private_key (tmp_ego->ego); 1679 priv_key = GNUNET_IDENTITY_ego_get_private_key (tmp_ego->ego);
1685 GNUNET_CRYPTO_ecdsa_key_get_public (priv_key, &pkey); 1680 GNUNET_IDENTITY_key_get_public (priv_key, &pkey);
1686 if (0 == GNUNET_memcmp (&pkey, &handle->oidc->client_pkey)) 1681 if (0 == GNUNET_memcmp (&pkey, &handle->oidc->client_pkey))
1687 { 1682 {
1688 handle->tld = GNUNET_strdup (tmp_ego->identifier); 1683 handle->tld = GNUNET_strdup (tmp_ego->identifier);
@@ -1865,7 +1860,7 @@ parse_credentials_post_body (struct RequestHandle *handle,
1865 1860
1866static int 1861static int
1867check_authorization (struct RequestHandle *handle, 1862check_authorization (struct RequestHandle *handle,
1868 struct GNUNET_CRYPTO_EcdsaPublicKey *cid) 1863 struct GNUNET_IDENTITY_PublicKey *cid)
1869{ 1864{
1870 char *expected_pass; 1865 char *expected_pass;
1871 char *received_cid; 1866 char *received_cid;
@@ -1902,7 +1897,7 @@ check_authorization (struct RequestHandle *handle,
1902 GNUNET_STRINGS_string_to_data (received_cid, 1897 GNUNET_STRINGS_string_to_data (received_cid,
1903 strlen (received_cid), 1898 strlen (received_cid),
1904 cid, 1899 cid,
1905 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 1900 sizeof(struct GNUNET_IDENTITY_PublicKey));
1906 GNUNET_free (received_cid); 1901 GNUNET_free (received_cid);
1907 return GNUNET_OK; 1902 return GNUNET_OK;
1908 1903
@@ -1948,7 +1943,7 @@ check_authorization (struct RequestHandle *handle,
1948 GNUNET_STRINGS_string_to_data (received_cid, 1943 GNUNET_STRINGS_string_to_data (received_cid,
1949 strlen (received_cid), 1944 strlen (received_cid),
1950 cid, 1945 cid,
1951 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 1946 sizeof(struct GNUNET_IDENTITY_PublicKey));
1952 1947
1953 GNUNET_free (received_cpw); 1948 GNUNET_free (received_cpw);
1954 GNUNET_free (received_cid); 1949 GNUNET_free (received_cid);
@@ -1958,10 +1953,10 @@ check_authorization (struct RequestHandle *handle,
1958 1953
1959const struct EgoEntry * 1954const struct EgoEntry *
1960find_ego (struct RequestHandle *handle, 1955find_ego (struct RequestHandle *handle,
1961 struct GNUNET_CRYPTO_EcdsaPublicKey *test_key) 1956 struct GNUNET_IDENTITY_PublicKey *test_key)
1962{ 1957{
1963 struct EgoEntry *ego_entry; 1958 struct EgoEntry *ego_entry;
1964 struct GNUNET_CRYPTO_EcdsaPublicKey pub_key; 1959 struct GNUNET_IDENTITY_PublicKey pub_key;
1965 1960
1966 for (ego_entry = ego_head; NULL != ego_entry; 1961 for (ego_entry = ego_head; NULL != ego_entry;
1967 ego_entry = ego_entry->next) 1962 ego_entry = ego_entry->next)
@@ -1992,7 +1987,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1992 struct GNUNET_RECLAIM_AttributeList *cl = NULL; 1987 struct GNUNET_RECLAIM_AttributeList *cl = NULL;
1993 struct GNUNET_RECLAIM_PresentationList *pl = NULL; 1988 struct GNUNET_RECLAIM_PresentationList *pl = NULL;
1994 struct GNUNET_RECLAIM_Ticket ticket; 1989 struct GNUNET_RECLAIM_Ticket ticket;
1995 struct GNUNET_CRYPTO_EcdsaPublicKey cid; 1990 struct GNUNET_IDENTITY_PublicKey cid;
1996 struct GNUNET_HashCode cache_key; 1991 struct GNUNET_HashCode cache_key;
1997 struct MHD_Response *resp; 1992 struct MHD_Response *resp;
1998 char *grant_type; 1993 char *grant_type;
@@ -2145,7 +2140,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2145 */ 2140 */
2146static void 2141static void
2147consume_ticket (void *cls, 2142consume_ticket (void *cls,
2148 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 2143 const struct GNUNET_IDENTITY_PublicKey *identity,
2149 const struct GNUNET_RECLAIM_Attribute *attr, 2144 const struct GNUNET_RECLAIM_Attribute *attr,
2150 const struct GNUNET_RECLAIM_Presentation *pres) 2145 const struct GNUNET_RECLAIM_Presentation *pres)
2151{ 2146{
@@ -2225,7 +2220,7 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2225 char *authorization_type; 2220 char *authorization_type;
2226 char *authorization_access_token; 2221 char *authorization_access_token;
2227 const struct EgoEntry *aud_ego; 2222 const struct EgoEntry *aud_ego;
2228 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 2223 const struct GNUNET_IDENTITY_PrivateKey *privkey;
2229 2224
2230 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Getting userinfo\n"); 2225 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Getting userinfo\n");
2231 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY, 2226 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY,
@@ -2349,7 +2344,7 @@ list_ego (void *cls,
2349 const char *identifier) 2344 const char *identifier)
2350{ 2345{
2351 struct EgoEntry *ego_entry; 2346 struct EgoEntry *ego_entry;
2352 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 2347 struct GNUNET_IDENTITY_PublicKey pk;
2353 2348
2354 if ((NULL == ego) && (ID_REST_STATE_INIT == state)) 2349 if ((NULL == ego) && (ID_REST_STATE_INIT == state))
2355 { 2350 {
@@ -2362,7 +2357,7 @@ list_ego (void *cls,
2362 { 2357 {
2363 ego_entry = GNUNET_new (struct EgoEntry); 2358 ego_entry = GNUNET_new (struct EgoEntry);
2364 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 2359 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
2365 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 2360 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
2366 ego_entry->ego = ego; 2361 ego_entry->ego = ego;
2367 ego_entry->identifier = GNUNET_strdup (identifier); 2362 ego_entry->identifier = GNUNET_strdup (identifier);
2368 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 2363 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -2389,7 +2384,7 @@ list_ego (void *cls,
2389 /* Add */ 2384 /* Add */
2390 ego_entry = GNUNET_new (struct EgoEntry); 2385 ego_entry = GNUNET_new (struct EgoEntry);
2391 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 2386 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
2392 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 2387 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
2393 ego_entry->ego = ego; 2388 ego_entry->ego = ego;
2394 ego_entry->identifier = GNUNET_strdup (identifier); 2389 ego_entry->identifier = GNUNET_strdup (identifier);
2395 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 2390 GNUNET_CONTAINER_DLL_insert_tail (ego_head,