public QuestionService(HttpClientService factory, IHttpContextAccessor httpContextAccessor, ISurveysTokenService surveysTokenService)
 {
     _httpContextAccessor = httpContextAccessor;
     _httpClient = factory.GetHttpClient();
     _surveysTokenService = surveysTokenService;
     _cancellationToken = httpContextAccessor?.HttpContext?.RequestAborted ?? CancellationToken.None;
 }
 public FacebookSuiteService(
     IHttpContextAccessor httpContextAccessor,
     ISiteService siteService)
 {
     _httpContextAccessor = httpContextAccessor;
     _siteService = siteService;
 }
 public DefaultAccessTokenProvider(IHttpContextAccessor contextAccessor,
     IOptions<DefaultImplsOptions> options,
     ILogger<DefaultAccessTokenProvider> logger) {
     _httpContext = contextAccessor.HttpContext;
     _logger = logger;
     _options = options.Value;
 }
예제 #4
0
 public GeoDataManager(
     IGeoRepository geoRepository,
     IHttpContextAccessor contextAccessor)
 {
     repo = geoRepository;
     _context = contextAccessor?.HttpContext;
 }
예제 #5
0
 public DirectoryController(ClientDirectoryContext context, ILoginHelper loginHelper,
     IHttpContextAccessor contextAccessor)
 {
     _context = context;
     _contextAccessor = contextAccessor;
     _loginHelper = loginHelper;
 }
 public CurrentContentIdAccessor(
     IHttpContextAccessor hca,
     IAliasService aliasService)
 {
     _hca = hca;
     _aliasService = aliasService;
 }
예제 #7
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 AppController(IHttpContextAccessor httpContextAccessor,
         UserManager<MyUser> userManager,
         IOptions<IdentityOptions> optionsAccessor)
 {
     SignInManager = new MySignInManager(userManager as MyUserManager, httpContextAccessor, new MyClaimsPrincipleFactory());
     UserManager = userManager;
 }
예제 #9
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();
     }
 }
예제 #10
0
		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();
			});
		}
예제 #11
0
 public HtmlEngineFactory(IHttpContextAccessor httpContextAccessor, ICompositeViewEngine viewEngine, ITempDataProvider tempDataProvider, IApplicationEnvironment hostingEnvironment)
 {
     _httpContextAccessor = httpContextAccessor;
     _viewEngine = viewEngine;
     _tempDataProvider = tempDataProvider;
     _hostingEnvironment = hostingEnvironment;
 }
 public IdentityResolver(
     IHttpContextAccessor contextAccessor,
     UserManager<ApplicationUser> userManager)
 {
     _contextAccessor = contextAccessor;
     _userManger = userManager;
 }
예제 #13
0
        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();
            });
        }
예제 #14
0
 public ShapeDisplay(
     IDisplayHelperFactory displayHelperFactory,
     IHttpContextAccessor httpContextAccessor)
 {
     _displayHelperFactory = displayHelperFactory;
     _httpContextAccessor = httpContextAccessor;
 }
예제 #15
0
 /// <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 SingleFileLocationService(ILocalizationConfiguration configuration, IHttpContextAccessor httpContext)
 {
     LocalizationInstanceContainer.Instance = this;
     this.configuration = configuration;
     this.httpContext = httpContext;
     LoadResources(configuration.GetLocalizationFolderPath());
 }
 public DefaultHostEnvironment(IClock clock, IHttpContextAccessor httpContextAccessor)
 {
     _clock = clock;
     _httpContextAccessor = httpContextAccessor;
     T = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
 }
