Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / WindowsClientCredential.cs / 1 / WindowsClientCredential.cs
//----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Security
{
using System.Collections.Generic;
using System.ServiceModel;
using System.Runtime.Serialization;
using System.Net;
using System.Security.Principal;
using System.ServiceModel.Security.Tokens;
using System.Security.Cryptography.X509Certificates;
using System.Web.Security;
public sealed class WindowsClientCredential
{
internal const TokenImpersonationLevel DefaultImpersonationLevel = TokenImpersonationLevel.Identification;
TokenImpersonationLevel allowedImpersonationLevel = DefaultImpersonationLevel;
NetworkCredential windowsCredentials;
bool allowNtlm = SspiSecurityTokenProvider.DefaultAllowNtlm;
bool isReadOnly;
internal WindowsClientCredential()
{
}
internal WindowsClientCredential(WindowsClientCredential other)
{
if (other.windowsCredentials != null)
this.windowsCredentials = SecurityUtils.GetNetworkCredentialsCopy(other.windowsCredentials);
this.allowedImpersonationLevel = other.allowedImpersonationLevel;
this.allowNtlm = other.allowNtlm;
this.isReadOnly = other.isReadOnly;
}
public TokenImpersonationLevel AllowedImpersonationLevel
{
get
{
return this.allowedImpersonationLevel;
}
set
{
ThrowIfImmutable();
this.allowedImpersonationLevel = value;
}
}
public NetworkCredential ClientCredential
{
get
{
if (this.windowsCredentials == null)
this.windowsCredentials = new NetworkCredential();
return this.windowsCredentials;
}
set
{
ThrowIfImmutable();
this.windowsCredentials = value;
}
}
public bool AllowNtlm
{
get
{
return this.allowNtlm;
}
set
{
ThrowIfImmutable();
this.allowNtlm = value;
}
}
internal void MakeReadOnly()
{
this.isReadOnly = true;
}
void ThrowIfImmutable()
{
if (this.isReadOnly)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly)));
}
}
}
}
// 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
- Speller.cs
- BrowserCapabilitiesFactory.cs
- MatrixAnimationUsingKeyFrames.cs
- ExecutionEngineException.cs
- WizardDesigner.cs
- TraceHandler.cs
- ClassValidator.cs
- XPathNodePointer.cs
- DigitalSignatureProvider.cs
- ProcessModuleDesigner.cs
- XmlSiteMapProvider.cs
- MonthCalendar.cs
- ParallelTimeline.cs
- TemplateBindingExpression.cs
- ProviderUtil.cs
- XmlSchemaComplexType.cs
- QilGeneratorEnv.cs
- SqlCaseSimplifier.cs
- HttpModuleAction.cs
- ObjectDataSourceStatusEventArgs.cs
- Compiler.cs
- WebBrowserNavigatingEventHandler.cs
- DataGridViewCellStyleChangedEventArgs.cs
- _CommandStream.cs
- followingsibling.cs
- BasicBrowserDialog.cs
- ForceCopyBuildProvider.cs
- RadialGradientBrush.cs
- SiteMapNodeCollection.cs
- FontDifferentiator.cs
- ASCIIEncoding.cs
- BindingSourceDesigner.cs
- DataGridViewButtonCell.cs
- BackStopAuthenticationModule.cs
- ObjectItemConventionAssemblyLoader.cs
- MarshalByValueComponent.cs
- QilReference.cs
- TranslateTransform.cs
- MultiAsyncResult.cs
- basecomparevalidator.cs
- SqlNotificationEventArgs.cs
- TraceData.cs
- AnnotationComponentManager.cs
- AnnotationHelper.cs
- SoapAttributeOverrides.cs
- Debug.cs
- ProgressBar.cs
- CompModSwitches.cs
- RectangleF.cs
- DataStreamFromComStream.cs
- CallContext.cs
- DataPager.cs
- ContainerAction.cs
- SpotLight.cs
- ManagementException.cs
- ImageFormatConverter.cs
- errorpatternmatcher.cs
- NativeObjectSecurity.cs
- OdbcParameter.cs
- FlowDocumentReader.cs
- BooleanAnimationBase.cs
- AudioStateChangedEventArgs.cs
- SimpleType.cs
- BaseProcessor.cs
- RequiredFieldValidator.cs
- IPHostEntry.cs
- BamlRecordReader.cs
- ClassicBorderDecorator.cs
- OpenTypeMethods.cs
- MasterPageParser.cs
- SiteMapDataSourceView.cs
- AsyncCompletedEventArgs.cs
- IInstanceTable.cs
- DoubleLink.cs
- GeometryModel3D.cs
- SettingsPropertyNotFoundException.cs
- Win32.cs
- MetadataArtifactLoaderCompositeResource.cs
- AuthorizationSection.cs
- DesignerTransaction.cs
- SessionStateItemCollection.cs
- UserNameSecurityToken.cs
- _LoggingObject.cs
- CodeMethodReturnStatement.cs
- SelectionItemProviderWrapper.cs
- SevenBitStream.cs
- WindowHideOrCloseTracker.cs
- MSAANativeProvider.cs
- NonClientArea.cs
- ExistsInCollection.cs
- PagerSettings.cs
- SequenceFullException.cs
- RunWorkerCompletedEventArgs.cs
- InstanceCompleteException.cs
- DependencyProperty.cs
- UnsafeNativeMethods.cs
- DiffuseMaterial.cs
- TextWriter.cs
- SessionStateItemCollection.cs
- WeakReferenceList.cs