public void OnAuthorization(AuthorizationFilterContext context) { if (!context.HttpContext.User.Identity.IsAuthenticated) { context.Result = new RedirectToRouteResult(new RouteValueDictionary(new { area = "Identity", page = "/Account/Login", ReturnUrl = context.HttpContext.Request.Path.ToString() })); } if (!CustomAuthorization.ValidaClaimsUsuario(context.HttpContext, _claim.Type, _claim.Value)) { context.Result = new ForbidResult(); } }
public static string IfClaimShow(this RazorPage page, string claimName, string cliamValue) { return(CustomAuthorization.ValidaClaimsUsuario(page.Context, claimName, cliamValue) ?"":"disabled"); }
public static IHtmlContent IfClaimShow(this IHtmlContent htmlContent, HttpContext HttpContext, string claimName, string cliamValue) { return(CustomAuthorization.ValidaClaimsUsuario(HttpContext, claimName, cliamValue) ? htmlContent : null); }
public static bool IfClaim(this RazorPage page, string claimName, string cliamValue) { return(CustomAuthorization.ValidaClaimsUsuario(page.Context, claimName, cliamValue)); }