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
- WebPartDisplayMode.cs
- OdbcFactory.cs
- SmtpException.cs
- _LocalDataStoreMgr.cs
- DataServiceHost.cs
- TableRowCollection.cs
- ButtonBaseAdapter.cs
- XmlHelper.cs
- RolePrincipal.cs
- WebPartMovingEventArgs.cs
- CalculatedColumn.cs
- PenCursorManager.cs
- RemoteWebConfigurationHostServer.cs
- ResourceReader.cs
- DocumentPageHost.cs
- HttpInputStream.cs
- ContentTypeSettingDispatchMessageFormatter.cs
- RegisteredArrayDeclaration.cs
- NameNode.cs
- Directory.cs
- ObjectDisposedException.cs
- WmpBitmapEncoder.cs
- SchemaEntity.cs
- OdbcInfoMessageEvent.cs
- ToolStripDropDownClosedEventArgs.cs
- DesignerRegionCollection.cs
- PropertyConverter.cs
- ConfigXmlComment.cs
- DataBoundControlAdapter.cs
- WebPartPersonalization.cs
- WorkflowControlEndpoint.cs
- ExpressionStringBuilder.cs
- SqlException.cs
- OLEDB_Enum.cs
- ImageListDesigner.cs
- SoapSchemaImporter.cs
- AutomationPatternInfo.cs
- LoginUtil.cs
- SubpageParagraph.cs
- PersonalizationProviderCollection.cs
- GridEntryCollection.cs
- TextStore.cs
- DoubleLink.cs
- MailWebEventProvider.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- MSAAEventDispatcher.cs
- DataGridCellsPanel.cs
- InvariantComparer.cs
- RenderOptions.cs
- HttpDebugHandler.cs
- EditorPart.cs
- HttpDictionary.cs
- VisualStyleElement.cs
- SchemaExporter.cs
- BufferModesCollection.cs
- BufferedGraphicsContext.cs
- XmlAnyAttributeAttribute.cs
- ProtocolException.cs
- GridViewCellAutomationPeer.cs
- DataListItemEventArgs.cs
- GridViewColumn.cs
- MsmqIntegrationProcessProtocolHandler.cs
- NameNode.cs
- SourceFileInfo.cs
- CodeLabeledStatement.cs
- unitconverter.cs
- XPathQilFactory.cs
- FormViewCommandEventArgs.cs
- DbModificationClause.cs
- XPathSelectionIterator.cs
- SequentialUshortCollection.cs
- RichTextBox.cs
- DelegatingConfigHost.cs
- SqlConnectionPoolProviderInfo.cs
- AssertValidation.cs
- FixedSOMPageElement.cs
- SHA384Managed.cs
- DoubleAnimationClockResource.cs
- RtfControlWordInfo.cs
- Globals.cs
- SafeCloseHandleCritical.cs
- Freezable.cs
- ResponseStream.cs
- TargetConverter.cs
- SrgsElement.cs
- formatter.cs
- AsyncOperation.cs
- CodeDefaultValueExpression.cs
- MruCache.cs
- GeneralTransform2DTo3D.cs
- CmsInterop.cs
- PersonalizationStateQuery.cs
- ExpressionEditor.cs
- querybuilder.cs
- CheckBoxList.cs
- StretchValidation.cs
- BinaryFormatter.cs
- ControlCollection.cs
- VoiceObjectToken.cs
- CqlBlock.cs