From 4392961dd95582b91e173f9ae40ac510b9afe7d4 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Mon, 11 Apr 2022 16:28:43 -0400 Subject: Added token validation to all api calls, esp. checkins. Changed status reports to use better query structure. Added query derived types to the request derived types directly. Requires testing of actual builds. --- player/endpoints.f90 | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'player/endpoints.f90') diff --git a/player/endpoints.f90 b/player/endpoints.f90 index 09d3faa..8708592 100644 --- a/player/endpoints.f90 +++ b/player/endpoints.f90 @@ -57,6 +57,27 @@ contains end subroutine base_url + subroutine append_query_token(url) + use config, only: token + implicit none + + character(len=*), intent(inout)::url + character::prepend + + if(len_trim(token) > 0) then + + if(index(url, "?") > 0) then + prepend = "&" + else + prepend = "?" + end if + + url = trim(url)//prepend//"token="//trim(token) + + end if + + end subroutine append_query_token + subroutine get_check_in_url(res) use config use utilities, only: replace_field @@ -66,6 +87,7 @@ contains call base_url(captain, LOCATION_CHECK_IN, .false., res) call replace_field(res, "name", identity) + call append_query_token(res) end subroutine get_check_in_url @@ -92,9 +114,11 @@ contains call replace_field(url, "step", step) if(present(status)) then - url = trim(url)//"?"//trim(status_text(status)) + url = trim(url)//"?status="//trim(status_text(status)) end if - + + call append_query_token(url) + end subroutine get_status_url subroutine get_job_report_url(job, success, res) @@ -113,6 +137,8 @@ contains end if call replace_field(res, "name", identity) call replace_field(res, "jobid", job) + + call append_query_token(res) end subroutine get_job_report_url -- cgit v1.2.3