Created
October 24, 2011 16:19
-
-
Save jakejscott/1309422 to your computer and use it in GitHub Desktop.
Nancy Auth Cookie, bit of a hack but works and uses the least amount of code.
This file contains hidden or 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; | |
using System.Collections.Generic; | |
using Nancy.Authentication.Forms; | |
using Nancy.Testing; | |
namespace Nancy.Authentication.Forms | |
{ | |
public static class BrowserContextExtenstions | |
{ | |
public static void FormsAuth(this BrowserContext browserContext, Guid userIdentifier) | |
{ | |
var response = FormsAuthentication.UserLoggedInResponse(userIdentifier); | |
var authCookie = response.Cookies[0]; | |
browserContext.Cookie(authCookie.Name, authCookie.Value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment