Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / StreamSecurityUpgradeAcceptorBase.cs / 1 / StreamSecurityUpgradeAcceptorBase.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Channels { using System.IO; using System.ServiceModel.Security; abstract class StreamSecurityUpgradeAcceptorBase : StreamSecurityUpgradeAcceptor { SecurityMessageProperty remoteSecurity; bool securityUpgraded; string upgradeString; protected StreamSecurityUpgradeAcceptorBase(string upgradeString) { this.upgradeString = upgradeString; } public override Stream AcceptUpgrade(Stream stream) { if (stream == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream"); } Stream result = this.OnAcceptUpgrade(stream, out this.remoteSecurity); this.securityUpgraded = true; return result; } public override IAsyncResult BeginAcceptUpgrade(Stream stream, AsyncCallback callback, object state) { if (stream == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream"); } return this.OnBeginAcceptUpgrade(stream, callback, state); } public override bool CanUpgrade(string contentType) { if (this.securityUpgraded) { return false; } return (contentType == this.upgradeString); } public override Stream EndAcceptUpgrade(IAsyncResult result) { if (result == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("result"); } Stream retValue = this.OnEndAcceptUpgrade(result, out this.remoteSecurity); this.securityUpgraded = true; return retValue; } public override SecurityMessageProperty GetRemoteSecurity() { // this could be null if upgrade not completed. return this.remoteSecurity; } protected abstract Stream OnAcceptUpgrade(Stream stream, out SecurityMessageProperty remoteSecurity); protected abstract IAsyncResult OnBeginAcceptUpgrade(Stream stream, AsyncCallback callback, object state); protected abstract Stream OnEndAcceptUpgrade(IAsyncResult result, out SecurityMessageProperty remoteSecurity); } } // 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
- RoutingSection.cs
- GridPattern.cs
- ItemCheckEvent.cs
- CodeLinePragma.cs
- UnsafeNetInfoNativeMethods.cs
- NameValueConfigurationElement.cs
- DependencyPropertyKey.cs
- EncoderFallback.cs
- XmlNamespaceManager.cs
- Label.cs
- LinkArea.cs
- EnumValAlphaComparer.cs
- VisualProxy.cs
- XmlnsPrefixAttribute.cs
- codemethodreferenceexpression.cs
- MsmqBindingElementBase.cs
- XsltLibrary.cs
- RtfFormatStack.cs
- UIElementCollection.cs
- MethodSignatureGenerator.cs
- SafeProcessHandle.cs
- NavigationCommands.cs
- PropertyChangedEventArgs.cs
- Header.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- MenuCommand.cs
- DocumentGridPage.cs
- Matrix.cs
- PostBackOptions.cs
- WaitHandle.cs
- SelectionGlyphBase.cs
- ConstraintCollection.cs
- DataGridPageChangedEventArgs.cs
- PipelineModuleStepContainer.cs
- InkCanvas.cs
- CapabilitiesRule.cs
- PropertyEmitter.cs
- EndpointDiscoveryBehavior.cs
- XmlDownloadManager.cs
- ApplyImportsAction.cs
- NameScopePropertyAttribute.cs
- CatalogZone.cs
- RegexInterpreter.cs
- DocumentXmlWriter.cs
- SelectedDatesCollection.cs
- arclist.cs
- ObjectPersistData.cs
- TreeViewItem.cs
- RemoteWebConfigurationHost.cs
- EventProvider.cs
- Cell.cs
- RichTextBox.cs
- PageRequestManager.cs
- DataRowCollection.cs
- ToolStripPanelRow.cs
- CaseInsensitiveHashCodeProvider.cs
- PropertyValueUIItem.cs
- DictionaryEntry.cs
- EventWaitHandleSecurity.cs
- CurrentTimeZone.cs
- Visual3D.cs
- CFGGrammar.cs
- SafeTimerHandle.cs
- DocumentViewerBaseAutomationPeer.cs
- DefaultBindingPropertyAttribute.cs
- WhitespaceRule.cs
- GridSplitterAutomationPeer.cs
- WebControlsSection.cs
- diagnosticsswitches.cs
- SmtpSection.cs
- OneOfScalarConst.cs
- FormatVersion.cs
- TypeUsageBuilder.cs
- CancellationTokenRegistration.cs
- SafeSecurityHandles.cs
- DelegatingTypeDescriptionProvider.cs
- RankException.cs
- WebControlAdapter.cs
- ThreadStaticAttribute.cs
- OneOfConst.cs
- Icon.cs
- HtmlDocument.cs
- RijndaelManagedTransform.cs
- CommandPlan.cs
- WebConfigurationHost.cs
- MimeAnyImporter.cs
- MD5CryptoServiceProvider.cs
- PassportAuthenticationModule.cs
- Dispatcher.cs
- ErrorRuntimeConfig.cs
- XPathPatternParser.cs
- SimpleType.cs
- CircleHotSpot.cs
- ArgIterator.cs
- BigInt.cs
- MessageLogTraceRecord.cs
- Timer.cs
- Scene3D.cs
- XmlTextReaderImplHelpers.cs
- DataGridTextBoxColumn.cs