private static async Task <string> GetSessionId(IUserCookieManager cookieManager, HttpContext context) { var(status, sid) = await cookieManager.GetSessionIdSafe(context.Request); return(status == ValidateUserSessionStatus.Ok && sid.HasValue ? $"{sid.Value:D}".Substring(0, 8) : "No session"); }
public AuthorizedActionFilter( ILogger <AuthorizedActionFilter> logger, IUserCookieManager cookieManager, UserRole[] roles) { this.logger = logger; this.cookieManager = cookieManager; this.roles = roles; }
public async Task InvokeAsync(HttpContext context, ILogger <LogContextMiddleware> logger, IUserCookieManager cookieManager) { var requestId = context.TraceIdentifier; var sessionId = await GetSessionId(cookieManager, context); using (logger.BeginScope($"[{requestId}] [{sessionId}]")) { logger.LogInformation($"Start controller call {context.Request.Path}"); await next(context); logger.LogInformation($"Finish controller call {context.Request.Path}. Response status code {context.Response.StatusCode}"); } }
public InviteController( IAsyncRepository <Invite> invitesRepo, IAsyncRepository <AuthenticationAccount> authenticationAccountRepo, IAsyncRepository <User> userRepo, IOptions <ConfigOptions> options, IUserCookieManager userCookieManager ) { this.invitesRepo = invitesRepo; this.authenticationAccountRepo = authenticationAccountRepo; this.userRepo = userRepo; this.options = options; this.userCookieManager = userCookieManager; }
public UsersController( ILogger <UsersController> logger, IUserCookieManager userCookieManager, IAuthenticationManager authenticationManager, IUserManager userManager, IAsyncRepository <User> usersRepo, IAsyncRepository <AuthenticationAccount> authenticationAccountRepo, IAsyncRepository <Invite> invitesRepo ) { this.logger = logger; this.userCookieManager = userCookieManager; this.authenticationManager = authenticationManager; this.userManager = userManager; this.usersRepo = usersRepo; this.authenticationAccountRepo = authenticationAccountRepo; this.invitesRepo = invitesRepo; }
public ContestsController(IContestManager contestManager, IAsyncRepository <Contest> contestsRepo, IUserCookieManager cookieManager) { this.contestManager = contestManager; this.contestsRepo = contestsRepo; this.cookieManager = cookieManager; }