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
- MgmtConfigurationRecord.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- DataGridViewRow.cs
- EntityModelSchemaGenerator.cs
- RootProfilePropertySettingsCollection.cs
- ConfigurationValues.cs
- KeyConverter.cs
- ListDesigner.cs
- SoapFault.cs
- ButtonField.cs
- DataSourceView.cs
- XmlIlVisitor.cs
- CaseExpr.cs
- ValidatorAttribute.cs
- _Win32.cs
- ResourceDictionary.cs
- XmlCharacterData.cs
- DbProviderFactories.cs
- XmlDataSourceView.cs
- Matrix.cs
- DataObjectEventArgs.cs
- DesignerDataSchemaClass.cs
- InplaceBitmapMetadataWriter.cs
- DbRetry.cs
- TripleDES.cs
- XsltException.cs
- XmlKeywords.cs
- MessageQueueConverter.cs
- ArgumentException.cs
- PaperSource.cs
- SocketCache.cs
- querybuilder.cs
- TriState.cs
- ContextInformation.cs
- OracleParameter.cs
- EntityParameterCollection.cs
- TypeBuilderInstantiation.cs
- ReadOnlyCollectionBase.cs
- MissingSatelliteAssemblyException.cs
- Polygon.cs
- TimerElapsedEvenArgs.cs
- SqlDataRecord.cs
- wmiprovider.cs
- DeviceContext.cs
- CollectionViewGroupInternal.cs
- RichTextBoxAutomationPeer.cs
- UpdateRecord.cs
- XmlDomTextWriter.cs
- HMACSHA384.cs
- WinFormsSpinner.cs
- ScrollItemPattern.cs
- SqlSelectClauseBuilder.cs
- HandledEventArgs.cs
- ASCIIEncoding.cs
- PointAnimationBase.cs
- StopStoryboard.cs
- DefaultProxySection.cs
- ClientBuildManager.cs
- DataGridRowHeader.cs
- ToolStripItemRenderEventArgs.cs
- FixedSOMSemanticBox.cs
- StateValidator.cs
- Geometry.cs
- FileLevelControlBuilderAttribute.cs
- SqlDependencyListener.cs
- DataServiceHost.cs
- PropertyEmitterBase.cs
- StateWorkerRequest.cs
- ClientProxyGenerator.cs
- WrapPanel.cs
- InlinedAggregationOperatorEnumerator.cs
- NetworkInterface.cs
- ClientCredentialsElement.cs
- HierarchicalDataTemplate.cs
- ConfigurationUtility.cs
- ISO2022Encoding.cs
- GenerateTemporaryAssemblyTask.cs
- Queue.cs
- Helpers.cs
- ChannelDispatcher.cs
- TextServicesDisplayAttribute.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- ProviderConnectionPoint.cs
- SizeKeyFrameCollection.cs
- CompilerTypeWithParams.cs
- Adorner.cs
- Constants.cs
- Pen.cs
- RectAnimationClockResource.cs
- TileBrush.cs
- ECDiffieHellmanPublicKey.cs
- MobileControlsSectionHandler.cs
- FontWeight.cs
- XmlCountingReader.cs
- SqlRetyper.cs
- XmlSerializerOperationGenerator.cs
- BitmapCodecInfoInternal.cs
- TransformerTypeCollection.cs
- MimeTypeMapper.cs
- FlowDocumentPage.cs