diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Security/AuthorizeAttributeAclModule.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Security/AuthorizeAttributeAclModule.cs index 02afb12a..a3bd4a89 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Security/AuthorizeAttributeAclModule.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Security/AuthorizeAttributeAclModule.cs @@ -205,7 +205,7 @@ protected virtual IEnumerable 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; diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/IMvcContextFactory.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/IMvcContextFactory.cs index 026cad4f..e5df5e4b 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/IMvcContextFactory.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/IMvcContextFactory.cs @@ -19,5 +19,6 @@ public interface IMvcContextFactory RouteCollection GetRoutes(); IUrlHelper CreateUrlHelper(RequestContext requestContext); IUrlHelper CreateUrlHelper(); + AuthorizationContext CreateAuthorizationContext(ControllerContext controllerContext, ActionDescriptor actionDescriptor); } } diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/MvcContextFactory.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/MvcContextFactory.cs index 0356d100..8083863d 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/MvcContextFactory.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/MvcContextFactory.cs @@ -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 } }