public void MakeRequestWithAdditionalFieldInParameterResource(GpConnectInteraction interaction) { var requestFactory = new RequestFactory(interaction, _fhirResourceRepository); requestFactory.ConfigureBody(_httpContext.HttpRequestConfiguration); requestFactory.ConfigureParameterResourceWithAdditionalField(_httpContext.HttpRequestConfiguration); _httpContext.HttpRequestConfiguration.RequestHeaders.ReplaceHeader(HttpConst.Headers.kAuthorization, jwtHelper.GetBearerToken()); var httpRequest = new HttpContextRequest(_httpContext, _securityContext); httpRequest.MakeRequest(); }
public void MakeRequestWithAnUnencodedJwtBearerToken(GpConnectInteraction interaction) { var requestFactory = new RequestFactory(interaction, _fhirResourceRepository); requestFactory.ConfigureBody(_httpContext.HttpRequestConfiguration); _httpContext.HttpRequestConfiguration.RequestHeaders.ReplaceHeader(HttpConst.Headers.kAuthorization, jwtHelper.GetBearerTokenWithoutEncoding()); var httpRequest = new HttpContextRequest(_httpContext, _securityContext); httpRequest.MakeRequest(); }
public HttpRequestConfiguration GetRequestBody(GpConnectInteraction interaction, HttpRequestConfiguration httpRequestConfiguration = null) { if (httpRequestConfiguration == null) { httpRequestConfiguration = new HttpRequestConfiguration(); } var requestFactory = new RequestFactory(interaction, _fhirResourceRepository); requestFactory.ConfigureBody(httpRequestConfiguration); return(httpRequestConfiguration); }
public Resource GetResourceForRelativeUrl(GpConnectInteraction gpConnectInteraction, string relativeUrl) { var httpRequestConfiguration = new HttpRequestConfiguration(); var httpContextFactory = new HttpRequestConfigurationFactory(gpConnectInteraction, httpRequestConfiguration); httpContextFactory.GetHttpRequestConfiguration(); var jwtHelper = new JwtHelper(); var jwtFactory = new JwtFactory(gpConnectInteraction); jwtFactory.ConfigureJwt(jwtHelper); if (relativeUrl.Contains("Patient")) { var patient = relativeUrl.ToLower().Replace("/", string.Empty); try { jwtHelper.RequestedPatientNHSNumber = GlobalContext.PatientNhsNumberMap[patient]; } catch (Exception) { Patient patientResource = _fhirResourceRepository.Patient; var nhsNumber = patientResource.Identifier[0].Value; jwtHelper.RequestedPatientNHSNumber = nhsNumber; } } if (relativeUrl.Contains("Organization")) { var organizationId = relativeUrl.Split('/')[1]; jwtHelper.RequestedOrganizationId = organizationId; } httpRequestConfiguration.RequestUrl = relativeUrl; _securitySteps.ConfigureServerCertificatesAndSsl(); var requestFactory = new RequestFactory(gpConnectInteraction, _fhirResourceRepository); requestFactory.ConfigureBody(httpRequestConfiguration); httpRequestConfiguration.RequestHeaders.ReplaceHeader(HttpConst.Headers.kAuthorization, jwtHelper.GetBearerToken()); var httpRequest = new HttpResourceRequest(httpRequestConfiguration, _securityContext); return(httpRequest.MakeRequest().Resource); }