예제 #18
0
 public SiteThemeSelector(
     ISiteThemeService siteThemeService, 
     IHttpContextAccessor httpContextAccessor)
 {
     _siteThemeService = siteThemeService;
     _httpContextAccessor = httpContextAccessor;
 }
        /// <summary>
        /// Creates a new <see cref="HttpContextClientInfoProvider"/>.
        /// </summary>
        public HttpContextClientInfoProvider(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
            _httpContext = httpContextAccessor.HttpContext;

            Logger = NullLogger.Instance;
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 public CSClassroomTelemetryInitializer(
     IHttpContextAccessor httpContextAccessor,
     IActionContextAccessor actionContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
     _actionContextAccessor = actionContextAccessor;
 }
예제 #21
0
 public AccountService(IMapper mapper, IEmailSender messageService, IHttpContextAccessor accessor, IUserRepository userRepository)
 {
     _mapper = mapper;
     _messageService = messageService;
     _accessor = accessor;
     _userRepository = userRepository;
 }
예제 #22
0
        public UserManager(ApplicationDbContext dbContext, IHttpContextAccessor contextAccessor)
        {
            Guard.ArgumentNotNull(dbContext, nameof(dbContext));

            _dbContext = dbContext;
            _cancellationToken = contextAccessor?.HttpContext?.RequestAborted ?? CancellationToken.None;
        }
예제 #23
0
 public ComponentTagHelper(IHttpContextAccessor contextAccessor, IBricsContextAccessor bricsContext)
 {
     _contextAccessor = contextAccessor;
     _bricsContext = bricsContext;
     _urlHelper = contextAccessor.HttpContext.RequestServices.GetService<IUrlHelper>();
     _htmlHelper = contextAccessor.HttpContext.RequestServices.GetService<IHtmlHelper>();
 }
예제 #24
0
 public CookieCultureSelector(IHttpContextAccessor httpContextAccessor,
     IClock clock,
     ShellSettings shellSettings) {
     _httpContextAccessor = httpContextAccessor;
     _clock = clock;
     _shellSettings = shellSettings;
 }
예제 #25
0
        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));
                                                           };
        }
 public CombinatorResourceManager(
     IHttpContextAccessor httpContextAccessor,
     ISimpleSerializer serializer)
 {
     _httpContextAccessor = httpContextAccessor;
     _serializer = serializer;
 }
예제 #27
0
        public PagerShapes(
            IHttpContextAccessor httpContextAccessor,
            IStringLocalizer<PagerShapes> localizer)
        {
            _httpContextAccessor = httpContextAccessor;

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

            RequiredContext = new ResourceRequiredContext();
            IsOriginal = false;
        }
 public ViewComponentTagHelperDescriptorResolver(
     TagHelperTypeResolver typeResolver,
     IHttpContextAccessor httpContextAccessor
     )
     : base(typeResolver, designTime: false)
 {
     _httpContextAccessor = httpContextAccessor;
 }
 public FeaturesCacheContextProvider(
     IHttpContextAccessor httpContextAccessor,
     IFeatureHash featureHash
     )
 {
     _httpContextAccessor = httpContextAccessor;
     _featureHash = featureHash;
 }
예제 #31
0
 public SecuredOperation(string roles)
 {
     _roles = roles.Split(',');
     _httpContextAccessor = ServiceTool.ServiceProvider.GetService <IHttpContextAccessor>();
 }
예제 #32
0
        internal FakeIdentityContextFactory(string databaseName)
        {
            if (string.IsNullOrEmpty(databaseName))
            {
                throw new ArgumentException($"{nameof(databaseName)} is Null or Empty.", nameof(databaseName));
            }

            IServiceCollection services = new ServiceCollection();

            services.AddTransient <IConfiguration>((sp) => new ConfigurationBuilder()
                                                   .AddInMemoryCollection(new Dictionary <string, string>
            {
                { "databaseName", databaseName }
            }).Build());
            services.AddDbContext <FakeIdentityContext>();
            services.AddIdentity <ApplicationUser, ApplicationRole>(options =>
            {
                options.Password.RequireDigit           = false;
                options.Password.RequiredLength         = 3;
                options.Password.RequireLowercase       = false;
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequireUppercase       = false;
            })
            .AddEntityFrameworkStores <FakeIdentityContext>()
            .AddDefaultTokenProviders();

            HttpRequest         request         = new DefaultHttpContext().Request;
            HttpContextAccessor contextAccessor = new HttpContextAccessor {
                HttpContext = request.HttpContext
            };

            services.AddSingleton <IHttpContextAccessor>(contextAccessor);

            IServiceProvider serviceProvider = services.BuildServiceProvider();

            contextAccessor.HttpContext.RequestServices = serviceProvider;
            ParkingDBContext context = serviceProvider.GetRequiredService <FakeIdentityContext>();

            UserStore <ApplicationUser, ApplicationRole, ParkingDBContext, string> userStore = new UserStore <ApplicationUser, ApplicationRole, ParkingDBContext, string>(context);
            IOptions <IdentityOptions>               serviceIOptions           = serviceProvider.GetRequiredService <IOptions <IdentityOptions> >();
            UserManager <ApplicationUser>            serviceUserManager        = serviceProvider.GetRequiredService <UserManager <ApplicationUser> >();
            ILogger <UserManager <ApplicationUser> > serviceILoggerUserManager = serviceProvider.GetRequiredService <ILogger <UserManager <ApplicationUser> > >();

            RoleStore <ApplicationRole, ParkingDBContext, string> roleStore    = new RoleStore <ApplicationRole, ParkingDBContext, string>(context);
            RoleManager <ApplicationRole>            serviceRoleManager        = serviceProvider.GetRequiredService <RoleManager <ApplicationRole> >();
            ILogger <RoleManager <ApplicationRole> > serviceILoggerRoleManager = serviceProvider.GetRequiredService <ILogger <RoleManager <ApplicationRole> > >();

            IHttpContextAccessor                       serviceIHttpContextAccessor          = serviceProvider.GetRequiredService <IHttpContextAccessor>();
            SignInManager <ApplicationUser>            serviceSignInManager                 = serviceProvider.GetRequiredService <SignInManager <ApplicationUser> >();
            ILogger <SignInManager <ApplicationUser> > serviceILoggerSignInManager          = serviceProvider.GetRequiredService <ILogger <SignInManager <ApplicationUser> > >();
            IAuthenticationSchemeProvider              serviceIAuthenticationSchemeProvider = serviceProvider.GetRequiredService <IAuthenticationSchemeProvider>();

            UserManager = new UserManager <ApplicationUser>(
                userStore,
                serviceIOptions,
                serviceUserManager.PasswordHasher,
                serviceUserManager.UserValidators,
                serviceUserManager.PasswordValidators,
                serviceUserManager.KeyNormalizer,
                serviceUserManager.ErrorDescriber,
                serviceProvider,
                serviceILoggerUserManager
                );

            RoleManager = new RoleManager <ApplicationRole>(
                roleStore,
                serviceRoleManager.RoleValidators,
                serviceRoleManager.KeyNormalizer,
                serviceRoleManager.ErrorDescriber,
                serviceILoggerRoleManager
                );

            SignInManager = new SignInManager <ApplicationUser>(
                UserManager,
                serviceIHttpContextAccessor,
                serviceSignInManager.ClaimsFactory,
                serviceIOptions,
                serviceILoggerSignInManager,
                serviceIAuthenticationSchemeProvider
                );
        }
