mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
* 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
46 lines
1.0 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
|