Created
December 19, 2013 12:48
-
-
Save follesoe/8038618 to your computer and use it in GitHub Desktop.
Test
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
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