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
- ResizingMessageFilter.cs
- ManagementOperationWatcher.cs
- UnionCodeGroup.cs
- GenerateDerivedKeyRequest.cs
- Stopwatch.cs
- VisualBasicExpressionConverter.cs
- WebServiceErrorEvent.cs
- UnsafePeerToPeerMethods.cs
- HelloMessageCD1.cs
- OnOperation.cs
- ElementProxy.cs
- KeySpline.cs
- DataContractSerializerSection.cs
- _DomainName.cs
- wgx_render.cs
- ConcurrentDictionary.cs
- DataGridViewCellStyle.cs
- QilNode.cs
- SiteOfOriginPart.cs
- SimpleExpression.cs
- ComponentResourceManager.cs
- KnownBoxes.cs
- NamespaceEmitter.cs
- PageAsyncTaskManager.cs
- DocobjHost.cs
- SerialReceived.cs
- Object.cs
- Point3DAnimationBase.cs
- GCHandleCookieTable.cs
- AttributeCollection.cs
- SerializerProvider.cs
- Floater.cs
- RemotingConfigParser.cs
- WinOEToolBoxItem.cs
- CompoundFileStorageReference.cs
- ScrollContentPresenter.cs
- XhtmlTextWriter.cs
- IndexedGlyphRun.cs
- MarshalByRefObject.cs
- HashAlgorithm.cs
- GlobalAllocSafeHandle.cs
- AbstractDataSvcMapFileLoader.cs
- HyperlinkAutomationPeer.cs
- ResourcesChangeInfo.cs
- UnaryNode.cs
- PrintingPermissionAttribute.cs
- HtmlHistory.cs
- MetadataItem.cs
- TheQuery.cs
- BaseCollection.cs
- StreamGeometry.cs
- VisualBasic.cs
- AppDomainProtocolHandler.cs
- MultipleViewPattern.cs
- KnownBoxes.cs
- SqlBuilder.cs
- DataGridParentRows.cs
- BuildManager.cs
- BufferAllocator.cs
- PenContexts.cs
- VisualCollection.cs
- ReverseInheritProperty.cs
- RegistrySecurity.cs
- TargetControlTypeCache.cs
- DataTableMapping.cs
- ComponentDispatcherThread.cs
- WebPartCatalogAddVerb.cs
- OrderedDictionaryStateHelper.cs
- DataViewSetting.cs
- LogStore.cs
- WebBrowserPermission.cs
- StringValueSerializer.cs
- lengthconverter.cs
- ApplicationHost.cs
- PermissionSet.cs
- TCEAdapterGenerator.cs
- TrackBarRenderer.cs
- SqlRowUpdatedEvent.cs
- LinearGradientBrush.cs
- ProcessModule.cs
- documentsequencetextview.cs
- SecurityState.cs
- ListBox.cs
- TextTrailingWordEllipsis.cs
- TextSpan.cs
- AnimationStorage.cs
- DiagnosticTraceSource.cs
- ProgramPublisher.cs
- OleDbDataReader.cs
- RewritingSimplifier.cs
- MethodImplAttribute.cs
- ActiveXContainer.cs
- TableLayoutPanelCellPosition.cs
- UIHelper.cs
- ValueTypeIndexerReference.cs
- TreeViewCancelEvent.cs
- FileDetails.cs
- EventLogger.cs
- SpecialFolderEnumConverter.cs
- IsolatedStorage.cs