public UrlRewritingService(ICatalogUrlResolvingService catalogUrlResolvingService, ICMSApplication cmsApplication, IPaymentProviderService paymentProviderService, IHttpContextWrapper httpContextWrapper, IUwebshopConfiguration configuration, IStoreFromUrlDeterminationService storeFromUrlDeterminationService, IStoreService storeService, IApplicationCacheService applicationCacheService) { _catalogUrlResolvingService = catalogUrlResolvingService; _cmsApplication = cmsApplication; _paymentProviderService = paymentProviderService; _httpContextWrapper = httpContextWrapper; _configuration = configuration; _storeFromUrlDeterminationService = storeFromUrlDeterminationService; _storeService = storeService; _applicationCacheService = applicationCacheService; }
public ISimpleBooleanConfiguration GetXDownloadOptionsWithOverride(IHttpContextWrapper context) { return(context.GetNWebsecOverrideContext().XDownloadOptions); }
internal void SetXContentTypeOptionsOverride(IHttpContextWrapper context, ISimpleBooleanConfiguration xContentTypeOptionsConfig) { context.GetNWebsecOverrideContext().XContentTypeOptions = xContentTypeOptionsConfig; }
internal void SetXFrameoptionsOverride(IHttpContextWrapper context, IXFrameOptionsConfiguration xFrameOptionsConfig) { context.GetNWebsecOverrideContext().XFrameOptions = xFrameOptionsConfig; }
internal void SetNoCacheHeadersOverride(IHttpContextWrapper context, ISimpleBooleanConfiguration setNoCacheHeadersConfig) { context.GetNWebsecOverrideContext().NoCacheHeaders = setNoCacheHeadersConfig; }
internal void SetXRobotsTagHeaderOverride(IHttpContextWrapper context, IXRobotsTagConfiguration setXRobotsTagHeaderConfig) { _xRobotsValidator.Validate(setXRobotsTagHeaderConfig); context.GetNWebsecOverrideContext().XRobotsTag = setXRobotsTagHeaderConfig; }
internal void SetCspReportUriOverride(IHttpContextWrapper context, ICspReportUriDirectiveConfiguration reportUriConfig, bool reportOnly) { var overrides = _contextConfigurationHelper.GetCspConfigurationOverride(context, reportOnly, false); overrides.ReportUriDirective = reportUriConfig; }
/// <summary> /// Handle process result /// </summary> /// <typeparam name="TProcess"></typeparam> /// <param name="process"></param> /// <param name="type"></param> /// <param name="response"></param> /// <param name="context"></param> /// <returns></returns> public MiddlewareResult HandleAfterExecution <TProcess>(TProcess process, Type type, VoidResult response, IHttpContextWrapper context) where TProcess : IBaseProcess <VoidResult> { if (response.IsFaulted && response.ErrorMessages.OfType <AuthenticationErrorInfo>().Any()) { context.PutResponse(new HttpResponseMessage(System.Net.HttpStatusCode.Unauthorized) { Content = type.ToHttpContent(response) }); return(MiddlewareResult.StopExecutionAndStopMiddlewarePipe); } return(MiddlewareResult.DoNothing); }
public SessionPropertyValueProviderTests() { _httpContextWrapper = new MockHttpContextWrapper(); _valueProvider = new SessionPropertyValueProvider(_httpContextWrapper); }
public ContextService(IHttpContextWrapper httpContextWrapper, IAccountRepository accountRepository) { _httpContextWrapper = httpContextWrapper; _accountRepository = accountRepository; }
public SynchrologLoggerProvider(ISynchrologClient synchrologClient, LogLevel logLevel, IHttpContextWrapper httpContextWrapper) { _synchrologClient = synchrologClient; _logLevel = logLevel; _httpContextWrapper = httpContextWrapper; }
public SessionPropertyValueProvider(IHttpContextWrapper httpContextWrapper) { _httpContextWrapper = httpContextWrapper; }
public SessionBasedMessageManagerTests() { _httpContextWrapper = new MockHttpContextWrapper(); _sessionBasedMessageManager = new SessionBasedMessageManager(_httpContextWrapper); }
/// <summary> /// Handle the request /// </summary> /// <param name="context">For testing</param> /// <returns></returns> public MiddlewareResult Dispatch(IHttpContextWrapper context = null) { var httpContext = context ?? SystemBootstrapper.GetInstance <IHttpContextWrapper>(); // execute custom url handlers foreach (var handler in CustomUrlHandlers) { var result = handler.RenderContent(httpContext); // check if url maches if (result != MiddlewareResult.DoNothing) { return(result); } } // get valid process type var validType = ProcessRepository.All(type => Filters.All(filter => filter.IsCorrectProcessType(type, httpContext))).FirstOrDefault(); if (validType.IsNull()) { return(MiddlewareResult.StopExecutionAndInvokeNextMiddleware); } // create instance var process = ProcessFactory.Create <VoidResult>(validType); if (process.IsNull()) { return(MiddlewareResult.StopExecutionAndInvokeNextMiddleware); } // execute factory filters foreach (var createEvent in FactoryFilters) { var result = createEvent.IsValidInstance(process, validType, httpContext); if (result != MiddlewareResult.DoNothing) { return(result); } } var method = EnumExtensions.FromString <SignalsApiMethod>(httpContext.HttpMethod?.ToUpper()); // determine the parameter binding method var parameterBindingAttribute = validType? .GetCustomAttributes(typeof(SignalsParameterBindingAttribute), false) .Cast <SignalsParameterBindingAttribute>() .FirstOrDefault(); // resolve default if not provided if (parameterBindingAttribute.IsNull()) { DefaultModelBinders.TryGetValue(method, out var modelBinder); parameterBindingAttribute = new SignalsParameterBindingAttribute(modelBinder); } var requestInput = parameterBindingAttribute.Binder.Bind(httpContext); // execute process var response = new VoidResult(); // decide if we need to execute switch (method) { case SignalsApiMethod.OPTIONS: case SignalsApiMethod.HEAD: break; default: response = ProcessExecutor.Execute(process, requestInput); break; } // post execution events foreach (var executeEvent in ResultHandlers) { var result = executeEvent.HandleAfterExecution(process, validType, response, httpContext); if (result != MiddlewareResult.DoNothing) { // flag to stop pipe execution return(result); } } // flag to stop pipe execution return(MiddlewareResult.StopExecutionAndStopMiddlewarePipe); }
//TODO simplify code public IXRobotsTagConfiguration GetXRobotsTagConfiguration(IHttpContextWrapper context) { return(context.GetNWebsecOwinContext()?.XRobotsTag ?? context.GetNWebsecContext().XRobotsTag); }
public SessionBasedMessageManager(IHttpContextWrapper httpContextWrapper) { _httpContextWrapper = httpContextWrapper; }
public IXFrameOptionsConfiguration GetXFrameOptionsConfiguration(IHttpContextWrapper context) { return(context.GetNWebsecOwinContext()?.XFrameOptions ?? context.GetNWebsecContext().XFrameOptions); }
public void Setup() { HttpContext.Current = HttpContextHelper.GetHttpContext(); _httpContextWrapper = new HttpContextWrapper(); _sessionBasedMessageManager = new SessionBasedMessageManager(_httpContextWrapper); }
public ISimpleBooleanConfiguration GetXDownloadOptionsConfiguration(IHttpContextWrapper context) { return(context.GetNWebsecOwinContext()?.XDownloadOptions ?? context.GetNWebsecContext().XDownloadOptions); }
public RouteDataPropertyValueProvider(IHttpContextWrapper httpContextWrapper) { _httpContextWrapper = httpContextWrapper; }
public IXXssProtectionConfiguration GetXXssProtectionConfiguration(IHttpContextWrapper context) { return(context.GetNWebsecOwinContext()?.XXssProtection ?? context.GetNWebsecContext().XXssProtection); }
public IXRobotsTagConfiguration GetXRobotsTagWithOverride(IHttpContextWrapper context) { return(context.GetNWebsecOverrideContext().XRobotsTag); }
public IReferrerPolicyConfiguration GetReferrerPolicyConfiguration(IHttpContextWrapper context) { return(context.GetNWebsecOwinContext()?.ReferrerPolicy ?? context.GetNWebsecContext().ReferrerPolicy); }
public ISimpleBooleanConfiguration GetNoCacheHeadersWithOverride(IHttpContextWrapper context) { return(context.GetNWebsecOverrideContext().NoCacheHeaders); }
private ICspConfiguration GetCspReportonlyConfiguration(IHttpContextWrapper context) { return(context.GetNWebsecOwinContext()?.CspReportOnly ?? context.GetNWebsecContext().CspReportOnly); }
public IXFrameOptionsConfiguration GetXFrameoptionsWithOverride(IHttpContextWrapper context) { return(context.GetNWebsecOverrideContext().XFrameOptions); }
public CookiePropertyValueProvider(IHttpContextWrapper httpContextWrapper) { _httpContextWrapper = httpContextWrapper; }
internal void SetXDownloadOptionsOverride(IHttpContextWrapper context, ISimpleBooleanConfiguration xDownloadOptionsConfig) { context.GetNWebsecOverrideContext().XDownloadOptions = xDownloadOptionsConfig; }
public void Setup() { HttpContext.Current = HttpContextHelper.GetHttpContext(); _httpContextWrapper = new HttpContextWrapper(); _valueProvider = new QueryStringPropertyValueProvider(_httpContextWrapper); }
internal void SetXXssProtectionOverride(IHttpContextWrapper context, IXXssProtectionConfiguration xXssProtectionConfig) { context.GetNWebsecOverrideContext().XXssProtection = xXssProtectionConfig; }
public EFWebAppUserManager(IHttpContextWrapper httpContextWrapper, ISystemTime systemTime) { _httpContextWrapper = httpContextWrapper; _systemTime = systemTime; }
public UmbracoApplication(IHttpContextWrapper httpContextWrapper) { _httpContextWrapper = httpContextWrapper; }
public HttpRuntimeCacheWrapper(IHttpContextWrapper httpContextWrapper, IHttpRuntimeWrapper httpRuntimeWrapper) { _httpContextWrapper = httpContextWrapper; _httpRuntimeWrapper = httpRuntimeWrapper; }