public override void ProcessRequest(ICommunicationContext ctx) { var serviceName = ctx.GetServiceName(); var instanceId = ctx.GetInstanceID(); var bookmark = ctx.GetBookmark(); var workspaceId = ctx.GetWorkspaceID(); var requestTo = new WebRequestTO(); var xml = new SubmittedData().GetPostData(ctx); if (!string.IsNullOrEmpty(xml)) { requestTo.RawRequestPayload = xml; } requestTo.ServiceName = serviceName; requestTo.InstanceID = instanceId; requestTo.Bookmark = bookmark; requestTo.WebServerUrl = ctx.Request.Uri.ToString(); requestTo.Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}"; var variables = ctx.Request.BoundVariables; if (variables != null) { foreach (string key in variables) { requestTo.Variables.Add(key, variables[key]); } } Thread.CurrentPrincipal = ctx.Request.User; var responseWriter = CreateForm(requestTo, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User); ctx.Send(responseWriter); }
public override void ProcessRequest(ICommunicationContext ctx) { LoadSecuritySettings(); var serviceName = ctx.GetServiceName(); var instanceId = ctx.GetInstanceID(); var bookmark = ctx.GetBookmark(); var workspaceId = ctx.GetWorkspaceID(); var requestTo = new WebRequestTO { ServiceName = serviceName, InstanceID = instanceId, Bookmark = bookmark, WebServerUrl = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}/public/{OverrideResource.Name}", Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}" }; var data = SubmittedData.GetPostData(ctx); if (!string.IsNullOrEmpty(data)) { requestTo.RawRequestPayload = data; } var variables = ctx.Request.BoundVariables; if (variables != null) { foreach (string key in variables) { requestTo.Variables.Add(key, variables[key]); } } Thread.CurrentPrincipal = ctx.Request.User; try { var response = ExecuteWorkflow(requestTo, $"{OverrideResource.Name}.json", workspaceId, ctx.FetchHeaders(), ctx.Request.User); ctx.Send(response); } catch (Exception e) { Dev2Logger.Warn($"failed processing login request: {e.Message}", GlobalConstants.WarewolfWarn); throw; } }
public override void ProcessRequest(ICommunicationContext ctx) { var serviceName = ctx.GetServiceName(); var instanceId = ctx.GetInstanceID(); var bookmark = ctx.GetBookmark(); ctx.GetDataListID(); var workspaceId = ctx.GetWorkspaceID(); var formData = new WebRequestTO(); var xml = new SubmittedData().GetPostData(ctx); if (!string.IsNullOrEmpty(xml)) { formData.RawRequestPayload = xml; } formData.ServiceName = serviceName; formData.InstanceID = instanceId; formData.Bookmark = bookmark; formData.WebServerUrl = ctx.Request.Uri.ToString(); formData.Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}"; if (ExecutingUser == null) { throw new Exception(ErrorResource.NullExecutingUser); } try { // Execute in its own thread to give proper context var t = new Thread(() => { Thread.CurrentPrincipal = ExecutingUser; var responseWriter = CreateForm(formData, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User); ctx.Send(responseWriter); }); t.Start(); t.Join(); } catch (Exception e) { Dev2Logger.Error(this, e, GlobalConstants.WarewolfError); } }
public override void ProcessRequest(ICommunicationContext ctx) { var postDataListId = ctx.GetDataListID(); if (postDataListId != null) { new WebPostRequestHandler(_resourceCatalog, _testCatalog, _testCoverageCatalog, _esbChannelFactory).ProcessRequest(ctx); return; } var serviceName = ctx.GetServiceName(); var workspaceId = ctx.GetWorkspaceID(); var requestTo = new WebRequestTO { ServiceName = serviceName, WebServerUrl = ctx.Request.Uri.ToString(), Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}", IsUrlWithTokenPrefix = ctx.Request.IsTokenAuthentication }; var data = new SubmittedData().GetPostData(ctx); if (!string.IsNullOrEmpty(data)) { requestTo.RawRequestPayload = data; } var variables = ctx.Request.BoundVariables; if (variables != null) { foreach (string key in variables) { requestTo.Variables.Add(key, variables[key]); } } // Execute in its own thread to give proper context ;) Thread.CurrentPrincipal = ctx.Request.User; var responseWriter = CreateForm(requestTo, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User); ctx.Send(responseWriter); }
public override void ProcessRequest(ICommunicationContext ctx) { var postDataListID = ctx.GetDataListID(); if (postDataListID != null) { _catalog = _catalog ?? ResourceCatalog.Instance; _testCatalog = _testCatalog ?? TestCatalog.Instance; new WebPostRequestHandler(_catalog, _testCatalog).ProcessRequest(ctx); return; } var serviceName = ctx.GetServiceName(); var workspaceID = ctx.GetWorkspaceID(); var requestTO = new WebRequestTO { ServiceName = serviceName, WebServerUrl = ctx.Request.Uri.ToString(), Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}" }; var data = SubmittedData.GetPostData(ctx); if (!string.IsNullOrEmpty(data)) { requestTO.RawRequestPayload = data; } var variables = ctx.Request.BoundVariables; if (variables != null) { foreach (string key in variables) { requestTO.Variables.Add(key, variables[key]); } } // Execute in its own thread to give proper context ;) Thread.CurrentPrincipal = ctx.Request.User; var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders(), ctx.Request.User); ctx.Send(responseWriter); }
protected static string GetWorkspaceID(ICommunicationContext ctx) => ctx.GetWorkspaceID();
// ReSharper disable InconsistentNaming protected static string GetWorkspaceID(ICommunicationContext ctx) { return(ctx.GetWorkspaceID()); }