diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-05-22 16:25:38 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-05-22 16:25:38 +0200 |
commit | b2e257ecb9c82b19f6ab23431faa3605718d3f01 (patch) | |
tree | 767b8cf35d6e1c9a741ee7e87f33dc852a6593cc /src/reclaim/plugin_rest_openid_connect.c | |
parent | f9c41505dd2ad80d08d6b516c534df0a66ea55fc (diff) | |
download | gnunet-b2e257ecb9c82b19f6ab23431faa3605718d3f01.tar.gz gnunet-b2e257ecb9c82b19f6ab23431faa3605718d3f01.zip |
clang-format and cleanup
Diffstat (limited to 'src/reclaim/plugin_rest_openid_connect.c')
-rw-r--r-- | src/reclaim/plugin_rest_openid_connect.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c index a29d71c01..93e5ac864 100644 --- a/src/reclaim/plugin_rest_openid_connect.c +++ b/src/reclaim/plugin_rest_openid_connect.c | |||
@@ -15,7 +15,7 @@ | |||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @author Martin Schanzenbach | 21 | * @author Martin Schanzenbach |
@@ -209,12 +209,12 @@ | |||
209 | * OIDC ignored parameter array | 209 | * OIDC ignored parameter array |
210 | */ | 210 | */ |
211 | static char *OIDC_ignored_parameter_array[] = {"display", | 211 | static char *OIDC_ignored_parameter_array[] = {"display", |
212 | "prompt", | 212 | "prompt", |
213 | "ui_locales", | 213 | "ui_locales", |
214 | "response_mode", | 214 | "response_mode", |
215 | "id_token_hint", | 215 | "id_token_hint", |
216 | "login_hint", | 216 | "login_hint", |
217 | "acr_values"}; | 217 | "acr_values"}; |
218 | 218 | ||
219 | /** | 219 | /** |
220 | * OIDC Hash map that keeps track of issued cookies | 220 | * OIDC Hash map that keeps track of issued cookies |
@@ -724,7 +724,7 @@ cookie_identity_interpretation (struct RequestHandle *handle) | |||
724 | strlen (OIDC_COOKIE_HEADER_KEY), | 724 | strlen (OIDC_COOKIE_HEADER_KEY), |
725 | &cache_key); | 725 | &cache_key); |
726 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 726 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
727 | ->header_param_map, | 727 | ->header_param_map, |
728 | &cache_key)) | 728 | &cache_key)) |
729 | { | 729 | { |
730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No cookie found\n"); | 730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No cookie found\n"); |
@@ -772,9 +772,9 @@ cookie_identity_interpretation (struct RequestHandle *handle) | |||
772 | GNUNET_CONTAINER_multihashmap_contains (OIDC_cookie_jar_map, &cache_key)) | 772 | GNUNET_CONTAINER_multihashmap_contains (OIDC_cookie_jar_map, &cache_key)) |
773 | { | 773 | { |
774 | GNUNET_log ( | 774 | GNUNET_log ( |
775 | GNUNET_ERROR_TYPE_WARNING, | 775 | GNUNET_ERROR_TYPE_WARNING, |
776 | "Found cookie `%s', but no corresponding expiration entry present...\n", | 776 | "Found cookie `%s', but no corresponding expiration entry present...\n", |
777 | token); | 777 | token); |
778 | GNUNET_free (cookies); | 778 | GNUNET_free (cookies); |
779 | return; | 779 | return; |
780 | } | 780 | } |
@@ -1020,10 +1020,10 @@ code_redirect (void *cls) | |||
1020 | { | 1020 | { |
1021 | if (GNUNET_OK != | 1021 | if (GNUNET_OK != |
1022 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc | 1022 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc |
1023 | ->login_identity, | 1023 | ->login_identity, |
1024 | strlen ( | 1024 | strlen ( |
1025 | handle->oidc | 1025 | handle->oidc |
1026 | ->login_identity), | 1026 | ->login_identity), |
1027 | &pubkey)) | 1027 | &pubkey)) |
1028 | { | 1028 | { |
1029 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE); | 1029 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE); |
@@ -1191,7 +1191,7 @@ get_url_parameter_copy (const struct RequestHandle *handle, const char *key) | |||
1191 | char *value; | 1191 | char *value; |
1192 | GNUNET_CRYPTO_hash (key, strlen (key), &hc); | 1192 | GNUNET_CRYPTO_hash (key, strlen (key), &hc); |
1193 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 1193 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
1194 | ->url_param_map, | 1194 | ->url_param_map, |
1195 | &hc)) | 1195 | &hc)) |
1196 | return NULL; | 1196 | return NULL; |
1197 | value = | 1197 | value = |
@@ -1264,7 +1264,7 @@ build_authz_response (void *cls) | |||
1264 | &cache_key); | 1264 | &cache_key); |
1265 | if (GNUNET_YES == | 1265 | if (GNUNET_YES == |
1266 | GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 1266 | GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
1267 | ->url_param_map, | 1267 | ->url_param_map, |
1268 | &cache_key)) | 1268 | &cache_key)) |
1269 | { | 1269 | { |
1270 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_ACCESS_DENIED); | 1270 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_ACCESS_DENIED); |
@@ -1370,7 +1370,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
1370 | if (GNUNET_OK != | 1370 | if (GNUNET_OK != |
1371 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc->client_id, | 1371 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc->client_id, |
1372 | strlen ( | 1372 | strlen ( |
1373 | handle->oidc->client_id), | 1373 | handle->oidc->client_id), |
1374 | &handle->oidc->client_pkey)) | 1374 | &handle->oidc->client_pkey)) |
1375 | { | 1375 | { |
1376 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT); | 1376 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT); |
@@ -1455,8 +1455,8 @@ login_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1455 | { | 1455 | { |
1456 | current_time = GNUNET_new (struct GNUNET_TIME_Absolute); | 1456 | current_time = GNUNET_new (struct GNUNET_TIME_Absolute); |
1457 | *current_time = GNUNET_TIME_relative_to_absolute ( | 1457 | *current_time = GNUNET_TIME_relative_to_absolute ( |
1458 | GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (), | 1458 | GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (), |
1459 | OIDC_COOKIE_EXPIRATION)); | 1459 | OIDC_COOKIE_EXPIRATION)); |
1460 | last_time = | 1460 | last_time = |
1461 | GNUNET_CONTAINER_multihashmap_get (OIDC_cookie_jar_map, &cache_key); | 1461 | GNUNET_CONTAINER_multihashmap_get (OIDC_cookie_jar_map, &cache_key); |
1462 | GNUNET_free_non_null (last_time); | 1462 | GNUNET_free_non_null (last_time); |
@@ -1488,7 +1488,7 @@ check_authorization (struct RequestHandle *handle, | |||
1488 | strlen (OIDC_AUTHORIZATION_HEADER_KEY), | 1488 | strlen (OIDC_AUTHORIZATION_HEADER_KEY), |
1489 | &cache_key); | 1489 | &cache_key); |
1490 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 1490 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
1491 | ->header_param_map, | 1491 | ->header_param_map, |
1492 | &cache_key)) | 1492 | &cache_key)) |
1493 | { | 1493 | { |
1494 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_CLIENT); | 1494 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_CLIENT); |
@@ -1620,10 +1620,10 @@ persist_access_token (const struct RequestHandle *handle, | |||
1620 | ticketbuf = GNUNET_new (struct GNUNET_RECLAIM_Ticket); | 1620 | ticketbuf = GNUNET_new (struct GNUNET_RECLAIM_Ticket); |
1621 | *ticketbuf = *ticket; | 1621 | *ticketbuf = *ticket; |
1622 | GNUNET_CONTAINER_multihashmap_put ( | 1622 | GNUNET_CONTAINER_multihashmap_put ( |
1623 | OIDC_access_token_map, | 1623 | OIDC_access_token_map, |
1624 | &hc, | 1624 | &hc, |
1625 | ticketbuf, | 1625 | ticketbuf, |
1626 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1626 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1627 | } | 1627 | } |
1628 | 1628 | ||
1629 | /** | 1629 | /** |
@@ -1826,7 +1826,7 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
1826 | strlen (OIDC_AUTHORIZATION_HEADER_KEY), | 1826 | strlen (OIDC_AUTHORIZATION_HEADER_KEY), |
1827 | &cache_key); | 1827 | &cache_key); |
1828 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 1828 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
1829 | ->header_param_map, | 1829 | ->header_param_map, |
1830 | &cache_key)) | 1830 | &cache_key)) |
1831 | { | 1831 | { |
1832 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN); | 1832 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN); |
@@ -1915,16 +1915,16 @@ init_cont (struct RequestHandle *handle) | |||
1915 | { | 1915 | { |
1916 | struct GNUNET_REST_RequestHandlerError err; | 1916 | struct GNUNET_REST_RequestHandlerError err; |
1917 | static const struct GNUNET_REST_RequestHandler handlers[] = | 1917 | static const struct GNUNET_REST_RequestHandler handlers[] = |
1918 | {{MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_AUTHORIZE, &authorize_endpoint}, | 1918 | {{MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_AUTHORIZE, &authorize_endpoint}, |
1919 | {MHD_HTTP_METHOD_POST, | 1919 | {MHD_HTTP_METHOD_POST, |
1920 | GNUNET_REST_API_NS_AUTHORIZE, | 1920 | GNUNET_REST_API_NS_AUTHORIZE, |
1921 | &authorize_endpoint}, // url-encoded | 1921 | &authorize_endpoint}, // url-encoded |
1922 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_LOGIN, &login_cont}, | 1922 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_LOGIN, &login_cont}, |
1923 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_TOKEN, &token_endpoint}, | 1923 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_TOKEN, &token_endpoint}, |
1924 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint}, | 1924 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint}, |
1925 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint}, | 1925 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint}, |
1926 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_OIDC, &options_cont}, | 1926 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_OIDC, &options_cont}, |
1927 | GNUNET_REST_HANDLER_END}; | 1927 | GNUNET_REST_HANDLER_END}; |
1928 | 1928 | ||
1929 | if (GNUNET_NO == | 1929 | if (GNUNET_NO == |
1930 | GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle)) | 1930 | GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle)) |