SHARE
TWEET

Untitled

a guest Jun 18th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class DefaultController : Controller
  2. {
  3.     protected readonly DatabaseContext _context;
  4.     protected readonly User _user;
  5.  
  6.     public DefaultController(DatabaseContext context)
  7.     {
  8.         _context = context;
  9.  
  10.         if (HttpContext.Request.RequiresAuthorization) // pseudo code
  11.         {
  12.             var id = User.FindFirst(ClaimTypes.NameIdentifier).Value;
  13.             _user = _context.Users.Find(id);
  14.         }
  15.     }
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top