public ActionAlternatesFactory(IHttpContextAccessor httpContextAccessor)
		{
			_httpContextAccessor = httpContextAccessor;

			_actionAlternates = new Lazy<List<string>>(() =>
			{
				var httpContext = _httpContextAccessor.Current();

				if (httpContext == null)
				{
					return null;
				}

				var request = _httpContextAccessor.Current().Request;

				var actionSegments = new[] 
				{
					request.RequestContext.RouteData.GetRequiredString("area").Replace("-", "__").Replace(".", "_"), 
					request.RequestContext.RouteData.GetRequiredString("controller").Replace("-", "__").Replace(".", "_"), 
					request.RequestContext.RouteData.GetRequiredString("action").Replace("-", "__").Replace(".", "_")
				};

				return Enumerable.Range(1, actionSegments.Count()).Select(range => String.Join("__", actionSegments.Take(range))).ToList();
			});
		}
 public DefaultAccessTokenProvider(IHttpContextAccessor contextAccessor,
     IOptions<DefaultImplsOptions> options,
     ILogger<DefaultAccessTokenProvider> logger) {
     _httpContext = contextAccessor.HttpContext;
     _logger = logger;
     _options = options.Value;
 }
 public FacebookSuiteService(
     IHttpContextAccessor httpContextAccessor,
     ISiteService siteService)
 {
     _httpContextAccessor = httpContextAccessor;
     _siteService = siteService;
 }
Example #4
0
 public HtmlEngineFactory(IHttpContextAccessor httpContextAccessor, ICompositeViewEngine viewEngine, ITempDataProvider tempDataProvider, IApplicationEnvironment hostingEnvironment)
 {
     _httpContextAccessor = httpContextAccessor;
     _viewEngine = viewEngine;
     _tempDataProvider = tempDataProvider;
     _hostingEnvironment = hostingEnvironment;
 }
 public QuestionService(HttpClientService factory, IHttpContextAccessor httpContextAccessor, ISurveysTokenService surveysTokenService)
 {
     _httpContextAccessor = httpContextAccessor;
     _httpClient = factory.GetHttpClient();
     _surveysTokenService = surveysTokenService;
     _cancellationToken = httpContextAccessor?.HttpContext?.RequestAborted ?? CancellationToken.None;
 }
Example #6
0
 public SiteThemeSelector(
     ISiteThemeService siteThemeService, 
     IHttpContextAccessor httpContextAccessor)
 {
     _siteThemeService = siteThemeService;
     _httpContextAccessor = httpContextAccessor;
 }
Example #7
0
 // This service can only be instantiated by a request-scoped container
 public RequestIdService(IServiceProvider services, IHttpContextAccessor contextAccessor)
 {
     if (contextAccessor.HttpContext.RequestServices != services)
     {
         throw new InvalidOperationException();
     }
 }
Example #8
0
 public AccountService(IMapper mapper, IEmailSender messageService, IHttpContextAccessor accessor, IUserRepository userRepository)
 {
     _mapper = mapper;
     _messageService = messageService;
     _accessor = accessor;
     _userRepository = userRepository;
 }
        /// <summary>
        /// Creates a new <see cref="HttpContextClientInfoProvider"/>.
        /// </summary>
        public HttpContextClientInfoProvider(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
            _httpContext = httpContextAccessor.HttpContext;

            Logger = NullLogger.Instance;
        }
 public ComponentTagHelper(IHttpContextAccessor contextAccessor, IBricsContextAccessor bricsContext)
 {
     _contextAccessor = contextAccessor;
     _bricsContext = bricsContext;
     _urlHelper = contextAccessor.HttpContext.RequestServices.GetService<IUrlHelper>();
     _htmlHelper = contextAccessor.HttpContext.RequestServices.GetService<IHtmlHelper>();
 }
Example #11
0
 public GeoDataManager(
     IGeoRepository geoRepository,
     IHttpContextAccessor contextAccessor)
 {
     repo = geoRepository;
     _context = contextAccessor?.HttpContext;
 }
 public DirectoryController(ClientDirectoryContext context, ILoginHelper loginHelper,
     IHttpContextAccessor contextAccessor)
 {
     _context = context;
     _contextAccessor = contextAccessor;
     _loginHelper = loginHelper;
 }
        public AccountModule(IAccountService accountService, IHttpContextAccessor httpContextAccessor)
        {
            this.context = httpContextAccessor.Current;

            Post["/Account/Create"] = x =>
                                          {
                                              var command = new AddUserAccountCommand(Request.Form.EmailAddress,
                                                                                  Request.Form.Password,
                                                                                  uint.Parse(Request.Form.RateOutOf));
                                              var account = accountService.CreateAccount(command);

                                              var accountValidationUrl = context.Request.BaseUrl() + "/Account/Validate/" + account.Key;

                                              return Response.AsJson(new
                                                                         {
                                                                             AccountKey = account.Key,
                                                                             AccountValidationUrl = accountValidationUrl
                                                                         });
                                          };

            Post["/Account/Validate"] = x =>
                                                           {
                                                               var command = new ValidateAccountCommand(Request.Form.ValidationKey);
                                                               return Response.AsJson((int)accountService.ValidateAccount(command));
                                                           };
        }
