Welcome Guest, you are in: Login

FDOT Wiki

RSS RSS

Navigation (FDOT Security STS)





Search the wiki
»

PoweredBy
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

ScrewTurn Wiki version 3.0.4.560. Some of the icons created by FamFamFam.