public async Task Invoke(HttpContext httpContext, ILibrarian librarian) // injection to method { httpContext.Items["CurrentUserName"] = httpContext.User.Identity.Name; await librarian.CheckAccess(); await _next(httpContext); }
public async Task <IActionResult> VerifyEmail([FromServices] ILibrarian librarian, string authorEmail) { if (await librarian.CheckAccess()) { return(Json($"Selected author {authorEmail} is invalid")); } return(Json(true)); }