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
- RoleService.cs
- SearchExpression.cs
- CollectionType.cs
- ValueType.cs
- RevocationPoint.cs
- glyphs.cs
- XPathScanner.cs
- __Filters.cs
- Boolean.cs
- ListCollectionView.cs
- BindingsCollection.cs
- URLMembershipCondition.cs
- UIElementHelper.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- ParseHttpDate.cs
- RangeBaseAutomationPeer.cs
- MarkupCompiler.cs
- TextSimpleMarkerProperties.cs
- IntersectQueryOperator.cs
- ZoneLinkButton.cs
- XslTransformFileEditor.cs
- EncoderParameter.cs
- TableHeaderCell.cs
- Utils.cs
- ContextInformation.cs
- HttpHandlerAction.cs
- GreenMethods.cs
- TransactionScopeDesigner.cs
- PowerStatus.cs
- ParallelLoopState.cs
- LostFocusEventManager.cs
- XmlAttributeAttribute.cs
- JapaneseCalendar.cs
- RegexCharClass.cs
- ImageBrush.cs
- SpellerStatusTable.cs
- Attributes.cs
- CodeAccessPermission.cs
- TextLine.cs
- FormViewCommandEventArgs.cs
- TableParagraph.cs
- ProxyAttribute.cs
- ContentPosition.cs
- DataViewSettingCollection.cs
- DropSource.cs
- HashMembershipCondition.cs
- ResourceDefaultValueAttribute.cs
- ChangeNode.cs
- BmpBitmapEncoder.cs
- PKCS1MaskGenerationMethod.cs
- CallbackBehaviorAttribute.cs
- RuntimeConfigLKG.cs
- UIHelper.cs
- MultiDataTrigger.cs
- assertwrapper.cs
- WinInet.cs
- FormsAuthenticationUser.cs
- FormsIdentity.cs
- Console.cs
- FormattedTextSymbols.cs
- Command.cs
- WindowsStatic.cs
- _SecureChannel.cs
- SimpleApplicationHost.cs
- PreservationFileReader.cs
- HtmlInputHidden.cs
- StdValidatorsAndConverters.cs
- ValidatorCompatibilityHelper.cs
- AuthenticationService.cs
- MemberPathMap.cs
- PageCatalogPart.cs
- EntityDataSourceSelectingEventArgs.cs
- UnauthorizedAccessException.cs
- SiteIdentityPermission.cs
- MessageQueuePermission.cs
- SerializationInfoEnumerator.cs
- GenericTypeParameterBuilder.cs
- WmlPhoneCallAdapter.cs
- MediaEntryAttribute.cs
- XmlTypeAttribute.cs
- SplineKeyFrames.cs
- SynchronizingStream.cs
- TextureBrush.cs
- CollectionViewGroupRoot.cs
- BitArray.cs
- NativeMethods.cs
- Evidence.cs
- BulletChrome.cs
- RegexCapture.cs
- DataGridPagerStyle.cs
- HtmlLink.cs
- Binding.cs
- Trace.cs
- PolicyManager.cs
- RemotingException.cs
- ClientBuildManager.cs
- DecodeHelper.cs
- TranslateTransform3D.cs
- Compress.cs
- SoapTypeAttribute.cs