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();
     }
 }
예제 #2
0
 public static string IfClaimShow(this RazorPage page, string claimName, string cliamValue)
 {
     return(CustomAuthorization.ValidaClaimsUsuario(page.Context, claimName, cliamValue) ?"":"disabled");
 }
예제 #3
0
 public static IHtmlContent IfClaimShow(this IHtmlContent htmlContent, HttpContext HttpContext, string claimName, string cliamValue)
 {
     return(CustomAuthorization.ValidaClaimsUsuario(HttpContext, claimName, cliamValue) ? htmlContent : null);
 }
예제 #4
0
 public static bool IfClaim(this RazorPage page, string claimName, string cliamValue)
 {
     return(CustomAuthorization.ValidaClaimsUsuario(page.Context, claimName, cliamValue));
 }