diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-07-02 00:57:18 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-07-02 00:57:18 -0400 |
| commit | 389390b82ecfbb48e0486f8f132046ddf8624e00 (patch) | |
| tree | c03ffa22f3a2fe668bb9be7078ad83fea3177796 /MediaBrowser.Controller/Net/AuthenticatedAttribute.cs | |
| parent | 3bef6ead9cec4c33d43b6348ae4fc33c9b70316a (diff) | |
fixes #789 - Security Issue: API allows access to any folder of the PC running MediaBrowser
Diffstat (limited to 'MediaBrowser.Controller/Net/AuthenticatedAttribute.cs')
| -rw-r--r-- | MediaBrowser.Controller/Net/AuthenticatedAttribute.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs b/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs new file mode 100644 index 000000000..567d20f39 --- /dev/null +++ b/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs @@ -0,0 +1,41 @@ +using ServiceStack.Web; +using System; + +namespace MediaBrowser.Controller.Net +{ + public class AuthenticatedAttribute : Attribute, IHasRequestFilter + { + public IAuthService AuthService { get; set; } + + /// <summary> + /// The request filter is executed before the service. + /// </summary> + /// <param name="request">The http request wrapper</param> + /// <param name="response">The http response wrapper</param> + /// <param name="requestDto">The request DTO</param> + public void RequestFilter(IRequest request, IResponse response, object requestDto) + { + AuthService.Authenticate(request, response, requestDto); + } + + /// <summary> + /// A new shallow copy of this filter is used on every request. + /// </summary> + /// <returns>IHasRequestFilter.</returns> + public IHasRequestFilter Copy() + { + return this; + } + + /// <summary> + /// Order in which Request Filters are executed. + /// <0 Executed before global request filters + /// >0 Executed after global request filters + /// </summary> + /// <value>The priority.</value> + public int Priority + { + get { return 0; } + } + } +} |
