20 lines
608 B
C#
20 lines
608 B
C#
using System.Linq;
|
|
using System.Security.Claims;
|
|
using System.Web.Http;
|
|
using System.Web.Http.Controllers;
|
|
|
|
namespace Step
|
|
{
|
|
class CmsAuthorizationAttribute : AuthorizeAttribute
|
|
{
|
|
public string Category;
|
|
public string Action;
|
|
protected override bool IsAuthorized(HttpActionContext actionContext)
|
|
{
|
|
ClaimsPrincipal principal = actionContext.RequestContext.Principal as ClaimsPrincipal;
|
|
var customClaimValue = principal.Claims.Where(c => c.Type == "role").Single().Value;
|
|
return base.IsAuthorized(actionContext);
|
|
}
|
|
}
|
|
}
|