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
- JoinCqlBlock.cs
- XmlAttributeProperties.cs
- IsolatedStoragePermission.cs
- StorageEntityContainerMapping.cs
- ObjectNavigationPropertyMapping.cs
- DictionaryKeyPropertyAttribute.cs
- XmlSchemaAttributeGroup.cs
- XPathEmptyIterator.cs
- StylusPointPropertyUnit.cs
- Columns.cs
- CacheModeConverter.cs
- SqlRemoveConstantOrderBy.cs
- DictionarySurrogate.cs
- MenuTracker.cs
- ArcSegment.cs
- DataGridCaption.cs
- ImageMetadata.cs
- ListBase.cs
- Pens.cs
- CanonicalFontFamilyReference.cs
- IndependentAnimationStorage.cs
- ServiceObjectContainer.cs
- SqlRowUpdatingEvent.cs
- ExpandSegment.cs
- XmlSchemaSimpleTypeRestriction.cs
- HttpModulesSection.cs
- BoundField.cs
- WebPartDisplayModeCancelEventArgs.cs
- FixedSOMImage.cs
- GetImportFileNameRequest.cs
- SerializationStore.cs
- SQLGuid.cs
- ItemsControlAutomationPeer.cs
- StringFreezingAttribute.cs
- DataGridViewColumnCollection.cs
- Util.cs
- DataSetMappper.cs
- PersonalizationStateQuery.cs
- SecurityManager.cs
- DrawTreeNodeEventArgs.cs
- CodeValidator.cs
- InertiaRotationBehavior.cs
- COAUTHIDENTITY.cs
- XpsS0ValidatingLoader.cs
- SqlNamer.cs
- ToolStripItemCollection.cs
- RuntimeIdentifierPropertyAttribute.cs
- RectangleGeometry.cs
- GridViewCancelEditEventArgs.cs
- WS2007HttpBindingCollectionElement.cs
- PenLineJoinValidation.cs
- WebScriptEnablingBehavior.cs
- ExpressionBuilderCollection.cs
- TreeNodeBinding.cs
- ModelUIElement3D.cs
- FrameworkElementFactoryMarkupObject.cs
- RadioButtonFlatAdapter.cs
- FromReply.cs
- ContentFileHelper.cs
- TreeViewImageIndexConverter.cs
- Rotation3DAnimationBase.cs
- SqlTypeSystemProvider.cs
- DocumentPageTextView.cs
- AnimatedTypeHelpers.cs
- Codec.cs
- MarginsConverter.cs
- OrderByLifter.cs
- safesecurityhelperavalon.cs
- PageAdapter.cs
- RedistVersionInfo.cs
- SecureConversationServiceElement.cs
- UserValidatedEventArgs.cs
- ValidateNames.cs
- ColorBlend.cs
- DesignerCategoryAttribute.cs
- X509SubjectKeyIdentifierClause.cs
- AsmxEndpointPickerExtension.cs
- StrokeIntersection.cs
- NonParentingControl.cs
- WorkflowTransactionService.cs
- Boolean.cs
- ECDiffieHellman.cs
- _IPv6Address.cs
- StylusPlugInCollection.cs
- XmlUtil.cs
- CollectionConverter.cs
- sqlpipe.cs
- UIElementCollection.cs
- TreeView.cs
- GenerateTemporaryAssemblyTask.cs
- IDispatchConstantAttribute.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- Int16.cs
- XmlSerializationReader.cs
- UnconditionalPolicy.cs
- RawAppCommandInputReport.cs
- ThousandthOfEmRealDoubles.cs
- HttpListenerPrefixCollection.cs
- ClientTargetSection.cs
- EncoderExceptionFallback.cs