Created
September 16, 2014 18:25
-
-
Save SathishN/50c5c717028b6bcaf405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net; | |
using global::ServiceStack; | |
using global::ServiceStack.Logging; | |
using global::ServiceStack.ServiceHost; | |
public class AuthenticateFilter | |
{ | |
private static readonly ILog Log = LogManager.GetLogger(typeof(AuthenticateFilter)); | |
public static void Authenticate(IHttpRequest request, IHttpResponse response, object requestDto) | |
{ | |
if (response.IsClosed) return; | |
var httpRequest = request.OriginalRequest as HttpRequest; | |
if (httpRequest == null || !httpRequest.IsAuthenticated) | |
{ | |
response.StatusCode = (int)HttpStatusCode.Unauthorized; | |
response.EndRequest(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment