Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@ -0,0 +1,54 @@
//
// System.Web.Configuration.AdapterDictionary
//
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
// (C) 2004 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System.Collections.Specialized;
using System.Runtime.Serialization;
namespace System.Web.Configuration
{
[Serializable]
public class AdapterDictionary: OrderedDictionary, IDeserializationCallback
{
public string this [string key] {
get { return (string) base [key]; }
set { base [key] = value; }
}
[MonoTODO ("Not implemented")]
void IDeserializationCallback.OnDeserialization (object sender)
{
throw new NotImplementedException ();
}
}
}
#endif

View File

@ -0,0 +1,151 @@
//
// System.Web.Configuration.AnonymousIdentificationSection.cs
//
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
// (C) 2004 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
using System.Web.Security;
using System.ComponentModel;
namespace System.Web.Configuration
{
public sealed class AnonymousIdentificationSection: ConfigurationSection
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty enabledProp;
static ConfigurationProperty cookielessProp;
static ConfigurationProperty cookieNameProp;
static ConfigurationProperty cookieTimeoutProp;
static ConfigurationProperty cookiePathProp;
static ConfigurationProperty cookieRequireSSLProp;
static ConfigurationProperty cookieSlidingExpirationProp;
static ConfigurationProperty cookieProtectionProp;
static ConfigurationProperty domainProp;
static AnonymousIdentificationSection ()
{
enabledProp = new ConfigurationProperty ("enabled", typeof(bool), false);
cookielessProp = new ConfigurationProperty ("cookieless", typeof (HttpCookieMode), HttpCookieMode.UseCookies,
new GenericEnumConverter (typeof (HttpCookieMode)),
PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.None);
cookieNameProp = new ConfigurationProperty ("cookieName", typeof (string), ".ASPXANONYMOUS", TypeDescriptor.GetConverter (typeof (string)),
PropertyHelper.NonEmptyStringValidator, ConfigurationPropertyOptions.None);
cookieTimeoutProp = new ConfigurationProperty ("cookieTimeout", typeof (TimeSpan), new TimeSpan (69,10,40,0), new TimeSpanMinutesOrInfiniteConverter(),
PropertyHelper.PositiveTimeSpanValidator,
ConfigurationPropertyOptions.None);
cookiePathProp = new ConfigurationProperty ("cookiePath", typeof (string), "/", TypeDescriptor.GetConverter (typeof (string)),
PropertyHelper.NonEmptyStringValidator, ConfigurationPropertyOptions.None);
cookieRequireSSLProp = new ConfigurationProperty ("cookieRequireSSL", typeof(bool), false);
cookieSlidingExpirationProp = new ConfigurationProperty ("cookieSlidingExpiration", typeof(bool), true);
cookieProtectionProp = new ConfigurationProperty ("cookieProtection", typeof(CookieProtection), CookieProtection.Validation,
new GenericEnumConverter (typeof (CookieProtection)),
null, ConfigurationPropertyOptions.None);
domainProp = new ConfigurationProperty ("domain", typeof(string), null);
properties = new ConfigurationPropertyCollection ();
properties.Add (enabledProp);
properties.Add (cookielessProp);
properties.Add (cookieNameProp);
properties.Add (cookieTimeoutProp);
properties.Add (cookiePathProp);
properties.Add (cookieRequireSSLProp);
properties.Add (cookieSlidingExpirationProp);
properties.Add (cookieProtectionProp);
properties.Add (domainProp);
}
[ConfigurationProperty ("cookieless", DefaultValue = "UseCookies")]
public HttpCookieMode Cookieless {
get { return (HttpCookieMode) base [cookielessProp]; }
set { base [cookielessProp] = value; }
}
[StringValidator (MinLength = 1)]
[ConfigurationProperty ("cookieName", DefaultValue = ".ASPXANONYMOUS")]
public string CookieName {
get { return (string) base [cookieNameProp]; }
set { base [cookieNameProp] = value; }
}
[StringValidator (MinLength = 1)]
[ConfigurationProperty ("cookiePath", DefaultValue = "/")]
public string CookiePath {
get { return (string) base [cookiePathProp]; }
set { base [cookiePathProp] = value; }
}
[ConfigurationProperty ("cookieProtection", DefaultValue = "Validation")]
public CookieProtection CookieProtection {
get { return (CookieProtection) base [cookieProtectionProp]; }
set { base [cookieProtectionProp] = value; }
}
[ConfigurationProperty ("cookieRequireSSL", DefaultValue = "False")]
public bool CookieRequireSSL {
get { return (bool) base [cookieRequireSSLProp]; }
set { base [cookieRequireSSLProp] = value; }
}
[ConfigurationProperty ("cookieSlidingExpiration", DefaultValue = "True")]
public bool CookieSlidingExpiration {
get { return (bool) base [cookieSlidingExpirationProp]; }
set { base [cookieSlidingExpirationProp] = value; }
}
[TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
[TypeConverter (typeof(TimeSpanMinutesOrInfiniteConverter))]
[ConfigurationProperty ("cookieTimeout", DefaultValue = "69.10:40:00")]
public TimeSpan CookieTimeout {
get { return (TimeSpan) base [cookieTimeoutProp]; }
set { base [cookieTimeoutProp] = value; }
}
[ConfigurationProperty ("domain")]
public string Domain {
get { return (string) base [domainProp]; }
set { base [domainProp] = value; }
}
[ConfigurationProperty ("enabled", DefaultValue = "False")]
public bool Enabled {
get { return (bool) base [enabledProp]; }
set { base [enabledProp] = value; }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,51 @@
//
// System.Web.Configuration.ApplicationSettingsConfigurationFileMap.cs
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// Copyright (C) 2009 Novell, Inc (http://novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
using System.Web;
using System.Web.Configuration;
namespace System.Web.Configuration
{
// Part of fix for bug #491531
class ApplicationSettingsConfigurationFileMap : ConfigurationFileMap
{
public ApplicationSettingsConfigurationFileMap ()
{
HttpContext ctx = HttpContext.Current;
HttpRequest req = ctx != null ? ctx.Request : null;
if (req != null) {
MachineConfigFilename = WebConfigurationHost.GetWebConfigFileName (req.MapPath (WebConfigurationManager.FindWebConfig (req.CurrentExecutionFilePath)));
} else
MachineConfigFilename = null;
}
}
}
#endif

View File

@ -0,0 +1,95 @@
//
// System.Web.Configuration.AssemblyCollection
//
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
// Chris Toshok (toshok@ximian.com)
//
// (C) 2004,2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
namespace System.Web.Configuration
{
[ConfigurationCollection (typeof (AssemblyInfo), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
public sealed class AssemblyCollection: ConfigurationElementCollection
{
static ConfigurationPropertyCollection properties;
static AssemblyCollection ()
{
properties = new ConfigurationPropertyCollection();
}
public void Add (AssemblyInfo info)
{
BaseAdd (info, false);
}
public void Clear ()
{
BaseClear ();
}
protected override ConfigurationElement CreateNewElement ()
{
return new AssemblyInfo ();
}
protected override object GetElementKey (ConfigurationElement element)
{
return ((AssemblyInfo)element).Assembly;
}
public void Remove (string key)
{
BaseRemove (key);
}
public void RemoveAt (int index)
{
BaseRemoveAt (index);
}
public AssemblyInfo this [int index] {
get { return (AssemblyInfo) BaseGet (index); }
set { if (BaseGet(index) != null) BaseRemoveAt(index); BaseAdd(index, value); }
}
public new AssemblyInfo this [string assemblyName] {
get { return (AssemblyInfo) BaseGet (assemblyName); }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,77 @@
//
// System.Web.Configuration.AssemblyCollection
//
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
// Chris Toshok (toshok@ximian.com)
//
// (C) 2004,2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.ComponentModel;
using System.Configuration;
namespace System.Web.Configuration
{
public sealed class AssemblyInfo: ConfigurationElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty assemblyProp;
static AssemblyInfo ()
{
assemblyProp = new ConfigurationProperty ("assembly", typeof (string), null, TypeDescriptor.GetConverter (typeof (string)),
PropertyHelper.NonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
properties = new ConfigurationPropertyCollection ();
properties.Add (assemblyProp);
}
internal AssemblyInfo ()
{
}
public AssemblyInfo (string assemblyName)
{
this.Assembly = assemblyName;
}
[StringValidator (MinLength = 1)]
[ConfigurationProperty ("assembly", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
public string Assembly {
get { return (string) base [assemblyProp]; }
set { base [assemblyProp] = value; }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,38 @@
//
// System.Web.Configuration.AuthenticationMode.cs
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
//
// (C) 2005 Novell, Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Web.Configuration {
public enum AuthenticationMode {
None,
Windows,
Passport,
Forms
}
}

View File

@ -0,0 +1,101 @@
//
// System.Web.Configuration.AuthenticationSection
//
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
// (C) 2004 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
namespace System.Web.Configuration
{
public sealed class AuthenticationSection: ConfigurationSection
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty formsProp;
static ConfigurationProperty passportProp;
static ConfigurationProperty modeProp;
static AuthenticationSection ()
{
formsProp = new ConfigurationProperty ("forms", typeof(FormsAuthenticationConfiguration), null,
null,
PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.None);
passportProp = new ConfigurationProperty ("passport", typeof(PassportAuthentication), null,
null,
PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.None);
modeProp = new ConfigurationProperty ("mode", typeof(AuthenticationMode), AuthenticationMode.Windows,
new GenericEnumConverter (typeof (AuthenticationMode)),
PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (formsProp);
properties.Add (passportProp);
properties.Add (modeProp);
}
public AuthenticationSection ()
{
}
protected internal override void Reset (ConfigurationElement parentElement)
{
base.Reset (parentElement);
}
[ConfigurationProperty ("forms")]
public FormsAuthenticationConfiguration Forms {
get { return (FormsAuthenticationConfiguration) base [formsProp]; }
}
[ConfigurationProperty ("passport")]
#if NET_4_0
[Obsolete ("This property is obsolete. The Passport authentication product is no longer supported and has been superseded by Live ID.")]
#endif
public PassportAuthentication Passport {
get { return (PassportAuthentication) base [passportProp]; }
}
[ConfigurationProperty ("mode", DefaultValue = "Windows")]
public AuthenticationMode Mode {
get { return (AuthenticationMode) base [modeProp]; }
set { base [modeProp] = value; }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,270 @@
//
// System.Web.Configuration.AuthorizationRule
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Specialized;
using System.Security.Principal;
using System.Configuration;
using System.ComponentModel;
using System.Xml;
using System.Globalization;
using System.Web.Util;
#if NET_2_0
namespace System.Web.Configuration {
public sealed class AuthorizationRule : ConfigurationElement
{
static ConfigurationProperty rolesProp;
static ConfigurationProperty usersProp;
static ConfigurationProperty verbsProp;
static ConfigurationPropertyCollection properties;
AuthorizationRuleAction action;
ConfigurationSaveMode saveMode = ConfigurationSaveMode.Full;
static AuthorizationRule ()
{
rolesProp = new ConfigurationProperty ("roles", typeof (StringCollection), null,
PropertyHelper.CommaDelimitedStringCollectionConverter,
PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.None);
usersProp = new ConfigurationProperty ("users", typeof (StringCollection), null,
PropertyHelper.CommaDelimitedStringCollectionConverter,
PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.None);
verbsProp = new ConfigurationProperty ("verbs", typeof (StringCollection), null,
PropertyHelper.CommaDelimitedStringCollectionConverter,
PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (rolesProp);
properties.Add (usersProp);
properties.Add (verbsProp);
}
public AuthorizationRule (AuthorizationRuleAction action)
{
this.action = action;
base[rolesProp] = new CommaDelimitedStringCollection ();
base[usersProp] = new CommaDelimitedStringCollection ();
base[verbsProp] = new CommaDelimitedStringCollection ();
}
public override bool Equals (object obj)
{
AuthorizationRule auth = obj as AuthorizationRule;
if (auth == null)
return false;
if (action != auth.Action)
return false;
if (Roles.Count != auth.Roles.Count
|| Users.Count != auth.Users.Count
|| Verbs.Count != auth.Verbs.Count)
return false;
int i;
for (i = 0; i < Roles.Count; i ++)
if (Roles[i] != auth.Roles[i])
return false;
for (i = 0; i < Users.Count; i ++)
if (Users[i] != auth.Users[i])
return false;
for (i = 0; i < Verbs.Count; i ++)
if (Verbs[i] != auth.Verbs[i])
return false;
return true;
}
public override int GetHashCode ()
{
int hashCode = (int)action;
int i;
for (i = 0; i < Roles.Count; i ++)
hashCode += Roles[i].GetHashCode();
for (i = 0; i < Users.Count; i ++)
hashCode += Users[i].GetHashCode();
for (i = 0; i < Verbs.Count; i ++)
hashCode += Verbs[i].GetHashCode();
return hashCode;
}
[MonoTODO ("Not implemented")]
protected internal override bool IsModified ()
{
if (((CommaDelimitedStringCollection)Roles).IsModified || ((CommaDelimitedStringCollection)Users).IsModified || ((CommaDelimitedStringCollection)Verbs).IsModified)
return true;
return false;
}
void VerifyData ()
{
if (Roles.Count == 0 && Users.Count == 0)
throw new ConfigurationErrorsException ("You must supply either a list of users or roles when creating an AuthorizationRule");
}
protected override void PostDeserialize ()
{
base.PostDeserialize();
VerifyData ();
}
protected override void PreSerialize (XmlWriter writer)
{
base.PreSerialize (writer);
VerifyData ();
}
protected internal override void Reset (ConfigurationElement parentElement)
{
AuthorizationRule r = (AuthorizationRule)parentElement;
Action = r.Action;
base.Reset (parentElement);
}
protected internal override void ResetModified ()
{
base.ResetModified ();
}
protected internal override bool SerializeElement (XmlWriter writer, bool serializeCollectionKey)
{
if (saveMode != ConfigurationSaveMode.Full && !IsModified ())
return true;
PreSerialize (writer);
writer.WriteStartElement (action == AuthorizationRuleAction.Allow ? "allow" : "deny");
if (Roles.Count > 0)
writer.WriteAttributeString ("roles", Roles.ToString());
if (Users.Count > 0)
writer.WriteAttributeString ("users", Users.ToString());
if (Verbs.Count > 0)
writer.WriteAttributeString ("verbs", Verbs.ToString());
writer.WriteEndElement ();
return true;
}
protected internal override void SetReadOnly ()
{
base.SetReadOnly();
}
protected internal override void Unmerge (ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
{
base.Unmerge (sourceElement, parentElement, saveMode);
this.saveMode = saveMode;
AuthorizationRule source = sourceElement as AuthorizationRule;
if (source != null)
this.action = source.Action;
}
public AuthorizationRuleAction Action {
get { return action; }
set { action = value; }
}
[TypeConverter (typeof (CommaDelimitedStringCollectionConverter))]
[ConfigurationProperty ("roles")]
public StringCollection Roles {
get { return (StringCollection) base [rolesProp];}
}
[TypeConverter (typeof (CommaDelimitedStringCollectionConverter))]
[ConfigurationProperty ("users")]
public StringCollection Users {
get { return (StringCollection) base [usersProp];}
}
[TypeConverter (typeof (CommaDelimitedStringCollectionConverter))]
[ConfigurationProperty ("verbs")]
public StringCollection Verbs {
get { return (StringCollection) base [verbsProp];}
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
internal bool CheckVerb (string verb)
{
foreach (string v in Verbs) {
if (String.Compare (v, verb, true, Helpers.InvariantCulture) == 0)
return true;
}
return false;
}
internal bool CheckUser (string user)
{
foreach (string u in Users) {
if (String.Compare (u, user, true, Helpers.InvariantCulture) == 0 ||
u == "*" ||
(u == "?" && user == ""))
return true;
}
return false;
}
internal bool CheckRole (IPrincipal user)
{
foreach (string r in Roles) {
if (user.IsInRole (r))
return true;
}
return false;
}
}
}
#endif

View File

@ -0,0 +1,38 @@
//
// System.Web.Configuration.AuthorizationRuleAction.cs
//
// Authors:
// Duncan Mak (duncan@ximian.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
#if NET_2_0
namespace System.Web.Configuration
{
public enum AuthorizationRuleAction
{
Deny,
Allow
}
}
#endif

View File

@ -0,0 +1,128 @@
//
// System.Web.Configuration.AuthorizationRuleCollection
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Configuration;
#if NET_2_0
namespace System.Web.Configuration {
[ConfigurationCollection (typeof (AuthorizationRule), AddItemName="allow,deny", CollectionType = ConfigurationElementCollectionType.BasicMapAlternate)]
public sealed class AuthorizationRuleCollection : ConfigurationElementCollection
{
static ConfigurationPropertyCollection properties;
static AuthorizationRuleCollection ()
{
properties = new ConfigurationPropertyCollection ();
}
public void Add (AuthorizationRule rule)
{
BaseAdd (rule, false);
}
public void Clear ()
{
BaseClear ();
}
protected override ConfigurationElement CreateNewElement (string elementName)
{
return new AuthorizationRule (elementName == "allow" ? AuthorizationRuleAction.Allow : AuthorizationRuleAction.Deny);
}
protected override ConfigurationElement CreateNewElement ()
{
return new AuthorizationRule (AuthorizationRuleAction.Allow);
}
public AuthorizationRule Get (int index)
{
return (AuthorizationRule) BaseGet (index);
}
protected override object GetElementKey (ConfigurationElement element)
{
AuthorizationRule rule = (AuthorizationRule)element;
return rule.Action.ToString();
}
public int IndexOf (AuthorizationRule rule)
{
return BaseIndexOf (rule);
}
protected override bool IsElementName (string elementname)
{
return (elementname == "allow" || elementname == "deny");
}
public void Remove (AuthorizationRule rule)
{
BaseRemove (rule.Action.ToString());
}
public void RemoveAt (int index)
{
BaseRemoveAt (index);
}
public void Set (int index, AuthorizationRule rule)
{
if (BaseGet(index) != null)
BaseRemoveAt(index);
BaseAdd(index, rule);
}
public override ConfigurationElementCollectionType CollectionType {
get { return ConfigurationElementCollectionType.BasicMapAlternate; }
}
protected override string ElementName {
get { return String.Empty; }
}
public AuthorizationRule this [int index] {
get { return Get (index); }
set { Set (index, value); }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,88 @@
//
// System.Web.Configuration.AuthorizationSection
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Configuration;
using System.Security.Principal;
#if NET_2_0
namespace System.Web.Configuration {
public sealed class AuthorizationSection : ConfigurationSection
{
static ConfigurationProperty rulesProp;
static ConfigurationPropertyCollection properties;
static AuthorizationSection ()
{
rulesProp = new ConfigurationProperty (String.Empty, typeof (AuthorizationRuleCollection), null,
null, PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.IsDefaultCollection);
properties = new ConfigurationPropertyCollection ();
properties.Add (rulesProp);
}
protected override void PostDeserialize()
{
base.PostDeserialize ();
}
[ConfigurationProperty ("", Options = ConfigurationPropertyOptions.IsDefaultCollection)]
public AuthorizationRuleCollection Rules {
get { return (AuthorizationRuleCollection) base [rulesProp];}
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
internal bool IsValidUser (IPrincipal user, string verb)
{
string username = (user == null) ? String.Empty : user.Identity.Name;
foreach (AuthorizationRule rule in Rules) {
if (rule.Verbs.Count != 0 && !rule.CheckVerb (verb))
continue;
if (rule.CheckUser (username) || (user != null && rule.CheckRole(user)))
return (rule.Action == AuthorizationRuleAction.Allow);
}
return true;
}
}
}
#endif

View File

@ -0,0 +1,179 @@
//
// System.Web.Configuration.BufferModeSettings
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.ComponentModel;
using System.Configuration;
#if NET_2_0
namespace System.Web.Configuration {
public sealed class BufferModeSettings : ConfigurationElement
{
static ConfigurationProperty maxBufferSizeProp;
static ConfigurationProperty maxBufferThreadsProp;
static ConfigurationProperty maxFlushSizeProp;
static ConfigurationProperty nameProp;
static ConfigurationProperty regularFlushIntervalProp;
static ConfigurationProperty urgentFlushIntervalProp;
static ConfigurationProperty urgentFlushThresholdProp;
static ConfigurationPropertyCollection properties;
static ConfigurationElementProperty elementProperty;
static BufferModeSettings ()
{
IntegerValidator iv = new IntegerValidator (1, Int32.MaxValue);
maxBufferSizeProp = new ConfigurationProperty ("maxBufferSize", typeof (int), Int32.MaxValue,
PropertyHelper.InfiniteIntConverter, iv,
ConfigurationPropertyOptions.IsRequired);
maxBufferThreadsProp = new ConfigurationProperty ("maxBufferThreads", typeof (int), 1,
PropertyHelper.InfiniteIntConverter, iv,
ConfigurationPropertyOptions.None);
maxFlushSizeProp = new ConfigurationProperty ("maxFlushSize", typeof (int), Int32.MaxValue,
PropertyHelper.InfiniteIntConverter, iv,
ConfigurationPropertyOptions.IsRequired);
nameProp = new ConfigurationProperty ("name", typeof (string), "",
TypeDescriptor.GetConverter (typeof (string)), PropertyHelper.NonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
regularFlushIntervalProp = new ConfigurationProperty ("regularFlushInterval", typeof (TimeSpan), TimeSpan.FromSeconds (1),
PropertyHelper.InfiniteTimeSpanConverter,
PropertyHelper.PositiveTimeSpanValidator,
ConfigurationPropertyOptions.IsRequired);
urgentFlushIntervalProp = new ConfigurationProperty ("urgentFlushInterval", typeof (TimeSpan), TimeSpan.FromSeconds (0),
PropertyHelper.InfiniteTimeSpanConverter, null,
ConfigurationPropertyOptions.IsRequired);
urgentFlushThresholdProp = new ConfigurationProperty ("urgentFlushThreshold", typeof (int), Int32.MaxValue,
PropertyHelper.InfiniteIntConverter, iv,
ConfigurationPropertyOptions.IsRequired);
properties = new ConfigurationPropertyCollection ();
properties.Add (nameProp);
properties.Add (maxBufferSizeProp);
properties.Add (maxBufferThreadsProp);
properties.Add (maxFlushSizeProp);
properties.Add (regularFlushIntervalProp);
properties.Add (urgentFlushIntervalProp);
properties.Add (urgentFlushThresholdProp);
elementProperty = new ConfigurationElementProperty (new CallbackValidator (typeof (BufferModeSettings), ValidateElement));
}
internal BufferModeSettings ()
{
}
public BufferModeSettings (string name, int maxBufferSize, int maxFlushSize, int urgentFlushThreshold,
TimeSpan regularFlushInterval, TimeSpan urgentFlushInterval, int maxBufferThreads)
{
this.Name = name;
this.MaxBufferSize = maxBufferSize;
this.MaxFlushSize = maxFlushSize;
this.UrgentFlushThreshold = urgentFlushThreshold;
this.RegularFlushInterval = regularFlushInterval;
this.UrgentFlushInterval = urgentFlushInterval;
this.MaxBufferThreads = maxBufferThreads;
}
[MonoTODO("Should do some validation here")]
static void ValidateElement (object o)
{
/* XXX do some sort of element validation here? */
}
protected internal override ConfigurationElementProperty ElementProperty {
get { return elementProperty; }
}
[TypeConverter (typeof (InfiniteIntConverter))]
[IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue)]
[ConfigurationProperty ("maxBufferSize", DefaultValue = "2147483647", Options = ConfigurationPropertyOptions.IsRequired)]
public int MaxBufferSize {
get { return (int) base [maxBufferSizeProp];}
set { base[maxBufferSizeProp] = value; }
}
[TypeConverter (typeof (InfiniteIntConverter))]
[IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue)]
[ConfigurationProperty ("maxBufferThreads", DefaultValue = "1")]
public int MaxBufferThreads {
get { return (int) base [maxBufferThreadsProp];}
set { base[maxBufferThreadsProp] = value; }
}
[TypeConverter (typeof (InfiniteIntConverter))]
[IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue)]
[ConfigurationProperty ("maxFlushSize", DefaultValue = "2147483647", Options = ConfigurationPropertyOptions.IsRequired)]
public int MaxFlushSize {
get { return (int) base [maxFlushSizeProp];}
set { base[maxFlushSizeProp] = value; }
}
[StringValidator (MinLength = 1)]
[ConfigurationProperty ("name", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
public string Name {
get { return (string) base [nameProp];}
set { base[nameProp] = value; }
}
[TypeConverter (typeof (InfiniteTimeSpanConverter))]
[TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
[ConfigurationProperty ("regularFlushInterval", DefaultValue = "00:00:01", Options = ConfigurationPropertyOptions.IsRequired)]
public TimeSpan RegularFlushInterval {
get { return (TimeSpan) base [regularFlushIntervalProp];}
set { base[regularFlushIntervalProp] = value; }
}
[TypeConverter (typeof (InfiniteTimeSpanConverter))]
[ConfigurationProperty ("urgentFlushInterval", DefaultValue = "00:00:00", Options = ConfigurationPropertyOptions.IsRequired)]
public TimeSpan UrgentFlushInterval {
get { return (TimeSpan) base [urgentFlushIntervalProp];}
set { base[urgentFlushIntervalProp] = value; }
}
[TypeConverter (typeof (InfiniteIntConverter))]
[IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue)]
[ConfigurationProperty ("urgentFlushThreshold", DefaultValue = "2147483647", Options = ConfigurationPropertyOptions.IsRequired)]
public int UrgentFlushThreshold {
get { return (int) base [urgentFlushThresholdProp];}
set { base[urgentFlushThresholdProp] = value; }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,89 @@
//
// System.Web.Configuration.BufferModesCollection
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Configuration;
#if NET_2_0
namespace System.Web.Configuration {
[ConfigurationCollection (typeof (BufferModeSettings), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
public sealed class BufferModesCollection : ConfigurationElementCollection
{
static ConfigurationPropertyCollection properties;
static BufferModesCollection ()
{
properties = new ConfigurationPropertyCollection ();
}
public void Add (BufferModeSettings bufferModeSettings)
{
BaseAdd (bufferModeSettings);
}
public void Clear ()
{
BaseClear ();
}
protected override ConfigurationElement CreateNewElement ()
{
return new BufferModeSettings();
}
protected override object GetElementKey (ConfigurationElement element)
{
return ((BufferModeSettings)element).Name;
}
public void Remove (string s)
{
BaseRemove (s);
}
public BufferModeSettings this [int index] {
get { return (BufferModeSettings)BaseGet (index); }
set { if (BaseGet(index) != null) BaseRemoveAt(index); BaseAdd(index, value); }
}
public new BufferModeSettings this [string name] {
get { return (BufferModeSettings) BaseGet (name); }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,112 @@
//
// System.Web.Configuration.BuildProvider
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
// Chris Toshok (toshok@ximian.com)
//
// Copyright (c) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.ComponentModel;
using System.Configuration;
namespace System.Web.Configuration
{
public sealed class BuildProvider : ConfigurationElement {
static ConfigurationProperty extensionProp;
static ConfigurationProperty typeProp;
static ConfigurationPropertyCollection properties;
static BuildProvider ()
{
extensionProp = new ConfigurationProperty ("extension", typeof (string), "",
TypeDescriptor.GetConverter (typeof (string)), PropertyHelper.NonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
typeProp = new ConfigurationProperty ("type", typeof (string), "",
TypeDescriptor.GetConverter (typeof (string)), PropertyHelper.NonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired);
properties = new ConfigurationPropertyCollection();
properties.Add (extensionProp);
properties.Add (typeProp);
}
internal BuildProvider ()
{
}
public BuildProvider (string extension, string type)
{
this.Extension = extension;
this.Type = type;
}
[StringValidator (MinLength = 1)]
[ConfigurationProperty ("extension", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
public string Extension {
get { return (string) base[extensionProp]; }
set {
string ext;
if (!String.IsNullOrEmpty (value))
ext = value.ToLowerInvariant ();
else
ext = value;
base [extensionProp] = ext;
}
}
[StringValidator (MinLength = 1)]
[ConfigurationProperty ("type", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired)]
public string Type {
get { return (string) base[typeProp]; }
set { base[typeProp] = value; }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
public override bool Equals (object provider)
{
BuildProvider p = provider as BuildProvider;
if (p == null)
return false;
return (Extension == p.Extension && Type == p.Type);
}
public override int GetHashCode ()
{
return (Extension.GetHashCode () + Type.GetHashCode ());
}
}
}
#endif // NET_2_0

View File

@ -0,0 +1,139 @@
//
// System.Web.Configuration.BuildProviderCollection
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (c) Copyright 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Configuration;
namespace System.Web.Configuration
{
[ConfigurationCollection (typeof (BuildProvider), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
public sealed class BuildProviderCollection : ConfigurationElementCollection
{
static ConfigurationPropertyCollection props;
static BuildProviderCollection ()
{
//FIXME: add properties
props = new ConfigurationPropertyCollection ();
}
public BuildProviderCollection (): base (CaseInsensitiveComparer.DefaultInvariant)
{
}
public BuildProvider this [int index] {
get { return (BuildProvider) BaseGet (index); }
set { if (BaseGet (index) != null) BaseRemoveAt (index); BaseAdd (index, value); }
}
public new BuildProvider this [string name] {
get {
string ext;
if (!String.IsNullOrEmpty (name))
ext = name.ToLowerInvariant ();
else
ext = name;
return (BuildProvider) BaseGet (ext);
}
}
protected internal override ConfigurationPropertyCollection Properties {
get { return props; }
}
public void Add (BuildProvider buildProvider)
{
BaseAdd (buildProvider);
}
public void Clear ()
{
BaseClear ();
}
public void Remove (string name)
{
BaseRemove (name);
}
public void RemoveAt (int index)
{
BaseRemoveAt (index);
}
protected override ConfigurationElement CreateNewElement ()
{
return new BuildProvider ();
}
protected override object GetElementKey (ConfigurationElement element)
{
BuildProvider prov = (BuildProvider) element;
return prov.Extension;
}
internal Type GetProviderTypeForExtension (string extension)
{
#if NET_4_0
return global::System.Web.Compilation.BuildProvider.GetProviderTypeForExtension (extension);
#else
if (String.IsNullOrEmpty (extension))
return null;
BuildProvider provider = this [extension];
if (provider == null)
return null;
Type type = HttpApplication.LoadType (provider.Type);
if (type == null)
return null;
return type;
#endif
}
internal global::System.Web.Compilation.BuildProvider GetProviderInstanceForExtension (string extension)
{
#if NET_4_0
return global::System.Web.Compilation.BuildProvider.GetProviderInstanceForExtension (extension);
#else
Type type = GetProviderTypeForExtension (extension);
if (type == null)
return null;
return Activator.CreateInstance (type, null) as global::System.Web.Compilation.BuildProvider;
#endif
}
}
}

View File

@ -0,0 +1,119 @@
//
// System.Web.Configuration.CacheSection
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.ComponentModel;
using System.Configuration;
#if NET_2_0
namespace System.Web.Configuration {
public sealed class CacheSection : ConfigurationSection
{
static ConfigurationProperty disableExpirationProp;
static ConfigurationProperty disableMemoryCollectionProp;
static ConfigurationProperty percentagePhysicalMemoryUsedLimitProp;
static ConfigurationProperty privateBytesLimitProp;
static ConfigurationProperty privateBytesPollTimeProp;
static ConfigurationPropertyCollection properties;
static CacheSection ()
{
disableExpirationProp = new ConfigurationProperty("disableExpiration", typeof (bool), false);
disableMemoryCollectionProp = new ConfigurationProperty("disableMemoryCollection", typeof (bool), false);
percentagePhysicalMemoryUsedLimitProp = new ConfigurationProperty("percentagePhysicalMemoryUsedLimit",
typeof (int), 0,
TypeDescriptor.GetConverter (typeof (int)),
PropertyHelper.IntFromZeroToMaxValidator,
ConfigurationPropertyOptions.None);
privateBytesLimitProp = new ConfigurationProperty("privateBytesLimit", typeof (long), 0L,
TypeDescriptor.GetConverter (typeof (long)),
new LongValidator (0, Int64.MaxValue),
ConfigurationPropertyOptions.None);
privateBytesPollTimeProp = new ConfigurationProperty("privateBytesPollTime",
typeof (TimeSpan),
TimeSpan.FromMinutes (2),
PropertyHelper.InfiniteTimeSpanConverter,
PropertyHelper.PositiveTimeSpanValidator,
ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection();
properties.Add (disableExpirationProp);
properties.Add (disableMemoryCollectionProp);
properties.Add (percentagePhysicalMemoryUsedLimitProp);
properties.Add (privateBytesLimitProp);
properties.Add (privateBytesPollTimeProp);
}
[ConfigurationProperty ("disableExpiration", DefaultValue = "False")]
public bool DisableExpiration {
get { return (bool) base [disableExpirationProp];}
set { base[disableExpirationProp] = value; }
}
[ConfigurationProperty ("disableMemoryCollection", DefaultValue = "False")]
public bool DisableMemoryCollection {
get { return (bool) base [disableMemoryCollectionProp];}
set { base[disableMemoryCollectionProp] = value; }
}
[IntegerValidator (MinValue = 0, MaxValue = 100)]
[ConfigurationProperty ("percentagePhysicalMemoryUsedLimit", DefaultValue = "0")]
public int PercentagePhysicalMemoryUsedLimit {
get { return (int) base [percentagePhysicalMemoryUsedLimitProp];}
set { base[percentagePhysicalMemoryUsedLimitProp] = value; }
}
[LongValidator (MinValue = (long) 0, MaxValue = Int64.MaxValue)]
[ConfigurationProperty ("privateBytesLimit", DefaultValue = "0")]
public long PrivateBytesLimit {
get { return (long) base [privateBytesLimitProp];}
set { base[privateBytesLimitProp] = value; }
}
[TypeConverter (typeof (InfiniteTimeSpanConverter))]
[ConfigurationProperty ("privateBytesPollTime", DefaultValue = "00:02:00")]
// LAMESPEC: MS lists no validator here but provides one in Properties.
public TimeSpan PrivateBytesPollTime {
get { return (TimeSpan) base [privateBytesPollTimeProp];}
set { base[privateBytesPollTimeProp] = value; }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,79 @@
#if NET_2_0
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace System.Web.Configuration
{
using System;
using System.Collections.Generic;
using System.Text;
internal abstract class CapabilitiesBuild : ICapabilitiesProcess
{
/// <summary>
///
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
protected abstract System.Collections.ObjectModel.Collection<string> HeaderNames(System.Collections.ObjectModel.Collection<string> list);
/// <summary>
///
/// </summary>
/// <param name="userAgent"></param>
/// <param name="initialCapabilities"></param>
/// <returns></returns>
public System.Web.Configuration.CapabilitiesResult Process(string userAgent, System.Collections.IDictionary initialCapabilities)
{
System.Collections.Specialized.NameValueCollection header;
header = new System.Collections.Specialized.NameValueCollection(1);
header.Add("User-Agent", userAgent);
return Process(header, initialCapabilities);
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="initialCapabilities"></param>
/// <returns></returns>
public System.Web.Configuration.CapabilitiesResult Process(System.Web.HttpRequest request, System.Collections.IDictionary initialCapabilities)
{
if (request != null)
{
return Process(request.Headers, initialCapabilities);
}
else
{
return Process("", initialCapabilities);
}
}
/// <summary>
///
/// </summary>
/// <param name="header"></param>
/// <param name="initialCapabilities"></param>
/// <returns></returns>
public abstract System.Web.Configuration.CapabilitiesResult Process(System.Collections.Specialized.NameValueCollection header, System.Collections.IDictionary initialCapabilities);
}
}
#endif

View File

@ -0,0 +1,133 @@
#if NET_2_0
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace System.Web.Configuration
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.IO;
internal class CapabilitiesResult : System.Web.HttpBrowserCapabilities
{
/// <summary>
/// Initializes a new instance of the Result class.
/// </summary>
/// <param name="items">
/// This is the data which this class will be handle request made though this class.
/// </param>
internal CapabilitiesResult(System.Collections.IDictionary items)
: base()
{
base.Capabilities = items;
Capabilities ["browsers"] = new ArrayList ();
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <param name="value"></param>
internal void AddCapabilities(string name, string value)
{
this.Capabilities[name] = value;
}
internal void AddMatchingBrowserId (string id)
{
ArrayList al = Capabilities ["browsers"] as ArrayList;
if (al != null && !al.Contains (id))
al.Add (id);
}
internal virtual string Replace(string item)
{
if (item.IndexOf('$') > -1)
{
//nasty hack to convert regular expression replacement text into Capability item
//which we can use to replace with the actual values they are looking for.
System.Text.RegularExpressions.MatchCollection regxmatch;
regxmatch = System.Text.RegularExpressions.Regex.Matches(item, @"\$\{(?'Capability'\w*)\}");
if (regxmatch.Count == 0)
{
return item;
}
for (int i = 0;i <= regxmatch.Count - 1;i++)
{
if (regxmatch[i].Success == true)
{
string c = regxmatch[i].Result("${Capability}");
item = item.Replace("${" + c + "}", this[c]);
}
}
}
if (item.IndexOf('%') > -1)
{
//nasty hack to convert regular expression replacement text into Capability item
//which we can use to replace with the actual values they are looking for.
System.Text.RegularExpressions.MatchCollection regxmatch;
regxmatch = System.Text.RegularExpressions.Regex.Matches(item, @"\%\{(?'Capability'\w*)\}");
if (regxmatch.Count == 0)
{
return item;
}
for (int i = 0;i <= regxmatch.Count - 1;i++)
{
if (regxmatch[i].Success == true)
{
string c = regxmatch[i].Result("${Capability}");
item = item.Replace("%{" + c + "}", this[c]);
}
}
}
return item;
}
/// <summary>
/// Gets the keys returned from processing.
/// </summary>
public System.Collections.Specialized.StringCollection Keys
{
get
{
string[] a = new string[this.Capabilities.Keys.Count];
this.Capabilities.Keys.CopyTo(a, 0);
System.Array.Sort(a);
System.Collections.Specialized.StringCollection l;
l = new System.Collections.Specialized.StringCollection();
l.AddRange(a);
return l;
}
}
public string UserAgent
{
get
{
return this[""];
}
}
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
//
// System.Web.Configuration.ClientTarget
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.ComponentModel;
using System.Configuration;
#if NET_2_0
namespace System.Web.Configuration {
public sealed class ClientTarget : ConfigurationElement
{
static ConfigurationProperty aliasProp;
static ConfigurationProperty userAgentProp;
static ConfigurationPropertyCollection properties;
static ClientTarget ()
{
aliasProp = new ConfigurationProperty ("alias", typeof (string), null,
TypeDescriptor.GetConverter (typeof (string)),
PropertyHelper.NonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
userAgentProp = new ConfigurationProperty ("userAgent", typeof (string), null,
TypeDescriptor.GetConverter (typeof (string)),
PropertyHelper.NonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired);
properties = new ConfigurationPropertyCollection ();
properties.Add (aliasProp);
properties.Add (userAgentProp);
}
public ClientTarget (string alias, string userAgent)
{
this.Alias = alias;
this.UserAgent = userAgent;
}
[StringValidator (MinLength = 1)]
[ConfigurationProperty ("alias", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
public string Alias {
get { return (string) base [aliasProp]; }
internal set { base [aliasProp] = value; }
}
[StringValidator (MinLength = 1)]
[ConfigurationProperty ("userAgent", Options = ConfigurationPropertyOptions.IsRequired)]
public string UserAgent {
get { return (string) base [userAgentProp]; }
internal set { base [userAgentProp] = value; }
}
protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More