예제 #33
0
 public LinnworksAuthController(ILinnworksAuthService linnworksAuthService, IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor)
 {
     _linnworksAuthService = linnworksAuthService;
 }
 public HttpClientAuthorizationDelegatingHandler(IHttpContextAccessor httpContextAccesor)
 {
     _httpContextAccesor = httpContextAccesor;
 }
 public ApplicationDbContext(DbContextOptions <ApplicationDbContext> options, IHttpContextAccessor httpContextAccessor)
     : base(options)
 {
     _httpContextAccessor = httpContextAccessor;
 }
예제 #36
0
 public IdentityService(IHttpContextAccessor httpContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
 }
예제 #37
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime, IHttpContextAccessor httpContextAccessor)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            ISouling.Component.Web.HttpContext.Configure(httpContextAccessor);

            var supportedCultures = new[]
            {
                new CultureInfo("zh-CN"),
                new CultureInfo("en-US")
            };

            app.UseRequestLocalization(new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture(supportedCultures[0]),
                // Formatting numbers, dates, etc.
                SupportedCultures = supportedCultures,
                // UI strings that we have localized.
                SupportedUICultures = supportedCultures
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseIdentity();

            app.UseSession();

            // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                foreach (var area in new[] { "User" })
                {
                    MapAreaRoute(routes, area);
                }

                routes.MapRoute(
                    name: "Enneagram",
                    template: "Enneagram/{id:range(1,9)}",
                    defaults: new { controller = "Enneagram", action = "Index" });

                routes.MapRoute(
                    name: "controller",
                    template: "{controller=Home}",
                    defaults: new { action = "Index" });

                routes.MapRoute(
                    name: "action",
                    template: "{action=Index}/{id?}",
                    defaults: new { controller = "Home" });

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            //DbInitializer.Initialize(context);

            // If you want to dispose of resources that have been resolved in the
            // application container, register for the "ApplicationStopped" event.
            appLifetime.ApplicationStopped.Register(() => ApplicationContainer.Dispose());
        }
예제 #38
0
 public AdminTabsExample(IHttpContextAccessor httpContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
 }
예제 #39
0
 public EventController(IEventService eventService, ILogger <EventController> logger, IHttpContextAccessor httpContextAccessor, IUserService userService) : base(logger, httpContextAccessor, userService)
 {
     this.eventService        = eventService;
     this.httpContextAccessor = httpContextAccessor;
 }
