2 // System.Web.Security.DefaultAuthenticationModule
5 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 // (C) 2002 Ximian, Inc (http://www.ximian.com)
11 using System.Security.Principal;
13 namespace System.Web.Security
15 public sealed class DefaultAuthenticationModule : IHttpModule
17 static GenericIdentity defaultIdentity = new GenericIdentity ("", "");
19 public event DefaultAuthenticationEventHandler Authenticate;
21 public void Dispose ()
25 public void Init (HttpApplication app)
27 app.DefaultAuthentication += new EventHandler (OnDefaultAuthentication);
30 void OnDefaultAuthentication (object sender, EventArgs args)
32 HttpApplication app = (HttpApplication) sender;
33 HttpContext context = app.Context;
35 if (context.User == null && Authenticate != null)
36 Authenticate (this, new DefaultAuthenticationEventArgs (context));
38 if (context.User == null)
39 context.User = new GenericPrincipal (defaultIdentity, new string [0]);