Loading ...

Using LINQ to search for the ContosoWeb.PowerTool Action claim

 /5
0 (0votes)

public static Boolean PowerToolsPermission

{

    get

    {

        IClaimsIdentity identity =

            Thread.CurrentPrincipal.Identity as IClaimsIdentity;

        if (identity == null) return false;

 

        return identity.Claims

            .Where(claim => claim.ClaimType.Equals(ActionClaim) &&

                   claim.Value.Equals("ContosoWeb.PowerTools"))

            .Count() > 0;

    }

}

 

 

Comments (no comments yet)

Top Posts