Files
mono/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs
T
Gonzalo Paniagua Javier ae7b210e4f 2004-06-11 Gonzalo Paniagua Javier <[email protected]>
* System.Web/HttpApplication.cs: change/restore the IPrincipal in their
	own methods and make them internal.

	* System.Web.Security/DefaultAuthenticationModule.cs: set the IPrincipal
	for this thread once we have a user. Fixes bug #59683.

svn path=/trunk/mcs/; revision=29248
2004-06-11 01:24:35 +00:00

46 lines
1.0 KiB
C#

//
// 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]);
app.SetPrincipal (context.User);
}
}
}