mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
ServiceStack added
This commit is contained in:
parent
a26840fb60
commit
8f0d22e47d
65 changed files with 12384 additions and 5 deletions
36
NzbDrone.Api/Filters/ValidApiRequestAttribute.cs
Normal file
36
NzbDrone.Api/Filters/ValidApiRequestAttribute.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Ninject;
|
||||
using NzbDrone.Api.Exceptions;
|
||||
using NzbDrone.Api.RequestModels;
|
||||
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; }
|
||||
|
||||
[Inject]
|
||||
public ConfigProvider _configProvider;
|
||||
|
||||
public void RequestFilter(IHttpRequest req, IHttpResponse res, object requestDto)
|
||||
{
|
||||
//Verify the API Key here
|
||||
var apikey = ((IApiRequest)requestDto).ApiKey;
|
||||
|
||||
if (String.IsNullOrWhiteSpace(apikey))
|
||||
throw new InvalidApiKeyException();
|
||||
}
|
||||
|
||||
public IHasRequestFilter Copy()
|
||||
{
|
||||
return (IHasRequestFilter)this.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue