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; }
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 CurrentContentIdAccessor( IHttpContextAccessor hca, IAliasService aliasService) { _hca = hca; _aliasService = aliasService; }
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; }
// 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(); } }
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 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; }
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(); }); }
public ShapeDisplay( IDisplayHelperFactory displayHelperFactory, IHttpContextAccessor httpContextAccessor) { _displayHelperFactory = displayHelperFactory; _httpContextAccessor = httpContextAccessor; }
/// <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; }
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; }
public AccountService(IMapper mapper, IEmailSender messageService, IHttpContextAccessor accessor, IUserRepository userRepository) { _mapper = mapper; _messageService = messageService; _accessor = accessor; _userRepository = userRepository; }
public UserManager(ApplicationDbContext dbContext, IHttpContextAccessor contextAccessor) { Guard.ArgumentNotNull(dbContext, nameof(dbContext)); _dbContext = dbContext; _cancellationToken = contextAccessor?.HttpContext?.RequestAborted ?? CancellationToken.None; }
public ComponentTagHelper(IHttpContextAccessor contextAccessor, IBricsContextAccessor bricsContext) { _contextAccessor = contextAccessor; _bricsContext = bricsContext; _urlHelper = contextAccessor.HttpContext.RequestServices.GetService<IUrlHelper>(); _htmlHelper = contextAccessor.HttpContext.RequestServices.GetService<IHtmlHelper>(); }
public CookieCultureSelector(IHttpContextAccessor httpContextAccessor, IClock clock, ShellSettings shellSettings) { _httpContextAccessor = httpContextAccessor; _clock = clock; _shellSettings = shellSettings; }
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; }
public PagerShapes( IHttpContextAccessor httpContextAccessor, IStringLocalizer<PagerShapes> localizer) { _httpContextAccessor = httpContextAccessor; T = localizer; }
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; }
public SecuredOperation(string roles) { _roles = roles.Split(','); _httpContextAccessor = ServiceTool.ServiceProvider.GetService <IHttpContextAccessor>(); }
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 ); }
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; }
public IdentityService(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; }
// 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()); }
public AdminTabsExample(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; }
public EventController(IEventService eventService, ILogger <EventController> logger, IHttpContextAccessor httpContextAccessor, IUserService userService) : base(logger, httpContextAccessor, userService) { this.eventService = eventService; this.httpContextAccessor = httpContextAccessor; }
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; }
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()); }
public FileLoggerProvider(IWebHostEnvironment environment, IHttpContextAccessor httpContextAccessor) { _environment = environment; _httpContextAccessor = httpContextAccessor; }
/// <summary> /// Default constructor. /// </summary> public ProjectV5TBCController(IHttpContextAccessor httpContextAccessor) { this.httpContextAccessor = httpContextAccessor; }
public CurrentCorrelationId(IHttpContextAccessor httpContextAccessor) => _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
public RoleApiClient(IHttpClientFactory httpClientFactory, IConfiguration configuration, IHttpContextAccessor httpContextAccessor) { _httpClientFactory = httpClientFactory; _configuration = configuration; _httpContextAccessor = httpContextAccessor; }
public UserResolverService(IHttpContextAccessor context, UserManager <User> userManager) { _context = context; _userManager = userManager; }
public GitApiController(ISignInService signInService, IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor) { SignInService = signInService; }
public TestAuditableContext(DbContextOptions options, IHttpContextAccessor httpContextAccessor) : base(options, httpContextAccessor) { }
// private readonly IContentDefinitionManager _contentDefinitionManager; public WizardStepPartDisplayDriver(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; // _contentDefinitionManager = contentDefinitionManager; }
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(); }
public DataContext(DbContextOptions <DataContext> options, IHttpContextAccessor httpContextAccessor) : base(options) { this.httpContextAcessor = httpContextAccessor; }
public HotelAccessHandler(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; }
public SpeakerUrlResolver(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; }
public PlanificatorSaliContext(DbContextOptions <PlanificatorSaliContext> options, IHttpContextAccessor httpContextAccessor) : base(options) { _httpContextAccessor = httpContextAccessor; }
public AspNetUser(IHttpContextAccessor accessor) { _accessor = accessor; }
/// <summary> /// ctor /// </summary> /// <param name="httpContextAccessor"></param> public ClientAccessTokenHandler(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; }
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; } } } }