Skip to content

Instantly share code, notes, and snippets.

@jakejscott
Created October 24, 2011 16:19
Show Gist options
  • Save jakejscott/1309422 to your computer and use it in GitHub Desktop.
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.
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