Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / security / system / security / authentication / ExtendedProtection / configuration / ExtendedProtectionPolicyElement.cs / 1305376 / ExtendedProtectionPolicyElement.cs
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Collections.Generic; using System.Configuration; namespace System.Security.Authentication.ExtendedProtection.Configuration { public sealed class ExtendedProtectionPolicyElement : ConfigurationElement { public ExtendedProtectionPolicyElement() { this.properties.Add(this.policyEnforcement); this.properties.Add(this.protectionScenario); this.properties.Add(this.customServiceNames); } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } [ConfigurationProperty(ExtendedProtectionConfigurationStrings.PolicyEnforcement)] public PolicyEnforcement PolicyEnforcement { get { return (PolicyEnforcement)this[this.policyEnforcement]; } set { this[this.policyEnforcement] = value; } } [ConfigurationProperty(ExtendedProtectionConfigurationStrings.ProtectionScenario, DefaultValue=ProtectionScenario.TransportSelected)] public ProtectionScenario ProtectionScenario { get { return (ProtectionScenario)this[this.protectionScenario]; } set { this[this.protectionScenario] = value; } } [ConfigurationProperty(ExtendedProtectionConfigurationStrings.CustomServiceNames)] public ServiceNameElementCollection CustomServiceNames { get { return (ServiceNameElementCollection)this[this.customServiceNames]; } } public ExtendedProtectionPolicy BuildPolicy() { if (PolicyEnforcement == PolicyEnforcement.Never) { return new ExtendedProtectionPolicy(PolicyEnforcement.Never); } ServiceNameCollection spns = null; ServiceNameElementCollection spnCollection = CustomServiceNames; if (spnCollection != null && spnCollection.Count > 0) { ListspnList = new List (spnCollection.Count); foreach (ServiceNameElement element in spnCollection) { spnList.Add(element.Name); } spns = new ServiceNameCollection(spnList); } return new ExtendedProtectionPolicy(PolicyEnforcement, ProtectionScenario, spns); } ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); private static PolicyEnforcement DefaultPolicyEnforcement { get { return PolicyEnforcement.Never; } } readonly ConfigurationProperty policyEnforcement = new ConfigurationProperty(ExtendedProtectionConfigurationStrings.PolicyEnforcement, typeof(PolicyEnforcement), DefaultPolicyEnforcement, ConfigurationPropertyOptions.None); readonly ConfigurationProperty protectionScenario = new ConfigurationProperty(ExtendedProtectionConfigurationStrings.ProtectionScenario, typeof(ProtectionScenario), ProtectionScenario.TransportSelected, ConfigurationPropertyOptions.None); readonly ConfigurationProperty customServiceNames = new ConfigurationProperty(ExtendedProtectionConfigurationStrings.CustomServiceNames, typeof(ServiceNameElementCollection), null, ConfigurationPropertyOptions.None); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Collections.Generic; using System.Configuration; namespace System.Security.Authentication.ExtendedProtection.Configuration { public sealed class ExtendedProtectionPolicyElement : ConfigurationElement { public ExtendedProtectionPolicyElement() { this.properties.Add(this.policyEnforcement); this.properties.Add(this.protectionScenario); this.properties.Add(this.customServiceNames); } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } [ConfigurationProperty(ExtendedProtectionConfigurationStrings.PolicyEnforcement)] public PolicyEnforcement PolicyEnforcement { get { return (PolicyEnforcement)this[this.policyEnforcement]; } set { this[this.policyEnforcement] = value; } } [ConfigurationProperty(ExtendedProtectionConfigurationStrings.ProtectionScenario, DefaultValue=ProtectionScenario.TransportSelected)] public ProtectionScenario ProtectionScenario { get { return (ProtectionScenario)this[this.protectionScenario]; } set { this[this.protectionScenario] = value; } } [ConfigurationProperty(ExtendedProtectionConfigurationStrings.CustomServiceNames)] public ServiceNameElementCollection CustomServiceNames { get { return (ServiceNameElementCollection)this[this.customServiceNames]; } } public ExtendedProtectionPolicy BuildPolicy() { if (PolicyEnforcement == PolicyEnforcement.Never) { return new ExtendedProtectionPolicy(PolicyEnforcement.Never); } ServiceNameCollection spns = null; ServiceNameElementCollection spnCollection = CustomServiceNames; if (spnCollection != null && spnCollection.Count > 0) { List spnList = new List (spnCollection.Count); foreach (ServiceNameElement element in spnCollection) { spnList.Add(element.Name); } spns = new ServiceNameCollection(spnList); } return new ExtendedProtectionPolicy(PolicyEnforcement, ProtectionScenario, spns); } ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); private static PolicyEnforcement DefaultPolicyEnforcement { get { return PolicyEnforcement.Never; } } readonly ConfigurationProperty policyEnforcement = new ConfigurationProperty(ExtendedProtectionConfigurationStrings.PolicyEnforcement, typeof(PolicyEnforcement), DefaultPolicyEnforcement, ConfigurationPropertyOptions.None); readonly ConfigurationProperty protectionScenario = new ConfigurationProperty(ExtendedProtectionConfigurationStrings.ProtectionScenario, typeof(ProtectionScenario), ProtectionScenario.TransportSelected, ConfigurationPropertyOptions.None); readonly ConfigurationProperty customServiceNames = new ConfigurationProperty(ExtendedProtectionConfigurationStrings.CustomServiceNames, typeof(ServiceNameElementCollection), null, ConfigurationPropertyOptions.None); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RepeaterItemEventArgs.cs
- StoreAnnotationsMap.cs
- DesignConnection.cs
- FormatterConverter.cs
- EdmConstants.cs
- NavigationExpr.cs
- DataGridViewCellCancelEventArgs.cs
- WindowsTokenRoleProvider.cs
- TypefaceCollection.cs
- GeometryDrawing.cs
- HtmlElementErrorEventArgs.cs
- Reference.cs
- UrlAuthFailedErrorFormatter.cs
- StandardCommands.cs
- RemoteWebConfigurationHostStream.cs
- ValueHandle.cs
- TdsParserStaticMethods.cs
- CodePageEncoding.cs
- SymbolType.cs
- SQLResource.cs
- BaseInfoTable.cs
- DataGridViewRowConverter.cs
- EntityDataSourceDataSelectionPanel.cs
- OrderPreservingMergeHelper.cs
- CounterSetInstance.cs
- _SslStream.cs
- Parameter.cs
- VideoDrawing.cs
- SafeRightsManagementHandle.cs
- XmlDomTextWriter.cs
- XamlParser.cs
- SharedRuntimeState.cs
- ScriptManagerProxy.cs
- Glyph.cs
- AppDomainAttributes.cs
- _PooledStream.cs
- URLMembershipCondition.cs
- SvcMapFile.cs
- oledbmetadatacollectionnames.cs
- HttpDictionary.cs
- SiteMapDataSourceView.cs
- TextBox.cs
- ExtentCqlBlock.cs
- Viewport3DVisual.cs
- PseudoWebRequest.cs
- AspNetHostingPermission.cs
- X509SecurityTokenAuthenticator.cs
- KeyManager.cs
- SqlDataReader.cs
- GroupPartitionExpr.cs
- GenericEnumerator.cs
- CodeRegionDirective.cs
- UniqueEventHelper.cs
- IChannel.cs
- ComplexTypeEmitter.cs
- ImmutableDispatchRuntime.cs
- BeginStoryboard.cs
- DataKeyPropertyAttribute.cs
- DataBindingExpressionBuilder.cs
- DateTimeStorage.cs
- MethodToken.cs
- GeneratedCodeAttribute.cs
- FacetEnabledSchemaElement.cs
- Scanner.cs
- NumericExpr.cs
- OleDbPropertySetGuid.cs
- BindingExpressionBase.cs
- ConfigurationPermission.cs
- CompilerState.cs
- IISUnsafeMethods.cs
- ColorMap.cs
- PerfCounterSection.cs
- Literal.cs
- TextLineBreak.cs
- Menu.cs
- SurrogateEncoder.cs
- PriorityBinding.cs
- Attributes.cs
- DocumentOrderQuery.cs
- ToolStrip.cs
- ScriptMethodAttribute.cs
- SqlNotificationEventArgs.cs
- DocumentCollection.cs
- DataObjectAttribute.cs
- TypeDescriptionProviderAttribute.cs
- MediaScriptCommandRoutedEventArgs.cs
- SelectorItemAutomationPeer.cs
- StreamWriter.cs
- AssemblyResourceLoader.cs
- UnknownMessageReceivedEventArgs.cs
- TripleDES.cs
- CallTemplateAction.cs
- FontResourceCache.cs
- HttpContextWrapper.cs
- DataObject.cs
- Overlapped.cs
- Cursors.cs
- IIS7UserPrincipal.cs
- ProgressBarBrushConverter.cs
- RecipientInfo.cs