From 78ded70b3956ea8909dde4dbf1685e0b24f7f2ab Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 21 Apr 2014 21:55:42 -0700 Subject: [PATCH] New: ical is available with API key authentication --- .../Authentication/EnableStatelessAuthInNancy.cs | 2 +- src/NzbDrone.Api/Extensions/RequestExtensions.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs b/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs index a7aae870d..e6aaeae27 100644 --- a/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs +++ b/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs @@ -29,7 +29,7 @@ public Response ValidateApiKey(NancyContext context) var apiKey = GetApiKey(context); - if (context.Request.IsApiRequest() && !ValidApiKey(apiKey)) + if ((context.Request.IsApiRequest() || context.Request.IsFeedRequest()) && !ValidApiKey(apiKey)) { response = new Response { StatusCode = HttpStatusCode.Unauthorized }; } diff --git a/src/NzbDrone.Api/Extensions/RequestExtensions.cs b/src/NzbDrone.Api/Extensions/RequestExtensions.cs index 02686deb6..a07ab687d 100644 --- a/src/NzbDrone.Api/Extensions/RequestExtensions.cs +++ b/src/NzbDrone.Api/Extensions/RequestExtensions.cs @@ -10,6 +10,11 @@ public static bool IsApiRequest(this Request request) return request.Path.StartsWith("/api/", StringComparison.InvariantCultureIgnoreCase); } + public static bool IsFeedRequest(this Request request) + { + return request.Path.StartsWith("/feed/", StringComparison.InvariantCultureIgnoreCase); + } + public static bool IsSignalRRequest(this Request request) { return request.Path.StartsWith("/signalr/", StringComparison.InvariantCultureIgnoreCase);