Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / HttpClientCredentialType.cs / 1 / HttpClientCredentialType.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel
{
using System.Net;
public enum HttpClientCredentialType
{
None,
Basic,
Digest,
Ntlm,
Windows,
Certificate
}
static class HttpClientCredentialTypeHelper
{
internal static bool IsDefined(HttpClientCredentialType value)
{
return (value == HttpClientCredentialType.None ||
value == HttpClientCredentialType.Basic ||
value == HttpClientCredentialType.Digest ||
value == HttpClientCredentialType.Ntlm ||
value == HttpClientCredentialType.Windows ||
value == HttpClientCredentialType.Certificate);
}
internal static AuthenticationSchemes MapToAuthenticationScheme(HttpClientCredentialType clientCredentialType)
{
AuthenticationSchemes result;
switch (clientCredentialType)
{
case HttpClientCredentialType.Certificate:
// fall through to None case
case HttpClientCredentialType.None:
result = AuthenticationSchemes.Anonymous;
break;
case HttpClientCredentialType.Basic:
result = AuthenticationSchemes.Basic;
break;
case HttpClientCredentialType.Digest:
result = AuthenticationSchemes.Digest;
break;
case HttpClientCredentialType.Ntlm:
result = AuthenticationSchemes.Ntlm;
break;
case HttpClientCredentialType.Windows:
result = AuthenticationSchemes.Negotiate;
break;
default:
DiagnosticUtility.DebugAssert("unsupported client credential type");
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
}
return result;
}
internal static HttpClientCredentialType MapToClientCredentialType(AuthenticationSchemes authenticationSchemes)
{
HttpClientCredentialType result;
switch (authenticationSchemes)
{
case AuthenticationSchemes.Anonymous:
result = HttpClientCredentialType.None;
break;
case AuthenticationSchemes.Basic:
result = HttpClientCredentialType.Basic;
break;
case AuthenticationSchemes.Digest:
result = HttpClientCredentialType.Digest;
break;
case AuthenticationSchemes.Ntlm:
result = HttpClientCredentialType.Ntlm;
break;
case AuthenticationSchemes.Negotiate:
result = HttpClientCredentialType.Windows;
break;
default:
DiagnosticUtility.DebugAssert("unsupported client AuthenticationScheme");
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
}
return result;
}
}
}
// 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
- TitleStyle.cs
- XmlSchemaAttributeGroupRef.cs
- _SecureChannel.cs
- DependencyPropertyChangedEventArgs.cs
- WebPartDisplayModeEventArgs.cs
- GridViewHeaderRowPresenter.cs
- AuditLevel.cs
- SRGSCompiler.cs
- RelationshipSet.cs
- TextServicesLoader.cs
- XmlName.cs
- ColumnMap.cs
- XmlReturnReader.cs
- DataGridItemEventArgs.cs
- FixedSOMFixedBlock.cs
- CommonXSendMessage.cs
- IWorkflowDebuggerService.cs
- MethodCallTranslator.cs
- NotifyInputEventArgs.cs
- SessionIDManager.cs
- ConnectorSelectionGlyph.cs
- FormsAuthenticationUser.cs
- AppDomainShutdownMonitor.cs
- AudioStateChangedEventArgs.cs
- HtmlInputFile.cs
- DataPagerFieldItem.cs
- Invariant.cs
- InstanceData.cs
- TabletDevice.cs
- EntityTypeEmitter.cs
- SvcMapFile.cs
- PersonalizationEntry.cs
- DataList.cs
- XmlIncludeAttribute.cs
- HttpCapabilitiesSectionHandler.cs
- CompilationSection.cs
- TableLayoutSettings.cs
- CfgParser.cs
- Point4D.cs
- IgnoreFileBuildProvider.cs
- ConnectionStringsSection.cs
- WebPart.cs
- TableAutomationPeer.cs
- WindowsFormsHelpers.cs
- DataGridViewCellPaintingEventArgs.cs
- ConfigPathUtility.cs
- CompileXomlTask.cs
- ProxyWebPart.cs
- WpfPayload.cs
- TabControl.cs
- DependentList.cs
- ObjectDataSourceFilteringEventArgs.cs
- IfAction.cs
- Span.cs
- CompilerParameters.cs
- ChainedAsyncResult.cs
- LinqDataSourceValidationException.cs
- ReflectionHelper.cs
- Int32AnimationUsingKeyFrames.cs
- BamlLocalizer.cs
- DesignerObjectListAdapter.cs
- GenericUriParser.cs
- ConstNode.cs
- OdbcException.cs
- ToolStripContentPanelRenderEventArgs.cs
- BitmapEffectInputConnector.cs
- TypeSource.cs
- PolicyStatement.cs
- TypefaceCollection.cs
- ReadOnlyCollection.cs
- DefaultSerializationProviderAttribute.cs
- ItemsChangedEventArgs.cs
- ErrorFormatterPage.cs
- AssemblyBuilder.cs
- ReadOnlyPropertyMetadata.cs
- Dynamic.cs
- DataSpaceManager.cs
- SiteMapPath.cs
- DesignerOptionService.cs
- newinstructionaction.cs
- DataGridViewCellLinkedList.cs
- CompilerResults.cs
- Column.cs
- XamlPathDataSerializer.cs
- BufferedWebEventProvider.cs
- DbConnectionPoolGroupProviderInfo.cs
- SqlStatistics.cs
- FieldNameLookup.cs
- LockingPersistenceProvider.cs
- StaticSiteMapProvider.cs
- StatusBarPanelClickEvent.cs
- OrthographicCamera.cs
- HtmlEmptyTagControlBuilder.cs
- ExpandedProjectionNode.cs
- ClientProxyGenerator.cs
- ParseNumbers.cs
- EncodingDataItem.cs
- Calendar.cs
- ProfileParameter.cs
- ZipIOCentralDirectoryFileHeader.cs