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
- LoadMessageLogger.cs
- GradientStopCollection.cs
- DataKey.cs
- InvokeAction.cs
- RegexBoyerMoore.cs
- ListSortDescriptionCollection.cs
- EntityDataSourceReferenceGroup.cs
- SiteMembershipCondition.cs
- ByteAnimationUsingKeyFrames.cs
- GenericXmlSecurityToken.cs
- WindowsSspiNegotiation.cs
- UInt16Storage.cs
- UserPersonalizationStateInfo.cs
- SessionStateItemCollection.cs
- IndentTextWriter.cs
- WsatAdminException.cs
- ListBindableAttribute.cs
- Globals.cs
- QueryOutputWriter.cs
- ConcurrencyMode.cs
- LayoutEditorPart.cs
- FatalException.cs
- mongolianshape.cs
- PointValueSerializer.cs
- AffineTransform3D.cs
- PerfService.cs
- BindingExpressionBase.cs
- UDPClient.cs
- FlowLayout.cs
- WebServicesDescriptionAttribute.cs
- ReadOnlyHierarchicalDataSource.cs
- Axis.cs
- XPathConvert.cs
- DtrList.cs
- Command.cs
- DataGridColumnCollection.cs
- OuterGlowBitmapEffect.cs
- D3DImage.cs
- DateTimeConverter2.cs
- RegexGroup.cs
- MultiBinding.cs
- Encoder.cs
- Dispatcher.cs
- WebServiceHandlerFactory.cs
- ProfileEventArgs.cs
- AssociationType.cs
- Accessible.cs
- MDIWindowDialog.cs
- DesignerAutoFormat.cs
- TypeDescriptionProvider.cs
- Point3DCollection.cs
- MaskInputRejectedEventArgs.cs
- Brush.cs
- CustomAttributeSerializer.cs
- DispatcherExceptionEventArgs.cs
- EntitySqlQueryCacheKey.cs
- TimeSpanStorage.cs
- Transform.cs
- ThreadTrace.cs
- DrawingAttributeSerializer.cs
- ListenerElementsCollection.cs
- ToolStripRenderEventArgs.cs
- DataGridViewRowEventArgs.cs
- AnimationClockResource.cs
- Timeline.cs
- BypassElement.cs
- RuntimeWrappedException.cs
- SmtpReplyReaderFactory.cs
- Vector3dCollection.cs
- CollectionConverter.cs
- DictionaryCustomTypeDescriptor.cs
- RepeatBehaviorConverter.cs
- EntityViewGenerationAttribute.cs
- XmlUTF8TextWriter.cs
- FontStyles.cs
- PermissionSetEnumerator.cs
- ThreadStaticAttribute.cs
- FullTextState.cs
- SetStateEventArgs.cs
- RootBrowserWindowAutomationPeer.cs
- SecurityTokenRequirement.cs
- ValueType.cs
- StaticResourceExtension.cs
- UnsafeNetInfoNativeMethods.cs
- ResourceAttributes.cs
- CodeCatchClauseCollection.cs
- RenderDataDrawingContext.cs
- StackOverflowException.cs
- TypeLoadException.cs
- COMException.cs
- DataGridViewCellEventArgs.cs
- Adorner.cs
- backend.cs
- GraphicsPathIterator.cs
- OneWayChannelFactory.cs
- DiffuseMaterial.cs
- FixedHyperLink.cs
- BooleanKeyFrameCollection.cs
- SimpleHandlerBuildProvider.cs
- PropertyKey.cs