Skip to content

Instantly share code, notes, and snippets.

@follesoe
Created December 19, 2013 12:48
Show Gist options
  • Save follesoe/8038618 to your computer and use it in GitHub Desktop.
Save follesoe/8038618 to your computer and use it in GitHub Desktop.
Test
public class DummyAuthModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.AuthenticateRequest += ContextOnAuthenticateRequest;
}
private void ContextOnAuthenticateRequest(object sender, EventArgs eventArgs)
{
var identity = new GenericIdentity("test user");
SetPrincipal(new GenericPrincipal(identity, null));
}
private static void SetPrincipal(IPrincipal principal)
{
Thread.CurrentPrincipal = principal;
if (HttpContext.Current != null)
{
HttpContext.Current.User = principal;
}
}
public void Dispose()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment