diff options
Diffstat (limited to 'src/identity-provider')
-rw-r--r-- | src/identity-provider/plugin_rest_identity_provider.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/identity-provider/plugin_rest_identity_provider.c index 1ad0aef42..9e19b081e 100644 --- a/src/identity-provider/plugin_rest_identity_provider.c +++ b/src/identity-provider/plugin_rest_identity_provider.c | |||
@@ -1106,8 +1106,6 @@ authorize_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1106 | 1106 | ||
1107 | int size=sizeof(OIDC_ignored_parameter_array)/sizeof(char *); | 1107 | int size=sizeof(OIDC_ignored_parameter_array)/sizeof(char *); |
1108 | 1108 | ||
1109 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Size %i = 8\n", size); | ||
1110 | |||
1111 | struct GNUNET_HashCode cache_key; | 1109 | struct GNUNET_HashCode cache_key; |
1112 | 1110 | ||
1113 | GNUNET_CRYPTO_hash (OIDC_RESPONSE_TYPE_KEY, strlen (OIDC_RESPONSE_TYPE_KEY), | 1111 | GNUNET_CRYPTO_hash (OIDC_RESPONSE_TYPE_KEY, strlen (OIDC_RESPONSE_TYPE_KEY), |
@@ -1116,7 +1114,6 @@ authorize_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1116 | &cache_key)) | 1114 | &cache_key)) |
1117 | { | 1115 | { |
1118 | //TODO error | 1116 | //TODO error |
1119 | |||
1120 | } | 1117 | } |
1121 | response_type = GNUNET_CONTAINER_multihashmap_get(handle->rest_handle->url_param_map, | 1118 | response_type = GNUNET_CONTAINER_multihashmap_get(handle->rest_handle->url_param_map, |
1122 | &cache_key); | 1119 | &cache_key); |
@@ -1152,23 +1149,23 @@ authorize_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1152 | redirect_uri = GNUNET_CONTAINER_multihashmap_get(handle->rest_handle->url_param_map, | 1149 | redirect_uri = GNUNET_CONTAINER_multihashmap_get(handle->rest_handle->url_param_map, |
1153 | &cache_key); | 1150 | &cache_key); |
1154 | 1151 | ||
1152 | //RECOMMENDED value: state | ||
1155 | GNUNET_CRYPTO_hash (OIDC_STATE_KEY, strlen (OIDC_STATE_KEY), &cache_key); | 1153 | GNUNET_CRYPTO_hash (OIDC_STATE_KEY, strlen (OIDC_STATE_KEY), &cache_key); |
1156 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle->url_param_map, | 1154 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle->url_param_map, |
1157 | &cache_key)) | 1155 | &cache_key)) |
1158 | { | 1156 | { |
1159 | //TODO error | 1157 | state = GNUNET_CONTAINER_multihashmap_get(handle->rest_handle->url_param_map, |
1158 | &cache_key); | ||
1160 | } | 1159 | } |
1161 | state = GNUNET_CONTAINER_multihashmap_get(handle->rest_handle->url_param_map, | ||
1162 | &cache_key); | ||
1163 | 1160 | ||
1161 | //OPTIONAL value: nonce | ||
1164 | GNUNET_CRYPTO_hash (OIDC_NONCE_KEY, strlen (OIDC_NONCE_KEY), &cache_key); | 1162 | GNUNET_CRYPTO_hash (OIDC_NONCE_KEY, strlen (OIDC_NONCE_KEY), &cache_key); |
1165 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle->url_param_map, | 1163 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle->url_param_map, |
1166 | &cache_key)) | 1164 | &cache_key)) |
1167 | { | 1165 | { |
1168 | //TODO error | 1166 | nonce = GNUNET_CONTAINER_multihashmap_get(handle->rest_handle->url_param_map, |
1167 | &cache_key); | ||
1169 | } | 1168 | } |
1170 | nonce = GNUNET_CONTAINER_multihashmap_get(handle->rest_handle->url_param_map, | ||
1171 | &cache_key); | ||
1172 | 1169 | ||
1173 | int iterator; | 1170 | int iterator; |
1174 | for( iterator = 0; iterator < size; iterator++ ) | 1171 | for( iterator = 0; iterator < size; iterator++ ) |
@@ -1214,18 +1211,19 @@ authorize_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1214 | &login_base_url)) | 1211 | &login_base_url)) |
1215 | { | 1212 | { |
1216 | char* new_redirect; | 1213 | char* new_redirect; |
1217 | GNUNET_asprintf (&new_redirect, "%s?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s&%s=%s", | 1214 | GNUNET_asprintf (&new_redirect, "%s?%s=%s&%s=%s&%s=%s&%s=%s", |
1218 | login_base_url, | 1215 | login_base_url, |
1219 | OIDC_RESPONSE_TYPE_KEY, response_type, | 1216 | OIDC_RESPONSE_TYPE_KEY, response_type, |
1220 | OIDC_CLIENT_ID_KEY, client_id, | 1217 | OIDC_CLIENT_ID_KEY, client_id, |
1221 | OIDC_REDIRECT_URI_KEY, redirect_uri, | 1218 | OIDC_REDIRECT_URI_KEY, redirect_uri, |
1222 | OIDC_SCOPE_KEY, scope, | 1219 | OIDC_SCOPE_KEY, scope, |
1223 | OIDC_STATE_KEY, state, | 1220 | OIDC_STATE_KEY, ( 0 == state )? "" : state, |
1224 | OIDC_NONCE_KEY, nonce | 1221 | OIDC_NONCE_KEY, ( 0 == nonce )? "" : nonce |
1225 | ); | 1222 | ); |
1226 | resp = GNUNET_REST_create_response (""); | 1223 | resp = GNUNET_REST_create_response (""); |
1227 | MHD_add_response_header (resp, "Location", new_redirect); | 1224 | MHD_add_response_header (resp, "Location", new_redirect); |
1228 | }else{ | 1225 | } else |
1226 | { | ||
1229 | handle->emsg=GNUNET_strdup("No server on localhost:8000"); | 1227 | handle->emsg=GNUNET_strdup("No server on localhost:8000"); |
1230 | handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; | 1228 | handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; |
1231 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 1229 | GNUNET_SCHEDULER_add_now (&do_error, handle); |