Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / security / system / security / authentication / ExtendedProtection / ExtendedProtectionPolicy.cs / 1 / ExtendedProtectionPolicy.cs
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Security.Authentication.ExtendedProtection; using System.Text; namespace System.Security.Authentication.ExtendedProtection { ////// This class contains the necessary settings for specifying how Extended Protection /// should behave. Use one of the Build* methods to create an instance of this type. /// public class ExtendedProtectionPolicy { private ServiceNameCollection customServiceNames; private PolicyEnforcement policyEnforcement; private ProtectionScenario protectionScenario; private ChannelBinding customChannelBinding; public ExtendedProtectionPolicy(PolicyEnforcement policyEnforcement, ProtectionScenario protectionScenario, ServiceNameCollection customServiceNames) { if (policyEnforcement == PolicyEnforcement.Never) { throw new ArgumentException(SR.GetString(SR.security_ExtendedProtectionPolicy_UseDifferentConstructorForNever), "policyEnforcement"); } if (customServiceNames != null && customServiceNames.Count == 0) { throw new ArgumentException(SR.GetString(SR.security_ExtendedProtectionPolicy_NoEmptyServiceNameCollection), "customServiceNames"); } this.policyEnforcement = policyEnforcement; this.protectionScenario = protectionScenario; this.customServiceNames = customServiceNames; } public ExtendedProtectionPolicy(PolicyEnforcement policyEnforcement, ChannelBinding customChannelBinding) { if (policyEnforcement == PolicyEnforcement.Never) { throw new ArgumentException(SR.GetString(SR.security_ExtendedProtectionPolicy_UseDifferentConstructorForNever), "policyEnforcement"); } if (customChannelBinding == null) { throw new ArgumentNullException("customChannelBinding"); } this.policyEnforcement = policyEnforcement; this.protectionScenario = ProtectionScenario.TransportSelected; this.customChannelBinding = customChannelBinding; } public ExtendedProtectionPolicy(PolicyEnforcement policyEnforcement) { // this is the only constructor which allows PolicyEnforcement.Never. this.policyEnforcement = policyEnforcement; this.protectionScenario = ProtectionScenario.TransportSelected; } public ServiceNameCollection CustomServiceNames { get { return customServiceNames; } } public PolicyEnforcement PolicyEnforcement { get { return policyEnforcement; } } public ProtectionScenario ProtectionScenario { get { return protectionScenario; } } public ChannelBinding CustomChannelBinding { get { return customChannelBinding; } } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("ProtectionScenario="); sb.Append(protectionScenario.ToString()); sb.Append("; PolicyEnforcement="); sb.Append(policyEnforcement.ToString()); sb.Append("; CustomChannelBinding="); if (customChannelBinding == null) { sb.Append(""); } else { sb.Append(customChannelBinding.ToString()); } sb.Append("; ServiceNames="); if (customServiceNames == null) { sb.Append(" "); } else { bool first = true; foreach (string serviceName in customServiceNames) { if (first) { first = false; } else { sb.Append(", "); } sb.Append(serviceName); } } return sb.ToString(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Security.Authentication.ExtendedProtection; using System.Text; namespace System.Security.Authentication.ExtendedProtection { /// /// This class contains the necessary settings for specifying how Extended Protection /// should behave. Use one of the Build* methods to create an instance of this type. /// public class ExtendedProtectionPolicy { private ServiceNameCollection customServiceNames; private PolicyEnforcement policyEnforcement; private ProtectionScenario protectionScenario; private ChannelBinding customChannelBinding; public ExtendedProtectionPolicy(PolicyEnforcement policyEnforcement, ProtectionScenario protectionScenario, ServiceNameCollection customServiceNames) { if (policyEnforcement == PolicyEnforcement.Never) { throw new ArgumentException(SR.GetString(SR.security_ExtendedProtectionPolicy_UseDifferentConstructorForNever), "policyEnforcement"); } if (customServiceNames != null && customServiceNames.Count == 0) { throw new ArgumentException(SR.GetString(SR.security_ExtendedProtectionPolicy_NoEmptyServiceNameCollection), "customServiceNames"); } this.policyEnforcement = policyEnforcement; this.protectionScenario = protectionScenario; this.customServiceNames = customServiceNames; } public ExtendedProtectionPolicy(PolicyEnforcement policyEnforcement, ChannelBinding customChannelBinding) { if (policyEnforcement == PolicyEnforcement.Never) { throw new ArgumentException(SR.GetString(SR.security_ExtendedProtectionPolicy_UseDifferentConstructorForNever), "policyEnforcement"); } if (customChannelBinding == null) { throw new ArgumentNullException("customChannelBinding"); } this.policyEnforcement = policyEnforcement; this.protectionScenario = ProtectionScenario.TransportSelected; this.customChannelBinding = customChannelBinding; } public ExtendedProtectionPolicy(PolicyEnforcement policyEnforcement) { // this is the only constructor which allows PolicyEnforcement.Never. this.policyEnforcement = policyEnforcement; this.protectionScenario = ProtectionScenario.TransportSelected; } public ServiceNameCollection CustomServiceNames { get { return customServiceNames; } } public PolicyEnforcement PolicyEnforcement { get { return policyEnforcement; } } public ProtectionScenario ProtectionScenario { get { return protectionScenario; } } public ChannelBinding CustomChannelBinding { get { return customChannelBinding; } } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("ProtectionScenario="); sb.Append(protectionScenario.ToString()); sb.Append("; PolicyEnforcement="); sb.Append(policyEnforcement.ToString()); sb.Append("; CustomChannelBinding="); if (customChannelBinding == null) { sb.Append(""); } else { sb.Append(customChannelBinding.ToString()); } sb.Append("; ServiceNames="); if (customServiceNames == null) { sb.Append(" "); } else { bool first = true; foreach (string serviceName in customServiceNames) { if (first) { first = false; } else { sb.Append(", "); } sb.Append(serviceName); } } return sb.ToString(); } } } // 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
- PropertyItemInternal.cs
- DirectoryObjectSecurity.cs
- IdentityReference.cs
- ToolTip.cs
- MetadataImporterQuotas.cs
- EventItfInfo.cs
- HtmlLink.cs
- Environment.cs
- XmlTextWriter.cs
- TextUtf8RawTextWriter.cs
- HorizontalAlignConverter.cs
- DiscoveryRequestHandler.cs
- DiagnosticTraceRecords.cs
- ClassDataContract.cs
- basecomparevalidator.cs
- ProgressChangedEventArgs.cs
- CommandDevice.cs
- DataSourceXmlAttributeAttribute.cs
- PrincipalPermission.cs
- SingleStorage.cs
- OrderByQueryOptionExpression.cs
- IdnElement.cs
- DefaultEventAttribute.cs
- BinaryObjectReader.cs
- AdRotator.cs
- ValidatorUtils.cs
- CompilerState.cs
- MetabaseServerConfig.cs
- DecimalAnimation.cs
- Column.cs
- ProcessModuleCollection.cs
- DirectoryNotFoundException.cs
- CompilerState.cs
- VolatileResourceManager.cs
- FileAuthorizationModule.cs
- BitmapSource.cs
- Drawing.cs
- BitmapEffectOutputConnector.cs
- InitializationEventAttribute.cs
- SchemaLookupTable.cs
- SspiNegotiationTokenProvider.cs
- OleDbInfoMessageEvent.cs
- CodeEntryPointMethod.cs
- ColumnBinding.cs
- FixedSOMImage.cs
- StringDictionaryEditor.cs
- AssemblyBuilder.cs
- SessionPageStatePersister.cs
- ObjectStateFormatter.cs
- OrderedEnumerableRowCollection.cs
- FormConverter.cs
- GridItemPatternIdentifiers.cs
- DtdParser.cs
- IconBitmapDecoder.cs
- PropertyInfo.cs
- XmlName.cs
- SchemaNamespaceManager.cs
- SecurityUtils.cs
- RoleService.cs
- XmlSerializerSection.cs
- DiagnosticTraceSource.cs
- ValidationHelper.cs
- StructuredTypeEmitter.cs
- CryptoConfig.cs
- PeerInvitationResponse.cs
- EncoderFallback.cs
- SessionPageStatePersister.cs
- UnionExpr.cs
- InstallerTypeAttribute.cs
- UnsafeNativeMethods.cs
- HtmlControlDesigner.cs
- OletxEnlistment.cs
- WorkflowDurableInstance.cs
- TraceHwndHost.cs
- DataGridPageChangedEventArgs.cs
- IProducerConsumerCollection.cs
- RemotingException.cs
- ReceiveCompletedEventArgs.cs
- TransformedBitmap.cs
- XPathParser.cs
- SplashScreen.cs
- TypeTypeConverter.cs
- FormViewUpdatedEventArgs.cs
- AddingNewEventArgs.cs
- TemplatedMailWebEventProvider.cs
- GridViewSortEventArgs.cs
- ProxyHwnd.cs
- WmlPhoneCallAdapter.cs
- SendMailErrorEventArgs.cs
- LinearQuaternionKeyFrame.cs
- InputReport.cs
- Point3DKeyFrameCollection.cs
- OutputCacheModule.cs
- LongMinMaxAggregationOperator.cs
- Timeline.cs
- TreeNodeBindingCollection.cs
- CodeMethodInvokeExpression.cs
- RelationshipManager.cs
- XmlNamespaceDeclarationsAttribute.cs
- ViewgenGatekeeper.cs