예제 #40
0
 public UserProfileController(IUserProfileService userProfileService, ILogger <UserProfileController> logger, IHttpContextAccessor httpContextAccessor)
 {
     _logger              = logger;
     _userProfileService  = userProfileService;
     _httpContextAccessor = httpContextAccessor;
 }
 public ProjectEditPrivilegesTagHelper(IAuthorizationService authService, IHttpContextAccessor httpContextAccessor)
 {
     _authService = authService;
     _principal   = httpContextAccessor.HttpContext.User;
 }
예제 #42
0
 public AppCookiesAuthService(IHttpContextAccessor httpContextAccessor, IEncriptionService AppEncription)
 {
     _httpContextAccessor = httpContextAccessor;
     _AppEncription       = AppEncription;
 }
 public CalendarController(IHttpContextAccessor contextAccessor) : base(contextAccessor)
 {
 }
        public AuthenticationRequestHandlerWrapper(IAuthenticationRequestHandler inner, IHttpContextAccessor httpContextAccessor)
        {
            _inner   = inner;
            _context = httpContextAccessor.HttpContext;

            var factory = (ILoggerFactory)_context.RequestServices.GetService(typeof(ILoggerFactory));

            _logger = factory?.CreateLogger(GetType());
        }
예제 #45
0
 public FileLoggerProvider(IWebHostEnvironment environment, IHttpContextAccessor httpContextAccessor)
 {
     _environment         = environment;
     _httpContextAccessor = httpContextAccessor;
 }
예제 #46
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public ProjectV5TBCController(IHttpContextAccessor httpContextAccessor)
 {
     this.httpContextAccessor = httpContextAccessor;
 }
예제 #47
0
 public CurrentCorrelationId(IHttpContextAccessor httpContextAccessor) => _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
예제 #48
0
 public RoleApiClient(IHttpClientFactory httpClientFactory, IConfiguration configuration, IHttpContextAccessor httpContextAccessor)
 {
     _httpClientFactory   = httpClientFactory;
     _configuration       = configuration;
     _httpContextAccessor = httpContextAccessor;
 }
예제 #49
0
 public UserResolverService(IHttpContextAccessor context, UserManager <User> userManager)
 {
     _context     = context;
     _userManager = userManager;
 }
예제 #50
0
 public GitApiController(ISignInService signInService, IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor)
 {
     SignInService = signInService;
 }
예제 #51
0
 public TestAuditableContext(DbContextOptions options, IHttpContextAccessor httpContextAccessor) : base(options, httpContextAccessor)
 {
 }
        // private readonly IContentDefinitionManager _contentDefinitionManager;

        public WizardStepPartDisplayDriver(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
            // _contentDefinitionManager = contentDefinitionManager;
        }
예제 #53
0
 public ContactTypeController(IHttpContextAccessor accessor)
 {
     IpAdress     = !string.IsNullOrEmpty(accessor.HttpContext.Connection.RemoteIpAddress.ToString()) ? accessor.HttpContext.Connection.RemoteIpAddress.ToString() : "";
     AInformation = accessor.HttpContext.Request.Headers["User-Agent"].ToString();
 }
예제 #54
0
 public DataContext(DbContextOptions <DataContext> options, IHttpContextAccessor httpContextAccessor) : base(options)
 {
     this.httpContextAcessor = httpContextAccessor;
 }
 public HotelAccessHandler(IHttpContextAccessor httpContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
 }
 public SpeakerUrlResolver(IHttpContextAccessor httpContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
 }
예제 #57
0
 public PlanificatorSaliContext(DbContextOptions <PlanificatorSaliContext> options, IHttpContextAccessor httpContextAccessor)
     : base(options)
 {
     _httpContextAccessor = httpContextAccessor;
 }
예제 #58
0
 public AspNetUser(IHttpContextAccessor accessor)
 {
     _accessor = accessor;
 }
예제 #59
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="httpContextAccessor"></param>
 public ClientAccessTokenHandler(IHttpContextAccessor httpContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
 }
예제 #60
0
        protected internal UnitOfWork(TContext context, IServiceProvider serviceProvider, IHttpContextAccessor httpAccessor)
        {
            this.context         = context;
            this.serviceProvider = serviceProvider;

            if (httpAccessor.HttpContext != null)
            {
                string userId = httpAccessor.HttpContext?.User.FindFirst(ClaimTypes.NameIdentifier)?.Value?.Trim();
                if (!string.IsNullOrEmpty(userId))
                {
                    Guid parsedUserId;
                    if (Guid.TryParse(userId, out parsedUserId))
                    {
                        this.context.CurrentUserId = parsedUserId;
                    }
                }
            }
        }