2012-11-02 07:35:49 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using NzbDrone.Api.Exceptions;
|
2012-11-04 01:39:29 +00:00
|
|
|
|
using NzbDrone.Api.Helpers;
|
2012-11-02 07:35:49 +00:00
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using ServiceStack.ServiceHost;
|
|
|
|
|
using ServiceStack.ServiceInterface;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Filters
|
|
|
|
|
{
|
|
|
|
|
public class ValidApiRequestAttribute : Attribute, IHasRequestFilter
|
|
|
|
|
{
|
|
|
|
|
public ApplyTo ApplyTo { get; set; }
|
|
|
|
|
public int Priority { get; set; }
|
|
|
|
|
|
|
|
|
|
public ConfigProvider _configProvider;
|
|
|
|
|
|
|
|
|
|
public void RequestFilter(IHttpRequest req, IHttpResponse res, object requestDto)
|
|
|
|
|
{
|
|
|
|
|
//Verify the API Key here
|
2012-11-04 01:39:29 +00:00
|
|
|
|
var apikey = req.GetApiKey();
|
2012-11-02 07:35:49 +00:00
|
|
|
|
|
2012-11-04 01:39:29 +00:00
|
|
|
|
//if (String.IsNullOrWhiteSpace(apikey))
|
|
|
|
|
//throw new InvalidApiKeyException();
|
2012-11-02 07:35:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IHasRequestFilter Copy()
|
|
|
|
|
{
|
|
|
|
|
return (IHasRequestFilter)this.MemberwiseClone();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|