Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / HttpsTransportBindingElement.cs / 1 / HttpsTransportBindingElement.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.Collections.Generic; using System.ServiceModel.Description; using System.Net; using System.Net.Security; using System.Runtime.Serialization; using System.Security.Cryptography.X509Certificates; using System.ServiceModel; using System.ServiceModel.Activation; using System.ServiceModel.Security; using System.Xml; public class HttpsTransportBindingElement : HttpTransportBindingElement, ITransportTokenAssertionProvider { bool requireClientCertificate; MessageSecurityVersion messageSecurityVersion; public HttpsTransportBindingElement() : base() { this.requireClientCertificate = TransportDefaults.RequireClientCertificate; } protected HttpsTransportBindingElement(HttpsTransportBindingElement elementToBeCloned) : base(elementToBeCloned) { this.requireClientCertificate = elementToBeCloned.requireClientCertificate; this.messageSecurityVersion = elementToBeCloned.messageSecurityVersion; } HttpsTransportBindingElement(HttpTransportBindingElement elementToBeCloned) : base(elementToBeCloned) { } public bool RequireClientCertificate { get { return this.requireClientCertificate; } set { this.requireClientCertificate = value; } } public override string Scheme { get { return "https"; } } public override BindingElement Clone() { return new HttpsTransportBindingElement(this); } internal override bool SupportsClientAuthenticationImpl { get { return (this.requireClientCertificate || base.SupportsClientAuthenticationImpl); } } internal override bool SupportsClientWindowsIdentityImpl { get { return (this.requireClientCertificate || base.SupportsClientWindowsIdentityImpl); } } internal override string WsdlTransportUri { get { return TransportPolicyConstants.HttpTransportUri; } } // In order to generate sp:HttpsToken with the right policy. // See CSD 3105 for detail. internal MessageSecurityVersion MessageSecurityVersion { get { return this.messageSecurityVersion; } set { if (value == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("value")); } this.messageSecurityVersion = value; } } public override IChannelFactoryBuildChannelFactory (BindingContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if(!this.CanBuildChannelFactory (context)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel))); } return (IChannelFactory )(object)new HttpsChannelFactory(this, context); } public override IChannelListener BuildChannelListener (BindingContext context) { HttpChannelListener listener; if (typeof(TChannel) == typeof(IReplyChannel)) { listener = new HttpsChannelListener(this, context); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel))); } VirtualPathExtension.ApplyHostedContext(listener, context); return (IChannelListener )(object)listener; } internal static HttpsTransportBindingElement CreateFromHttpBindingElement(HttpTransportBindingElement elementToBeCloned) { return new HttpsTransportBindingElement(elementToBeCloned); } public override T GetProperty (BindingContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if (typeof(T) == typeof(ISecurityCapabilities)) { return (T)(object)new SecurityCapabilities(SupportsClientAuthenticationImpl, true, SupportsClientWindowsIdentityImpl, ProtectionLevel.EncryptAndSign, ProtectionLevel.EncryptAndSign); } else { return base.GetProperty (context); } } internal override void OnExportPolicy(MetadataExporter exporter, PolicyConversionContext context) { base.OnExportPolicy(exporter, context); SecurityBindingElement.ExportPolicy(exporter, context); } internal override void OnImportPolicy(MetadataImporter importer, PolicyConversionContext policyContext) { base.OnImportPolicy(importer, policyContext); WSSecurityPolicy sp = null; if (WSSecurityPolicy.TryGetSecurityPolicyDriver(policyContext.GetBindingAssertions(), out sp)) sp.TryImportWsspHttpsTokenAssertion(importer, policyContext.GetBindingAssertions(), this); } #region ITransportTokenAssertionProvider Members public XmlElement GetTransportTokenAssertion() { return null; } #endregion } } // 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
- ControlBindingsConverter.cs
- ToolBarPanel.cs
- PrintingPermission.cs
- SqlInternalConnectionTds.cs
- XmlSerializationGeneratedCode.cs
- Screen.cs
- LinqDataSourceValidationException.cs
- NameSpaceExtractor.cs
- StringConverter.cs
- CodeSnippetExpression.cs
- FragmentQueryKB.cs
- BezierSegment.cs
- BaseValidator.cs
- NestedContainer.cs
- GroupBoxRenderer.cs
- AnonymousIdentificationSection.cs
- SystemWebExtensionsSectionGroup.cs
- ManipulationDevice.cs
- GlyphRunDrawing.cs
- ModelUIElement3D.cs
- MethodAccessException.cs
- Currency.cs
- ColumnResizeUndoUnit.cs
- InfoCardTraceRecord.cs
- Triangle.cs
- SmtpAuthenticationManager.cs
- ValueChangedEventManager.cs
- dsa.cs
- WSFederationHttpSecurityElement.cs
- SHA384Cng.cs
- DragStartedEventArgs.cs
- ScaleTransform.cs
- PasswordRecovery.cs
- SapiRecognizer.cs
- FontFamilyIdentifier.cs
- MediaContextNotificationWindow.cs
- XmlNamespaceDeclarationsAttribute.cs
- NegationPusher.cs
- WindowsSpinner.cs
- grammarelement.cs
- Renderer.cs
- ReflectPropertyDescriptor.cs
- util.cs
- Matrix.cs
- TCEAdapterGenerator.cs
- CodeMemberProperty.cs
- GeneralTransform3D.cs
- FacetEnabledSchemaElement.cs
- ConfigurationConverterBase.cs
- CallInfo.cs
- CmsInterop.cs
- ImageDrawing.cs
- ProtocolViolationException.cs
- XPathAxisIterator.cs
- SchemaTypeEmitter.cs
- EncryptedKey.cs
- CharEntityEncoderFallback.cs
- Timeline.cs
- EntryIndex.cs
- TypeLibraryHelper.cs
- rsa.cs
- ConfigXmlAttribute.cs
- GridViewCellAutomationPeer.cs
- HtmlSelect.cs
- ExpressionParser.cs
- RsaSecurityTokenParameters.cs
- DecoderFallbackWithFailureFlag.cs
- ConfigXmlWhitespace.cs
- InplaceBitmapMetadataWriter.cs
- ToolStripSystemRenderer.cs
- DataGridViewRowsAddedEventArgs.cs
- NamedPipeConnectionPoolSettings.cs
- BufferedStream.cs
- RemotingConfigParser.cs
- TreeViewDataItemAutomationPeer.cs
- ListControl.cs
- Util.cs
- ThreadStateException.cs
- DispatcherProcessingDisabled.cs
- OutputScope.cs
- FrameDimension.cs
- TargetConverter.cs
- DataConnectionHelper.cs
- Latin1Encoding.cs
- ObfuscateAssemblyAttribute.cs
- DateTimeStorage.cs
- SelectionEditor.cs
- TimersDescriptionAttribute.cs
- DuplicateDetector.cs
- HelpKeywordAttribute.cs
- DataBindingHandlerAttribute.cs
- UnsafeNativeMethodsCLR.cs
- ServiceDesigner.cs
- UIElementIsland.cs
- CodeTypeReferenceSerializer.cs
- TransformDescriptor.cs
- DbMetaDataColumnNames.cs
- SettingsSavedEventArgs.cs
- MouseOverProperty.cs
- CollectionViewGroupInternal.cs