| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // System.Web.Security.DefaultAuthenticationModule
- //
- // Authors:
- // Gonzalo Paniagua Javier ([email protected])
- //
- // (C) 2002 Ximian, Inc (http://www.ximian.com)
- //
- using System.Web;
- using System.Security.Principal;
- namespace System.Web.Security
- {
- public sealed class DefaultAuthenticationModule : IHttpModule
- {
- static GenericIdentity defaultIdentity = new GenericIdentity ("", "");
- public event DefaultAuthenticationEventHandler Authenticate;
- public void Dispose ()
- {
- }
- public void Init (HttpApplication app)
- {
- app.DefaultAuthentication += new EventHandler (OnDefaultAuthentication);
- }
- void OnDefaultAuthentication (object sender, EventArgs args)
- {
- HttpApplication app = (HttpApplication) sender;
- HttpContext context = app.Context;
- if (context.User == null && Authenticate != null)
- Authenticate (this, new DefaultAuthenticationEventArgs (context));
- if (context.User == null)
- context.User = new GenericPrincipal (defaultIdentity, new string [0]);
- }
- }
- }
|