Skip to content

Commit

Permalink
Added AuthorizationContext creation to the MvcContextFactory.
Browse files Browse the repository at this point in the history
  • Loading branch information
NightOwl888 committed Aug 31, 2013
1 parent 9314a67 commit a36d9d9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ protected virtual IEnumerable<AuthorizeAttribute> GetAuthorizeAttributes(ActionD

protected virtual bool VerifyAuthorizeAttribute(AuthorizeAttribute authorizeAttribute, ControllerContext controllerContext, ActionDescriptor actionDescriptor)
{
var authorizationContext = new AuthorizationContext(controllerContext, actionDescriptor);
var authorizationContext = this.mvcContextFactory.CreateAuthorizationContext(controllerContext, actionDescriptor);
authorizeAttribute.OnAuthorization(authorizationContext);
if (authorizationContext.Result != null)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ public interface IMvcContextFactory
RouteCollection GetRoutes();
IUrlHelper CreateUrlHelper(RequestContext requestContext);
IUrlHelper CreateUrlHelper();
AuthorizationContext CreateAuthorizationContext(ControllerContext controllerContext, ActionDescriptor actionDescriptor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public virtual IUrlHelper CreateUrlHelper()
return new UrlHelperAdaptor(requestContext);
}

public virtual AuthorizationContext CreateAuthorizationContext(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
{
return new AuthorizationContext(controllerContext, actionDescriptor);
}

#endregion
}
}

0 comments on commit a36d9d9

Please sign in to comment.