Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / PeerTransportSecuritySettings.cs / 1 / PeerTransportSecuritySettings.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel { using System; using System.ComponentModel; using System.Net; using System.Net.Security; using System.ServiceModel.Channels; using System.ServiceModel.Configuration; using System.ServiceModel.Description; using System.ServiceModel.Security; using System.Xml; public sealed class PeerTransportSecuritySettings { internal const PeerTransportCredentialType DefaultCredentialType = PeerTransportCredentialType.Password; PeerTransportCredentialType credentialType; internal PeerTransportSecuritySettings() { this.credentialType = DefaultCredentialType; } internal PeerTransportSecuritySettings(PeerTransportSecuritySettings other) { this.credentialType = other.credentialType; } internal PeerTransportSecuritySettings(PeerTransportSecurityElement element) { credentialType = element.CredentialType; } public PeerTransportCredentialType CredentialType { get { return this.credentialType; } set { if (!PeerTransportCredentialTypeHelper.IsDefined(value)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int)value, typeof(PeerTransportCredentialType))); } this.credentialType = value; } } internal void OnImportPolicy(MetadataImporter importer, PolicyConversionContext context) { XmlElement element = PolicyConversionContext.FindAssertion(context.GetBindingAssertions(), PeerTransportPolicyConstants.PeerTransportCredentialType, TransportPolicyConstants.PeerTransportUri, true); PeerTransportCredentialType credentialType = PeerTransportCredentialType.Password; if (element != null) { switch (element.InnerText) { case PeerTransportPolicyConstants.PeerTransportCredentialTypePassword: credentialType = PeerTransportCredentialType.Password; break; case PeerTransportPolicyConstants.PeerTransportCredentialTypeCertificate: credentialType = PeerTransportCredentialType.Certificate; break; default: break; } } this.CredentialType = credentialType; } internal void OnExportPolicy(MetadataExporter exporter, PolicyConversionContext context) { string assertion = ""; switch (this.CredentialType) { case PeerTransportCredentialType.Password: assertion = PeerTransportPolicyConstants.PeerTransportCredentialTypePassword; break; case PeerTransportCredentialType.Certificate: assertion = PeerTransportPolicyConstants.PeerTransportCredentialTypeCertificate; break; default: DiagnosticUtility.DebugAssert("Unsupported value for PeerTransportSecuritySettings.CredentialType"); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException()); } XmlDocument doc = new XmlDocument(); XmlElement element = doc.CreateElement(PeerTransportPolicyConstants.PeerTransportPrefix, PeerTransportPolicyConstants.PeerTransportCredentialType, TransportPolicyConstants.PeerTransportUri); element.InnerText = assertion; context.GetBindingAssertions().Add(element); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CommonProperties.cs
- FieldTemplateUserControl.cs
- XamlWrapperReaders.cs
- RegexCompiler.cs
- EncoderParameter.cs
- NavigatorInvalidBodyAccessException.cs
- NamespaceList.cs
- CleanUpVirtualizedItemEventArgs.cs
- _AutoWebProxyScriptHelper.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- WebResourceAttribute.cs
- SiteMapProvider.cs
- ReflectionTypeLoadException.cs
- Queue.cs
- XmlQueryTypeFactory.cs
- GatewayIPAddressInformationCollection.cs
- DaylightTime.cs
- DataGridRowEventArgs.cs
- SplineKeyFrames.cs
- ContainerSelectorActiveEvent.cs
- GridViewEditEventArgs.cs
- SubMenuStyleCollection.cs
- PagerStyle.cs
- BitmapCacheBrush.cs
- BinaryCommonClasses.cs
- FontWeight.cs
- LineUtil.cs
- AddressUtility.cs
- MimeMapping.cs
- DynamicMethod.cs
- HtmlShimManager.cs
- SerialPort.cs
- DataControlFieldHeaderCell.cs
- LinqDataSourceUpdateEventArgs.cs
- QilIterator.cs
- WebPartExportVerb.cs
- DataBoundControlHelper.cs
- BindingEntityInfo.cs
- TextParaClient.cs
- EntryPointNotFoundException.cs
- ProxyElement.cs
- FeatureSupport.cs
- DecoderFallbackWithFailureFlag.cs
- WebHttpBindingCollectionElement.cs
- DataMisalignedException.cs
- PackageDigitalSignatureManager.cs
- PageBuildProvider.cs
- Label.cs
- AmbientProperties.cs
- XamlPoint3DCollectionSerializer.cs
- OneOfConst.cs
- AppDomainFactory.cs
- WeakEventManager.cs
- listitem.cs
- WebPartConnectionsCancelVerb.cs
- MimeBasePart.cs
- BinaryFormatter.cs
- NamedPipeWorkerProcess.cs
- TransactionManagerProxy.cs
- Parameter.cs
- FlowDocument.cs
- HitTestDrawingContextWalker.cs
- LinqDataSourceView.cs
- PenContext.cs
- WSTransactionSection.cs
- HandleTable.cs
- PathNode.cs
- HwndSourceKeyboardInputSite.cs
- ElapsedEventArgs.cs
- RNGCryptoServiceProvider.cs
- DataGridViewCellStyleConverter.cs
- HtmlInputPassword.cs
- ContainerParagraph.cs
- PathGeometry.cs
- TextHintingModeValidation.cs
- HtmlGenericControl.cs
- ProjectedWrapper.cs
- DesignerDeviceConfig.cs
- PeerCollaborationPermission.cs
- _NetRes.cs
- DataRow.cs
- EditorZone.cs
- GeometryDrawing.cs
- FigureParaClient.cs
- BindingWorker.cs
- ListCommandEventArgs.cs
- SplayTreeNode.cs
- QuaternionConverter.cs
- Int32RectConverter.cs
- ReliableSessionElement.cs
- XmlLanguageConverter.cs
- HttpVersion.cs
- EncryptedType.cs
- SoapElementAttribute.cs
- FontStyleConverter.cs
- SystemNetworkInterface.cs
- ClientSession.cs
- Events.cs
- CheckBoxPopupAdapter.cs
- Decimal.cs