Files
mono/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs
T
Gonzalo Paniagua Javier 777e0e5d46 2003-01-04 Gonzalo Paniagua Javier <[email protected]>
* System.Web/HttpApplication.cs: added new state to handle default
	authentication.

	* System.Web.Configuration/HttpModulesConfigurationHandler.cs: add
	a default authentication module at the end of the list.

	* System.Web.Configuration/ModuleItem.cs: new constructor.
	* System.Web.Security/DefaultAuthenticationModule.cs: implemented. It
	just create a default unauthenticated user when no one else provided one.
	* System.Web.Security/FormsAuthenticationModule.cs: removed debug output.
	* System.Web.UI/Control.cs:
	(AddedControl): take the children to the same state of the parent.
	(InitRecursive): set the page of the children.
	* System.Web.UI/Page.cs: removed one line (it's done a few lines above).
	* System.Web.UI/UserControl.cs:
	(OnInit): always call InitializeAsUserControl
	(InitializeAsUserControl): sets the page for the control.

svn path=/trunk/mcs/; revision=10114
2003-01-04 04:39:32 +00:00

44 lines
1016 B
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]);
}
}
}