Code:
/ 4.0 / 4.0 / untmp / 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)
{
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
- FrameworkContextData.cs
- Task.cs
- StorageBasedPackageProperties.cs
- MediaEntryAttribute.cs
- PointAnimationUsingPath.cs
- _SafeNetHandles.cs
- QueryStringParameter.cs
- FlowDocumentFormatter.cs
- ActiveDocumentEvent.cs
- DSACryptoServiceProvider.cs
- LazyTextWriterCreator.cs
- RtfToken.cs
- SoapElementAttribute.cs
- AdCreatedEventArgs.cs
- TextEditorTables.cs
- Vector3dCollection.cs
- WebPartConnectionsCancelEventArgs.cs
- LayoutSettings.cs
- CalendarDateChangedEventArgs.cs
- RangeValidator.cs
- BrushValueSerializer.cs
- Expander.cs
- SequenceDesigner.cs
- XmlText.cs
- TypeForwardedToAttribute.cs
- IndexOutOfRangeException.cs
- InheritanceAttribute.cs
- EdmSchemaAttribute.cs
- NumericUpDownAcceleration.cs
- XmlCharacterData.cs
- SmiEventSink_DeferedProcessing.cs
- SemaphoreFullException.cs
- AnnotationService.cs
- GenerateScriptTypeAttribute.cs
- _DigestClient.cs
- TransformerInfo.cs
- Journaling.cs
- HttpPostClientProtocol.cs
- CompositeTypefaceMetrics.cs
- AppSettingsReader.cs
- ReadOnlyDataSourceView.cs
- Light.cs
- XmlAggregates.cs
- ProviderIncompatibleException.cs
- GroupItem.cs
- TemplateBindingExpressionConverter.cs
- DateTimeOffset.cs
- TimerExtension.cs
- EventWaitHandle.cs
- OdbcConnection.cs
- ByteStack.cs
- CodeTypeDeclarationCollection.cs
- UInt32Storage.cs
- PatternMatchRules.cs
- SequentialUshortCollection.cs
- UTF8Encoding.cs
- PnrpPeerResolverBindingElement.cs
- IdnElement.cs
- GenerateScriptTypeAttribute.cs
- DropSource.cs
- BitmapFrameDecode.cs
- RemotingException.cs
- ObjectViewQueryResultData.cs
- HtmlMeta.cs
- RightNameExpirationInfoPair.cs
- LoadWorkflowAsyncResult.cs
- SaveRecipientRequest.cs
- DiscoveryDocument.cs
- WebBrowserNavigatingEventHandler.cs
- DictionaryBase.cs
- WebPartUtil.cs
- MetadataPropertyvalue.cs
- TextEncodedRawTextWriter.cs
- XmlUrlEditor.cs
- VirtualPath.cs
- CompareInfo.cs
- ViewGenerator.cs
- AttributeQuery.cs
- BoundConstants.cs
- TextSegment.cs
- DisplayMemberTemplateSelector.cs
- DataConnectionHelper.cs
- CodeArgumentReferenceExpression.cs
- CatalogUtil.cs
- ThemeDirectoryCompiler.cs
- FastPropertyAccessor.cs
- StringToken.cs
- ISFClipboardData.cs
- PolicyManager.cs
- GeneralTransform3DCollection.cs
- GridEntry.cs
- SafeSecurityHelper.cs
- WhileDesigner.cs
- BaseCodePageEncoding.cs
- Geometry.cs
- PromptEventArgs.cs
- X509KeyIdentifierClauseType.cs
- ConfigurationStrings.cs
- DirectoryInfo.cs
- FontUnit.cs