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

@@ -0,0 +1,79 @@
//------------------------------------------------------------------------------
// <copyright file="Converter.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Web;
public class Converter : ConfigurationElement {
private static TypeConverter _whiteSpaceTrimStringConverter =
new WhiteSpaceTrimStringConverter();
private static ConfigurationValidatorBase _nonEmptyStringValidator =
new StringValidator(1);
private static readonly ConfigurationProperty _propType =
new ConfigurationProperty("type",
typeof(string),
null,
_whiteSpaceTrimStringConverter,
_nonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired);
private static readonly ConfigurationProperty _propName =
new ConfigurationProperty("name",
typeof(string),
null,
_whiteSpaceTrimStringConverter,
_nonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
private static ConfigurationPropertyCollection _properties = BuildProperties();
private static ConfigurationPropertyCollection BuildProperties() {
ConfigurationPropertyCollection props = new ConfigurationPropertyCollection();
props.Add(_propType);
props.Add(_propName);
return props;
}
[SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")]
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
[ConfigurationProperty("type", IsRequired = true, DefaultValue = "")]
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods",
Justification = "Refers to a script element, not Object.GetType()")]
[StringValidator(MinLength = 1)]
public string Type {
get {
return (string)base[_propType];
}
set {
base[_propType] = value;
}
}
[ConfigurationProperty("name", IsRequired = true, IsKey = true, DefaultValue = "")]
[StringValidator(MinLength = 1)]
public string Name {
get {
return (string)base[_propName];
}
set {
base[_propName] = value;
}
}
}
}

View File

@@ -0,0 +1,95 @@
//------------------------------------------------------------------------------
// <copyright file="ConvertersCollection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Web;
using System.Web.Compilation;
using System.Web.Resources;
using System.Web.Script.Serialization;
using System.Security;
[
ConfigurationCollection(typeof(Converter)),
SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface",
Justification="Derives from legacy collection base class. Base method IsReadOnly() " +
"would clash with property ICollection<T>.IsReadOnly.")
]
public class ConvertersCollection : ConfigurationElementCollection {
private static readonly ConfigurationPropertyCollection _properties =
new ConfigurationPropertyCollection();
public ConvertersCollection() {
}
[SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")]
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
public Converter this[int index] {
get {
return (Converter)BaseGet(index);
}
set {
if (BaseGet(index) != null) {
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
public void Add(Converter converter) {
BaseAdd(converter);
}
public void Remove(Converter converter) {
BaseRemove(GetElementKey(converter));
}
public void Clear() {
BaseClear();
}
[SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")]
protected override ConfigurationElement CreateNewElement() {
return new Converter();
}
[SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")]
protected override Object GetElementKey(ConfigurationElement element) {
return ((Converter)element).Name;
}
[SecuritySafeCritical]
internal JavaScriptConverter[] CreateConverters() {
List<JavaScriptConverter> list = new List<JavaScriptConverter>();
foreach (Converter converter in this) {
Type t = BuildManager.GetType(converter.Type, false /*throwOnError*/);
if (t == null) {
throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.ConvertersCollection_UnknownType, converter.Type));
}
if (!typeof(JavaScriptConverter).IsAssignableFrom(t)) {
throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.ConvertersCollection_NotJavaScriptConverter, t.Name));
}
list.Add((JavaScriptConverter)Activator.CreateInstance(t));
}
return list.ToArray();
}
}
}

View File

@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------
// <copyright file="ScriptingAuthenticationServiceSection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Web;
using System.Web.Configuration;
public sealed class ScriptingAuthenticationServiceSection : ConfigurationSection {
private static readonly ConfigurationProperty _propEnabled =
new ConfigurationProperty("enabled",
typeof(bool),
false);
private static readonly ConfigurationProperty _propRequireSSL =
new ConfigurationProperty("requireSSL",
typeof(bool),
false);
private static ConfigurationPropertyCollection _properties = BuildProperties();
private static ConfigurationPropertyCollection BuildProperties() {
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
properties.Add(_propEnabled);
properties.Add(_propRequireSSL);
return properties;
}
internal static ScriptingAuthenticationServiceSection GetConfigurationSection() {
return (ScriptingAuthenticationServiceSection)WebConfigurationManager.GetWebApplicationSection("system.web.extensions/scripting/webServices/authenticationService");
}
protected override ConfigurationPropertyCollection Properties {
get { return _properties; }
}
[ConfigurationProperty("enabled", DefaultValue = false)]
public bool Enabled {
get { return (bool)this[_propEnabled]; }
set { this[_propEnabled] = value; }
}
[ConfigurationProperty("requireSSL", DefaultValue = false)]
public bool RequireSSL {
get { return (bool) this[_propRequireSSL]; }
set { this[_propRequireSSL] = value; }
}
}
}

View File

@@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// <copyright file="ScriptingJsonSerializationSection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Web;
using System.Web.Configuration;
using System.Web.Script.Serialization;
public sealed class ScriptingJsonSerializationSection : ConfigurationSection {
private static readonly ConfigurationProperty _propConverters =
new ConfigurationProperty("converters",
typeof(ConvertersCollection),
null,
ConfigurationPropertyOptions.IsDefaultCollection);
private static readonly ConfigurationProperty _propRecursionLimitLimit =
new ConfigurationProperty("recursionLimit",
typeof(int),
100,
null,
new IntegerValidator(1, int.MaxValue),
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propMaxJsonLength =
new ConfigurationProperty("maxJsonLength",
typeof(int),
102400,
null,
new IntegerValidator(1, int.MaxValue),
ConfigurationPropertyOptions.None);
private static ConfigurationPropertyCollection _properties = BuildProperties();
private static ConfigurationPropertyCollection BuildProperties() {
ConfigurationPropertyCollection props = new ConfigurationPropertyCollection();
props.Add(_propConverters);
props.Add(_propRecursionLimitLimit);
props.Add(_propMaxJsonLength);
return props;
}
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
[ConfigurationProperty("converters", IsKey = true, DefaultValue = "")]
public ConvertersCollection Converters {
get {
return (ConvertersCollection)base[_propConverters];
}
}
[ConfigurationProperty("recursionLimit", DefaultValue = 100)]
public int RecursionLimit {
get {
return (int)base[_propRecursionLimitLimit];
}
set {
base[_propRecursionLimitLimit] = value;
}
}
[ConfigurationProperty("maxJsonLength", DefaultValue = 102400)]
public int MaxJsonLength {
get {
return (int)base[_propMaxJsonLength];
}
set {
base[_propMaxJsonLength] = value;
}
}
internal class ApplicationSettings {
private int _recusionLimit;
private int _maxJsonLimit;
private JavaScriptConverter[] _converters;
internal ApplicationSettings() {
#pragma warning disable 0436
ScriptingJsonSerializationSection section = (ScriptingJsonSerializationSection)
WebConfigurationManager.GetSection("system.web.extensions/scripting/webServices/jsonSerialization");
#pragma warning restore 0436
if (section != null) {
_recusionLimit = section.RecursionLimit;
_maxJsonLimit = section.MaxJsonLength;
_converters = section.Converters.CreateConverters();
}
else {
_recusionLimit = (int)_propRecursionLimitLimit.DefaultValue;
_maxJsonLimit = (int)_propMaxJsonLength.DefaultValue;
_converters = new JavaScriptConverter[0];
}
}
internal int RecursionLimit {
get {
return _recusionLimit;
}
}
internal int MaxJsonLimit {
get {
return _maxJsonLimit;
}
}
internal JavaScriptConverter[] Converters {
get {
return _converters;
}
}
}
}
}

View File

