using ServiceStack.Web;
using System;
namespace MediaBrowser.Controller.Net
{
public class AuthenticatedAttribute : Attribute, IHasRequestFilter
{
public IAuthService AuthService { get; set; }
///
/// The request filter is executed before the service.
///
/// The http request wrapper
/// The http response wrapper
/// The request DTO
public void RequestFilter(IRequest request, IResponse response, object requestDto)
{
AuthService.Authenticate(request, response, requestDto);
}
///
/// A new shallow copy of this filter is used on every request.
///
/// IHasRequestFilter.
public IHasRequestFilter Copy()
{
return this;
}
///
/// Order in which Request Filters are executed.
/// <0 Executed before global request filters
/// >0 Executed after global request filters
///
/// The priority.
public int Priority
{
get { return 0; }
}
}
}