Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@ -43,11 +43,7 @@ namespace System.Web.Security
{
static readonly object authenticateEvent = new object ();
#if NET_2_0
AuthenticationSection _config = null;
#else
AuthConfig _config = null;
#endif
bool isConfigInitialized = false;
EventHandlerList events = new EventHandlerList ();
@ -60,11 +56,7 @@ namespace System.Web.Security
{
if(isConfigInitialized)
return;
#if NET_2_0
_config = (AuthenticationSection) WebConfigurationManager.GetSection ("system.web/authentication");
#else
_config = (AuthConfig) context.GetConfig ("system.web/authentication");
#endif
isConfigInitialized = true;
}
@ -98,17 +90,10 @@ namespace System.Web.Security
return;
}
#if NET_2_0
cookieName = _config.Forms.Name;
cookiePath = _config.Forms.Path;
loginPage = _config.Forms.LoginUrl;
slidingExpiration = _config.Forms.SlidingExpiration;
#else
cookieName = _config.CookieName;
cookiePath = _config.CookiePath;
loginPage = _config.LoginUrl;
slidingExpiration = _config.SlidingExpiration;
#endif
if (!VirtualPathUtility.IsRooted (loginPage))
loginPage = "~/" + loginPage;
@ -122,12 +107,10 @@ namespace System.Web.Security
context.SkipAuthorization = String.Compare (reqPath, loginPath, RuntimeHelpers.CaseInsensitive, Helpers.InvariantCulture) == 0;
#if NET_2_0
//TODO: need to check that the handler is System.Web.Handlers.AssemblyResourceLoader type
string filePath = context.Request.FilePath;
if (filePath.Length > 15 && String.CompareOrdinal ("WebResource.axd", 0, filePath, filePath.Length - 15, 15) == 0)
context.SkipAuthorization = true;
#endif
FormsAuthenticationEventArgs formArgs = new FormsAuthenticationEventArgs (context);
FormsAuthenticationEventHandler eh = events [authenticateEvent] as FormsAuthenticationEventHandler;
@ -180,18 +163,12 @@ namespace System.Web.Security
if (context.Response.StatusCode != 401 || context.Request.QueryString ["ReturnUrl"] != null)
return;
#if NET_4_5
if (context.Response.StatusCode == 401 && context.Response.SuppressFormsAuthenticationRedirect)
return;
#endif
string loginPage;
InitConfig (context);
#if NET_2_0
loginPage = _config.Forms.LoginUrl;
#else
loginPage = _config.LoginUrl;
#endif
if (_config == null || _config.Mode != AuthenticationMode.Forms)
return;