@@ -0,0 +1,89 @@
//------------------------------------------------------------------------------
// <copyright file="ScriptingProfileServiceSection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Web;
using System.Web.Configuration;
public sealed class ScriptingProfileServiceSection : ConfigurationSection {
private static readonly ConfigurationProperty _propEnabled =
new ConfigurationProperty("enabled",
typeof(bool),
false);
private static readonly ConfigurationProperty _propEnableForReading =
new ConfigurationProperty("readAccessProperties",
typeof(String[]),
new string[0], new System.Web.UI.WebControls.StringArrayConverter(), null, ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propEnableForWriting =
new ConfigurationProperty("writeAccessProperties",
typeof(String[]),
new string[0], new System.Web.UI.WebControls.StringArrayConverter(), null, ConfigurationPropertyOptions.None);
private static ConfigurationPropertyCollection _properties = BuildProperties();
private static ConfigurationPropertyCollection BuildProperties() {
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
properties.Add(_propEnabled);
properties.Add(_propEnableForReading);
properties.Add(_propEnableForWriting);
return properties;
}
#pragma warning disable 0436
internal static ScriptingProfileServiceSection GetConfigurationSection() {
return (ScriptingProfileServiceSection)WebConfigurationManager.GetWebApplicationSection("system.web.extensions/scripting/webServices/profileService");
}
#pragma warning restore 0436
protected override ConfigurationPropertyCollection Properties {
get { return _properties; }
}
[ConfigurationProperty("enabled", DefaultValue = false)]
public bool Enabled {
get { return (bool) this[_propEnabled]; }
set { this[_propEnabled] = value; }
}
[
SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",
Justification = "Base class requires array properties"),
ConfigurationProperty("readAccessProperties", DefaultValue = null)
]
public string[] ReadAccessProperties {
get {
string[] propertiesForReading = (string[])this[_propEnableForReading];
return propertiesForReading == null ? null : (string[]) propertiesForReading.Clone();
}
set {
if(value != null)
value = (string[]) value.Clone();
this[_propEnableForReading] = value;
}
}
[
SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",
Justification="Base class requires array properties"),
ConfigurationProperty("writeAccessProperties", DefaultValue = null)
]
public string[] WriteAccessProperties {
get {
string[] propertiesForWriting = (string[]) this[_propEnableForWriting];
return propertiesForWriting == null ? null : (string[]) propertiesForWriting.Clone();
}
set {
if(value != null)
value = (string[]) value.Clone();
this[_propEnableForWriting] = value;
}
}
}
}

View File

@@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// <copyright file="ScriptingRoleServiceSection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Web;
using System.Web.Configuration;
//
public sealed class ScriptingRoleServiceSection : ConfigurationSection {
private static readonly ConfigurationProperty _propEnabled =
new ConfigurationProperty("enabled",
typeof(bool),
false);
private static ConfigurationPropertyCollection _properties = BuildProperties();
private static ConfigurationPropertyCollection BuildProperties() {
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
properties.Add(_propEnabled);
return properties;
}
internal static ScriptingRoleServiceSection GetConfigurationSection() {
return (ScriptingRoleServiceSection)WebConfigurationManager.GetWebApplicationSection("system.web.extensions/scripting/webServices/roleService");
}
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
[ConfigurationProperty("enabled", DefaultValue = false)]
public bool Enabled {
get {
return (bool)this[_propEnabled];
}
set {
this[_propEnabled] = value;
}
}
}
}

View File

