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
- Win32.cs
- WebPartMenu.cs
- CookieHandler.cs
- FormView.cs
- CloseSequence.cs
- XmlSchemaInferenceException.cs
- RemotingAttributes.cs
- DefaultConfirmation.cs
- BitmapVisualManager.cs
- DataGridViewCellStyle.cs
- ViewStateModeByIdAttribute.cs
- VisualStateChangedEventArgs.cs
- MouseCaptureWithinProperty.cs
- XPathNodeList.cs
- GridViewDeleteEventArgs.cs
- ActivationArguments.cs
- AbsoluteQuery.cs
- Latin1Encoding.cs
- Vector3D.cs
- OracleInfoMessageEventArgs.cs
- DataColumnPropertyDescriptor.cs
- StringPropertyBuilder.cs
- Number.cs
- SmtpFailedRecipientException.cs
- TimeStampChecker.cs
- ChangeNode.cs
- QilBinary.cs
- FontFamily.cs
- DataSvcMapFile.cs
- DataGridViewComboBoxColumnDesigner.cs
- EditorAttributeInfo.cs
- CodeGotoStatement.cs
- TypeUnloadedException.cs
- EventLogPermissionAttribute.cs
- ScrollableControl.cs
- NumericUpDown.cs
- RadioButtonList.cs
- RichTextBoxDesigner.cs
- ObjectRef.cs
- BaseValidator.cs
- VBCodeProvider.cs
- ReadWriteSpinLock.cs
- SecureUICommand.cs
- InputScopeConverter.cs
- PageContentCollection.cs
- MethodAccessException.cs
- SqlNode.cs
- ClientProxyGenerator.cs
- ExpressionBuilderContext.cs
- versioninfo.cs
- RTLAwareMessageBox.cs
- ClientRolePrincipal.cs
- InputReportEventArgs.cs
- ObjectNavigationPropertyMapping.cs
- RTTrackingProfile.cs
- ServiceBehaviorElementCollection.cs
- KeyInstance.cs
- FilteredAttributeCollection.cs
- UnionCodeGroup.cs
- unsafenativemethodsother.cs
- ISessionStateStore.cs
- MenuStrip.cs
- Avt.cs
- DirectoryInfo.cs
- WebPartDisplayModeCollection.cs
- Keyboard.cs
- XmlSchemaAll.cs
- AbandonedMutexException.cs
- InfoCardBaseException.cs
- MessageLogTraceRecord.cs
- TextRangeProviderWrapper.cs
- QueryOutputWriter.cs
- DocumentGrid.cs
- EventToken.cs
- FacetChecker.cs
- DefaultValueTypeConverter.cs
- x509utils.cs
- CodeIndexerExpression.cs
- Size.cs
- TimeoutValidationAttribute.cs
- Html32TextWriter.cs
- OnOperation.cs
- MetadataItemEmitter.cs
- SocketConnection.cs
- BoundPropertyEntry.cs
- ILGen.cs
- DesignerObject.cs
- ItemCheckedEvent.cs
- TokenBasedSet.cs
- PanelDesigner.cs
- SendMailErrorEventArgs.cs
- DataTableMappingCollection.cs
- TokenBasedSet.cs
- DataServiceHostFactory.cs
- UserNameSecurityTokenProvider.cs
- FlowLayout.cs
- SystemParameters.cs
- AlphabeticalEnumConverter.cs
- WaitForChangedResult.cs
- SmtpNetworkElement.cs