Added API key authentication

This commit is contained in:
Mark McDowall 2013-09-20 00:31:02 -07:00
commit 57fdbe6e08
11 changed files with 114 additions and 15 deletions

View file

@ -27,7 +27,10 @@ namespace NzbDrone.Api.Authentication
private Response RequiresAuthentication(NancyContext context)
{
Response response = null;
if (context.CurrentUser == null && _authenticationService.Enabled)
if (!context.Request.Path.StartsWith("/api/") &&
context.CurrentUser == null &&
_authenticationService.Enabled)
{
response = new Response { StatusCode = HttpStatusCode.Unauthorized };
}