FDOT.Security.STS.Client.Filters.ClaimsAuthorizeAttribute
Standard Use¶
[ClaimsAuthorize("http://example.dot.state.fl.us/claims/role","Admin")]
Customizing ClaimsAuthorizeAttribute
public class MyClaimsAuthorizeAttribute : ClaimsAuthorizeAttribute
{
public MyClaimsAuthorizeAttribute(string ClaimType, string Value) : base(ClaimType, Value){}
public override void OnAuthorization(AuthorizationContext filterContext)
{
if (AuthorizeCore(filterContext.HttpContext))
{
base.OnAuthorization(filterContext);
}
else
{
HandleUnauthorizedRequest(filterContext);
}
}
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
filterContext.HttpContext.Response.Redirect("~/Home/Error");
base.HandleUnauthorizedRequest(filterContext);
}
}
See Also