mirror of
https://github.com/fergalmoran/podnoms.git
synced 2025-12-25 10:47:51 +00:00
Removed outdated user repo stuff
This commit is contained in:
20
server/Controllers/BaseAuthController.cs
Normal file
20
server/Controllers/BaseAuthController.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PodNoms.Api.Services.Auth;
|
||||
|
||||
public class BaseAuthController : Controller {
|
||||
private readonly ClaimsPrincipal _caller;
|
||||
protected readonly UserManager<ApplicationUser> _userManager;
|
||||
protected readonly string _userId;
|
||||
protected readonly ApplicationUser _applicationUser;
|
||||
|
||||
public BaseAuthController(IHttpContextAccessor contextAccessor, UserManager<ApplicationUser> userManager) {
|
||||
_caller = contextAccessor.HttpContext.User;
|
||||
_userManager = userManager;
|
||||
_userId = _caller.Claims.Single(c => c.Type == "id").Value;
|
||||
_applicationUser = userManager.FindByIdAsync(_userId).Result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user