Beispiel #1
0
        /// <summary>
        /// Forwards the passed <see cref="HttpContext.Request"/> to the wrapped API and writes the result back into the <see cref="HttpResponse"/> of the passed <see cref="HttpContext"/> for
        /// further processing. Furthermore, this method extracts the authorization header value (if present) and updates the local copy
        /// </summary>
        /// <param name="context"></param>
        protected void Forward(SKotstein.Net.Http.Context.HttpContext context)
        {
            ApiRequest apiRequest = ApiRequest.Create(context.Request, _remoteApiBasePath);


            if (!UpdateAcessTokenAutomatically)
            {
                apiRequest.WithAuthHeader(_authorization);
            }

            ApiResponse response = _apiClient.Send(apiRequest);

            response.CopyTo(context.Response);

            if (context.Request.Headers.Has("Authorization"))
            {
                if (UpdateAcessTokenAutomatically)
                {
                    UpdateAuthorization(context.Request.Headers.Get("Authorization"));
                }
            }
        }
Beispiel #2
0
 public abstract void ProcessPut(SKotstein.Net.Http.Context.HttpContext context);