@@ -0,0 +1,100 @@
//------------------------------------------------------------------------------
// <copyright file="ScriptingScriptResourceHandlerSection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Web;
using System.Web.Configuration;
using System.Web.Script.Serialization;
public sealed class ScriptingScriptResourceHandlerSection : ConfigurationSection {
private static readonly ConfigurationProperty _propEnableCaching =
new ConfigurationProperty("enableCaching",
typeof(bool),
true,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propEnableCompression =
new ConfigurationProperty("enableCompression",
typeof(bool),
true,
ConfigurationPropertyOptions.None);
private static ConfigurationPropertyCollection _properties = BuildProperties();
private static ConfigurationPropertyCollection BuildProperties() {
ConfigurationPropertyCollection props = new ConfigurationPropertyCollection();
props.Add(_propEnableCaching);
props.Add(_propEnableCompression);
return props;
}
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
[ConfigurationProperty("enableCaching", DefaultValue = true)]
public bool EnableCaching {
get {
return (bool)base[_propEnableCaching];
}
set {
base[_propEnableCaching] = value;
}
}
[ConfigurationProperty("enableCompression", DefaultValue = true)]
public bool EnableCompression {
get {
return (bool)base[_propEnableCompression];
}
set {
base[_propEnableCompression] = value;
}
}
internal static class ApplicationSettings {
private volatile static bool s_sectionLoaded;
private static bool s_enableCaching;
private static bool s_enableCompression;
private static void EnsureSectionLoaded() {
if (!s_sectionLoaded) {
ScriptingScriptResourceHandlerSection section = (ScriptingScriptResourceHandlerSection)
WebConfigurationManager.GetWebApplicationSection("system.web.extensions/scripting/scriptResourceHandler");
if (section != null) {
s_enableCaching = section.EnableCaching;
s_enableCompression = section.EnableCompression;
}
else {
s_enableCaching = (bool)_propEnableCaching.DefaultValue;
s_enableCompression = (bool)_propEnableCompression.DefaultValue;
}
s_sectionLoaded = true;
}
}
internal static bool EnableCaching {
get {
EnsureSectionLoaded();
return s_enableCaching;
}
}
internal static bool EnableCompression {
get {
EnsureSectionLoaded();
return s_enableCompression;
}
}
}
}
}

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <copyright file="ScriptingSectionGroup.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Web;
public sealed class ScriptingSectionGroup : ConfigurationSectionGroup {
[ConfigurationProperty("webServices")]
#pragma warning disable 0436
public ScriptingWebServicesSectionGroup WebServices {
get {
return (ScriptingWebServicesSectionGroup)SectionGroups["webServices"];
}
}
#pragma warning restore 0436
[ConfigurationProperty("scriptResourceHandler")]
public ScriptingScriptResourceHandlerSection ScriptResourceHandler {
get {
return (ScriptingScriptResourceHandlerSection)Sections["scriptResourceHandler"];
}
}
}
}

View File

@@ -0,0 +1,49 @@
//------------------------------------------------------------------------------
// <copyright file="ScriptingWebServicesSectionGroup.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Web;
public sealed class ScriptingWebServicesSectionGroup : ConfigurationSectionGroup {
[ConfigurationProperty("jsonSerialization")]
#pragma warning disable 0436
public ScriptingJsonSerializationSection JsonSerialization {
get {
return (ScriptingJsonSerializationSection)Sections["jsonSerialization"];
}
}
#pragma warning restore 0436
[ConfigurationProperty("profileService")]
#pragma warning disable 0436
public ScriptingProfileServiceSection ProfileService {
get {
return (ScriptingProfileServiceSection)Sections["profileService"];
}
}
#pragma warning restore 0436
[ConfigurationProperty("authenticationService")]
public ScriptingAuthenticationServiceSection AuthenticationService {
get {
return (ScriptingAuthenticationServiceSection)Sections["authenticationService"];
}
}
[ConfigurationProperty("roleService")]
public ScriptingRoleServiceSection RoleService {
get {
return (ScriptingRoleServiceSection)Sections["roleService"];
}
}
}
}

View File

@@ -0,0 +1,21 @@
//------------------------------------------------------------------------------
// <copyright file="SystemWebExtensionsSectionGroup.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Configuration;
using System.Web;
public sealed class SystemWebExtensionsSectionGroup : ConfigurationSectionGroup {
[ConfigurationProperty("scripting")]
public ScriptingSectionGroup Scripting {
get {
return (ScriptingSectionGroup)SectionGroups["scripting"];
}
}
}
}