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
- CatalogPartCollection.cs
- EditorOptionAttribute.cs
- MouseBinding.cs
- CheckBoxRenderer.cs
- Label.cs
- TdsParserSafeHandles.cs
- AdCreatedEventArgs.cs
- DrawingState.cs
- Properties.cs
- ParserHooks.cs
- WsrmMessageInfo.cs
- AddInControllerImpl.cs
- SoapAttributeOverrides.cs
- NamedElement.cs
- MarkupObject.cs
- Table.cs
- RtfControls.cs
- DataGridViewAdvancedBorderStyle.cs
- GeometryCombineModeValidation.cs
- DataPagerFieldCommandEventArgs.cs
- PerformanceCounter.cs
- TemplateModeChangedEventArgs.cs
- PropertyGridEditorPart.cs
- ScalarOps.cs
- ExceptionValidationRule.cs
- TreeNode.cs
- BinaryKeyIdentifierClause.cs
- PassportAuthenticationEventArgs.cs
- HtmlAnchor.cs
- AppSecurityManager.cs
- SafeNativeMethods.cs
- UIElementParagraph.cs
- ProgressiveCrcCalculatingStream.cs
- Base64Stream.cs
- BinaryParser.cs
- FontInfo.cs
- CompositeActivityCodeGenerator.cs
- ConnectionPointCookie.cs
- BaseConfigurationRecord.cs
- DescendantOverDescendantQuery.cs
- PriorityBindingExpression.cs
- ClientSettingsStore.cs
- AliasedSlot.cs
- ConfigurationUtility.cs
- StandardToolWindows.cs
- WebBrowsableAttribute.cs
- XmlDictionaryReader.cs
- BulletedList.cs
- WaitingCursor.cs
- ReadOnlyDataSource.cs
- CompoundFileStreamReference.cs
- ComplusTypeValidator.cs
- Rectangle.cs
- DataGrid.cs
- XmlSchemaSimpleContentExtension.cs
- ArglessEventHandlerProxy.cs
- CodeDomExtensionMethods.cs
- VersionedStream.cs
- FamilyTypefaceCollection.cs
- PageRanges.cs
- DataRowView.cs
- XamlWrappingReader.cs
- Context.cs
- FontStretch.cs
- LicenseException.cs
- regiisutil.cs
- BitmapEffectInput.cs
- CommandEventArgs.cs
- StrongNameHelpers.cs
- EdmItemCollection.cs
- ForceCopyBuildProvider.cs
- PrimitiveDataContract.cs
- StringExpressionSet.cs
- WebServiceData.cs
- CustomTypeDescriptor.cs
- FilterFactory.cs
- safemediahandle.cs
- SqlDataSourceCustomCommandPanel.cs
- XmlDownloadManager.cs
- DataGridViewButtonCell.cs
- AndCondition.cs
- XmlBinaryWriter.cs
- TypeUnloadedException.cs
- XmlDataContract.cs
- SizeValueSerializer.cs
- FormViewRow.cs
- ScalarType.cs
- WeakEventManager.cs
- COM2ExtendedUITypeEditor.cs
- DataGridViewBindingCompleteEventArgs.cs
- HtmlSelect.cs
- RefreshPropertiesAttribute.cs
- PtsPage.cs
- EmptyWorkItem.cs
- Clause.cs
- ParenthesizePropertyNameAttribute.cs
- RC2CryptoServiceProvider.cs
- SqlConnectionFactory.cs
- AbsoluteQuery.cs
- MultitargetingHelpers.cs