Created
April 19, 2012 12:28
-
-
Save ahall/2420702 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
public class SessionPostAttribute : RequestFilterAttribute | |
{ | |
public SessionPostAttribute() | |
{ | |
this.Priority = -200; | |
this.ApplyTo = ApplyTo.Post; | |
} | |
public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto) | |
{ | |
var ssId = req.FormData.Get("ServiceStackId"); | |
var ssPid = req.FormData.Get("ServiceStackPid"); | |
if ((ssId != null) && (ssPid != null)) | |
{ | |
req.Cookies["ss-id"] = new System.Net.Cookie("ss-id", ssId); | |
req.Cookies["ss-pid"] = new System.Net.Cookie("ss-pid", ssPid); | |
} | |
} | |
} | |
[SessionPost, RequiredRole("admin")] | |
public class BlahService : IService<Blah>, IRequiresRequestContext | |
{ | |
public IRequestContext RequestContext { get; set; } | |
public object Execute(Blah request) | |
{ | |
Console.WriteLine("Made it through auth"); | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment