public ClaimsIdentityModel GetCurrentUser() { if (CurrentUser == null) { return(null); } Mapper.Initialize(cfg => { cfg.CreateMap <ApplicationUser, ClaimsIdentityModel>(); cfg.CreateMap <RoleClaim, ClaimModel>(); }); ClaimsIdentityModel result = Mapper.Map <ClaimsIdentityModel>(CurrentUser); result.Claims = AccountQueries.GetClaimsDictionaryByUser(CurrentUser, this.DbContext); return(result); }
public bool CheckAuthentication(HttpActionContext actionContext) { WebController controller = (WebController)actionContext.ControllerContext.Controller; if (controller.CurrentUser == null) { return(false); } Dictionary <string, string> dClaims = AccountQueries.GetClaimsDictionaryByUser(controller.CurrentUser, controller.DbContext); bool result = true; this.Claims.ToList().ForEach(c => { result = dClaims[c] == "true" && result; }); return(result); }