Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs')
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs50
1 files changed, 37 insertions, 13 deletions
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
index 33a8b56ff3f..615c45886cb 100644
--- a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
@@ -75,6 +75,9 @@ namespace System.Web.Security
"index.html",
"index.htm" };
+#if NET_2_0
+ [Obsolete]
+#endif
public FormsAuthentication ()
{
}
@@ -89,8 +92,8 @@ namespace System.Web.Security
if (context == null)
throw new HttpException ("Context is null!");
-#if NET_2_0
- AuthenticationSection section = (AuthenticationSection) WebConfigurationManager.GetSection (authConfigPath);
+#if CONFIGURATION_2_0
+ AuthenticationSection section = (AuthenticationSection) WebConfigurationManager.GetWebApplicationSection (authConfigPath);
FormsAuthenticationCredentials config = section.Forms.Credentials;
FormsAuthenticationUser user = config.Users[name];
string stored = null;
@@ -125,8 +128,8 @@ namespace System.Web.Security
if (protection == FormsProtectionEnum.None)
return FormsAuthenticationTicket.FromByteArray (bytes);
-#if NET_2_0
- MachineKeySection config = (MachineKeySection) WebConfigurationManager.GetSection (machineKeyConfigPath);
+#if CONFIGURATION_2_0
+ MachineKeySection config = (MachineKeySection) WebConfigurationManager.GetWebApplicationSection (machineKeyConfigPath);
#else
MachineKeyConfig config = HttpContext.GetAppConfig (machineKeyConfigPath) as MachineKeyConfig;
#endif
@@ -144,7 +147,7 @@ namespace System.Web.Security
int count;
MachineKeyValidation validationType;
-#if NET_2_0
+#if CONFIGURATION_2_0
validationType = config.Validation;
#else
validationType = config.ValidationType;
@@ -154,7 +157,7 @@ namespace System.Web.Security
else
count = SHA1_hash_size; // 3DES and SHA1
-#if NET_2_0
+#if CONFIGURATION_2_0
byte [] vk = config.ValidationKeyBytes;
#else
byte [] vk = config.ValidationKey;
@@ -196,7 +199,7 @@ namespace System.Web.Security
Initialize ();
FormsAuthenticationTicket ticket;
-#if NET_2_0
+#if CONFIGURATION_2_0
byte [] bytes = MachineKeySection.GetBytes (encryptedTicket, encryptedTicket.Length);
#else
byte [] bytes = MachineKeyConfig.GetBytes (encryptedTicket, encryptedTicket.Length);
@@ -221,15 +224,15 @@ namespace System.Web.Security
return GetHexString (ticket_bytes);
byte [] result = ticket_bytes;
-#if NET_2_0
- MachineKeySection config = (MachineKeySection) WebConfigurationManager.GetSection (machineKeyConfigPath);
+#if CONFIGURATION_2_0
+ MachineKeySection config = (MachineKeySection) WebConfigurationManager.GetWebApplicationSection (machineKeyConfigPath);
#else
MachineKeyConfig config = HttpContext.GetAppConfig (machineKeyConfigPath) as MachineKeyConfig;
#endif
bool all = (protection == FormsProtectionEnum.All);
if (all || protection == FormsProtectionEnum.Validation) {
byte [] valid_bytes = null;
-#if NET_2_0
+#if CONFIGURATION_2_0
byte [] vk = config.ValidationKeyBytes;
#else
byte [] vk = config.ValidationKey;
@@ -239,7 +242,7 @@ namespace System.Web.Security
Buffer.BlockCopy (vk, 0, mix, result.Length, vk.Length);
switch (
-#if NET_2_0
+#if CONFIGURATION_2_0
config.Validation
#else
config.ValidationType
@@ -375,8 +378,8 @@ namespace System.Web.Security
if (initialized)
return;
-#if NET_2_0
- AuthenticationSection section = (AuthenticationSection)WebConfigurationManager.GetSection (authConfigPath);
+#if CONFIGURATION_2_0
+ AuthenticationSection section = (AuthenticationSection)WebConfigurationManager.GetWebApplicationSection (authConfigPath);
FormsAuthenticationConfiguration config = section.Forms;
cookieName = config.Name;
@@ -393,7 +396,13 @@ namespace System.Web.Security
login_url = config.LoginUrl;
#else
HttpContext context = HttpContext.Current;
+#if NET_2_0
+ AuthConfig authConfig = null;
+ if (context != null)
+ authConfig = context.GetConfig (authConfigPath) as AuthConfig;
+#else
AuthConfig authConfig = context.GetConfig (authConfigPath) as AuthConfig;
+#endif
if (authConfig != null) {
cookieName = authConfig.CookieName;
timeout = authConfig.Timeout;
@@ -403,6 +412,14 @@ namespace System.Web.Security
requireSSL = authConfig.RequireSSL;
slidingExpiration = authConfig.SlidingExpiration;
#endif
+#if NET_2_0
+ cookie_domain = authConfig.CookieDomain;
+ cookie_mode = authConfig.CookieMode;
+ cookies_supported = authConfig.CookiesSupported;
+ default_url = authConfig.DefaultUrl;
+ enable_crossapp_redirects = authConfig.EnableCrossAppRedirects;
+ login_url = authConfig.LoginUrl;
+#endif
} else {
cookieName = ".MONOAUTH";
timeout = 30;
@@ -411,6 +428,13 @@ namespace System.Web.Security
#if NET_1_1
slidingExpiration = true;
#endif
+#if NET_2_0
+ cookie_domain = String.Empty;
+ cookie_mode = HttpCookieMode.UseDeviceProfile;
+ cookies_supported = true;
+ default_url = "/default.aspx";
+ login_url = "/login.aspx";
+#endif
}
#endif