Example #14
0
        public SiteManager(
            SiteContext currentSite,
            ISiteCommands siteCommands,
            ISiteQueries siteQueries,
            IUserCommands userCommands,
            IUserQueries userQueries,
            SiteDataProtector dataProtector,
            IHttpContextAccessor contextAccessor,
            ILogger<SiteManager> logger,
            IOptions<MultiTenantOptions> multiTenantOptionsAccessor,
            IOptions<SiteConfigOptions> setupOptionsAccessor,
            CacheHelper cacheHelper
            )
        {

            commands = siteCommands;
            queries = siteQueries;
            this.userCommands = userCommands;
            this.userQueries = userQueries;
            multiTenantOptions = multiTenantOptionsAccessor.Value;
            setupOptions = setupOptionsAccessor.Value;
            _context = contextAccessor?.HttpContext;
            this.dataProtector = dataProtector;
            log = logger;

            //resolver = siteResolver;
            siteSettings = currentSite;
            this.cacheHelper = cacheHelper;
        }
        public UserManager(ApplicationDbContext dbContext, IHttpContextAccessor contextAccessor)
        {
            Guard.ArgumentNotNull(dbContext, nameof(dbContext));

            _dbContext = dbContext;
            _cancellationToken = contextAccessor?.HttpContext?.RequestAborted ?? CancellationToken.None;
        }
 public CurrentContentIdAccessor(
     IHttpContextAccessor hca,
     IAliasService aliasService)
 {
     _hca = hca;
     _aliasService = aliasService;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public CSClassroomTelemetryInitializer(
     IHttpContextAccessor httpContextAccessor,
     IActionContextAccessor actionContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
     _actionContextAccessor = actionContextAccessor;
 }
 public DefaultHostEnvironment(IClock clock, IHttpContextAccessor httpContextAccessor)
 {
     _clock = clock;
     _httpContextAccessor = httpContextAccessor;
     T = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
 }
 public SingleFileLocationService(ILocalizationConfiguration configuration, IHttpContextAccessor httpContext)
 {
     LocalizationInstanceContainer.Instance = this;
     this.configuration = configuration;
     this.httpContext = httpContext;
     LoadResources(configuration.GetLocalizationFolderPath());
 }
 /// <summary>
 /// Configures the <see cref="Context"/>.
 /// </summary>
 /// <param name="environment">The environment the application is running under. This can be Development, 
 /// Staging or Production by default.</param>
 /// <param name="httpContextAccessor">The HTTP context accessor.</param>
 public static void Configure(
     IHostingEnvironment environment,
     IHttpContextAccessor httpContextAccessor)
 {
     Environment = environment;
     HttpContextAccessor = httpContextAccessor;
 }
 public AppController(IHttpContextAccessor httpContextAccessor,
         UserManager<MyUser> userManager,
         IOptions<IdentityOptions> optionsAccessor)
 {
     SignInManager = new MySignInManager(userManager as MyUserManager, httpContextAccessor, new MyClaimsPrincipleFactory());
     UserManager = userManager;
 }
Example #22
0
 public CookieCultureSelector(IHttpContextAccessor httpContextAccessor,
     IClock clock,
     ShellSettings shellSettings) {
     _httpContextAccessor = httpContextAccessor;
     _clock = clock;
     _shellSettings = shellSettings;
 }
 public CombinatorResourceManager(
     IHttpContextAccessor httpContextAccessor,
     ISimpleSerializer serializer)
 {
     _httpContextAccessor = httpContextAccessor;
     _serializer = serializer;
 }
 public IdentityResolver(
     IHttpContextAccessor contextAccessor,
     UserManager<ApplicationUser> userManager)
 {
     _contextAccessor = contextAccessor;
     _userManger = userManager;
 }
        public UrlAlternatesFactory(IHttpContextAccessor httpContextAccessor) {
            _httpContextAccessor = httpContextAccessor;

            _urlAlternates = new Lazy<List<string>>(() => {
                var httpContext = _httpContextAccessor.Current();

                if (httpContext == null) {
                    return null;
                }

                var request = httpContext.Request;

                if (request == null) {
                    return null;
                }

                // extract each segment of the url
                var urlSegments = VirtualPathUtility.ToAppRelative(request.Path.ToLower())
                    .Split('/')
                    .Skip(1) // ignore the heading ~ segment 
                    .Select(url => url.Replace("-", "__").Replace(".", "_")) // format the alternate
                    .ToArray();

                if (String.IsNullOrWhiteSpace(urlSegments[0])) {
                    urlSegments[0] = "homepage";
                }

                return Enumerable.Range(1, urlSegments.Count()).Select(range => String.Join("__", urlSegments.Take(range))).ToList();
            });
        }
Example #26
0
 public ShapeDisplay(
     IDisplayHelperFactory displayHelperFactory,
     IHttpContextAccessor httpContextAccessor)
 {
     _displayHelperFactory = displayHelperFactory;
     _httpContextAccessor = httpContextAccessor;
 }
 public FeaturesCacheContextProvider(
     IHttpContextAccessor httpContextAccessor,
     IFeatureHash featureHash
     )
 {
     _httpContextAccessor = httpContextAccessor;
     _featureHash = featureHash;
 }
 public ViewComponentTagHelperDescriptorResolver(
     TagHelperTypeResolver typeResolver,
     IHttpContextAccessor httpContextAccessor
     )
     : base(typeResolver, designTime: false)
 {
     _httpContextAccessor = httpContextAccessor;
 }
Example #29
0
        public PagerShapes(
            IHttpContextAccessor httpContextAccessor,
            IStringLocalizer<PagerShapes> localizer)
        {
            _httpContextAccessor = httpContextAccessor;

            T = localizer;
        }
Example #30
0
        public CombinatorResource(ResourceType type, IHttpContextAccessor httpContextAccessor)
        {
            _type = type;
            _httpContext = httpContextAccessor.Current();

            RequiredContext = new ResourceRequiredContext();
            IsOriginal = false;
        }