public static IHtmlContent IfClaimShow(this IHtmlContent page,
                                        HttpContext context,
                                        string claimName,
                                        string claimValue)
 {
     return(CustomerAuthorization.ValidarClaimsUsuario(context, claimName, claimValue) ? page : null);
 }
        public void OnAuthorization(AuthorizationFilterContext context)
        {
            //repeated code, just documentation and studies
            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 (!CustomerAuthorization.ValidarClaimsUsuario(context.HttpContext, _claim.Type, _claim.Value))
            {
                context.Result = new ForbidResult();
            }
        }
 public static bool IfClaim(this RazorPage page, string claimName, string claimValue)
 {
     return(CustomerAuthorization
            .ValidarClaimsUsuario(page.Context, claimName, claimValue));
 }
 public static string IfClaimShow(this RazorPage page, string claimName, string claimValue)
 {
     return(CustomerAuthorization.ValidarClaimsUsuario(page.Context, claimName, claimValue) ? "" : "disabled");
 }