protected override IAsyncResult BeginExecuteCore(AsyncCallback callback, object state) { if (HttpContext.User.Identity.IsAuthenticated) { var authenticatedUserModel = AuthenticatedUserModel.GetFromJSON(HttpContext.User.Identity.Name); usuario = usuarioRepository.Get(authenticatedUserModel.ID); ViewBag.Usuario = usuario; } return(base.BeginExecuteCore(callback, state)); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { IIdentity identity = httpContext.User.Identity; var authenticatedUserModel = AuthenticatedUserModel.GetFromJSON(identity.Name); if (authenticatedUserModel != null && identity.IsAuthenticated) { return(true); } httpContext.Response.Redirect(FormsAuthentication.LoginUrl); return(false); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { if (httpContext.User != null && httpContext.User.Identity.IsAuthenticated) { var authenticatedUserModal = AuthenticatedUserModel.GetFromJSON(httpContext.User.Identity.Name); if (authenticatedUserModal.AccessGroups.Any(g => this.GroupName.Any(n => n.ToLowerInvariant() == g.ToLowerInvariant()))) { return(true); } } httpContext.Response.Redirect(FormsAuthentication.LoginUrl); return(false); }