Fixes up the starter kit installer in the back office with it's legacy implementation. Adds some handy methods for webapi routing for areas.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -113,21 +112,4 @@ namespace Umbraco.Web.WebApi
|
||||
// controllerContext.Configuration.Formatters.Add(new AngularJsonMediaTypeFormatter());
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applying this attribute to any webapi controller will ensure that it only contains one json formatter compatible with the angular json vulnerability prevention.
|
||||
/// </summary>
|
||||
public class AngularJsonOnlyConfigurationAttribute : Attribute, IControllerConfiguration
|
||||
{
|
||||
public void Initialize(HttpControllerSettings controllerSettings, HttpControllerDescriptor controllerDescriptor)
|
||||
{
|
||||
//remove all json/xml formatters then add our custom one
|
||||
var toRemove = controllerSettings.Formatters.Where(t => (t is JsonMediaTypeFormatter) || (t is XmlMediaTypeFormatter)).ToList();
|
||||
foreach (var r in toRemove)
|
||||
{
|
||||
controllerSettings.Formatters.Remove(r);
|
||||
}
|
||||
controllerSettings.Formatters.Add(new AngularJsonMediaTypeFormatter());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user