public AdminModel(ICookieStorage cookieStorage, AdminSettings adminSettings, IUserService userService, IFileService fileService, IBoardService boardService) { this.cookieStorage = cookieStorage; this.adminSettings = adminSettings; this.userService = userService; this.fileService = fileService; this.boardService = boardService; }
public static async Task <string?> GetValueAsync(this ICookieStorage cookies, string name) { var d = await cookies.GetAsync(name); return(d?.Value); //return await cookies // .GetAsync(name) // .ThenDo(v => v?.Value); }
private static Guid GetThumbPrint(ICookieStorage cs, HttpRequest req, HttpResponse res) { var thumb = cs.ReadThumbPrint(req); return(thumb.Match(some => some, () => { var newThumb = Guid.NewGuid(); cs.SetThumbPrint(res, newThumb); return newThumb; })); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Cmis.PersistentStandardAuthenticationProvider"/> class. /// </summary> /// <param name="storage">Storage of saved cookies</param> /// <param name="url">corresponding URL of the cookies</param> public PersistentStandardAuthenticationProvider(ICookieStorage storage, Uri url) { if (storage == null) { throw new ArgumentNullException("storage"); } if (url == null) { throw new ArgumentNullException("url"); } this.storage = storage; this.url = url; if (storage.Cookies != null) { foreach (Cookie c in storage.Cookies) { this.Cookies.Add(c); } } }
public BoardModel( IpHasherFactory ipHasherFactory, TripCodeHasher tripCodeHasher, ICookieStorage cookieStorage, IGetIp getIp, IThreadService threadService, IPostService postService, IBannedImageLogger bannedImageLogger, IUploadMapper uploadMapper) { this.ipHasher = ipHasherFactory.GetHasher(); this.tripCodeHasher = tripCodeHasher; this.cookieStorage = cookieStorage; this.getIp = getIp; this.threadService = threadService; this.postService = postService; this.bannedImageLogger = bannedImageLogger; this.uploadMapper = uploadMapper; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Cmis.PersistentStandardAuthenticationProvider"/> class. /// </summary> /// <param name="storage">Storage of saved cookies</param> /// <param name="url">corresponding URL of the cookies</param> public PersistentStandardAuthenticationProvider(ICookieStorage storage, Uri url) { if (storage == null) { throw new ArgumentNullException("Given db is null"); } if (url == null) { throw new ArgumentNullException("Given URL is null"); } this.storage = storage; this.url = url; if (storage.Cookies != null) { foreach (Cookie c in storage.Cookies) { this.Cookies.Add(c); } } }
public UserAccountService(ICookieStorage cookieStorage, IDocumentSession session, HttpContextBase httpContext) { _cookieStorage = cookieStorage; _session = session; _httpContext = httpContext; }
public LoginModel(ICookieStorage cookieStorage, AdminSettings adminSettings) { this.cookieStorage = cookieStorage; this.adminSettings = adminSettings; }
public CookieAuthAttribute(ICookieStorage cookieStorage, AdminSettings adminSettings) { this.cookieStorage = cookieStorage; this.adminSettings = adminSettings; }
public TimeZoneInfoPropertyBinder(ICookieStorage cookieStorage) { _cookieStorage = cookieStorage; }
public async Task InvokeAsync(HttpContext context, IAnalyticsService analyticsService, IExtremeIpLookup ipLookup, ICookieStorage cookies, ILogger <AnalyticsMiddleware> logger) { var ip = context.Connection.RemoteIpAddress; try { var deats = await ipLookup.GetIpDetailsAsync(ip); await deats.Match(o => { var thumb = GetThumbPrint(cookies, context.Request, context.Response); return(analyticsService.Add( new Domain.AnalyticsReport(Guid.NewGuid(), DateTime.UtcNow, o.City, Sha256Hasher.Hash(thumb.ToString())), CancellationToken.None)); }, _ => Task.CompletedTask); } catch (Exception e) { logger.LogError(e, "Error running analytics"); } await this.next(context); }
public IsAdmin(ICookieStorage cookieStorage, AdminSettings adminSettings) { this.cookieStorage = cookieStorage; this.adminSettings = adminSettings; }
public ConsentService(ICookieStorage storage) { _storage = storage; }