Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / AuthenticationSchemesHelper.cs / 1 / AuthenticationSchemesHelper.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Channels { using System.ComponentModel; using System.Globalization; using System.Net; static class AuthenticationSchemesHelper { public static bool DoesAuthTypeMatch(AuthenticationSchemes authScheme, string authType) { bool result = false; if ((authType == null) || (authType.Length == 0)) { result = (authScheme == AuthenticationSchemes.Anonymous); } else { if (authScheme == AuthenticationSchemes.Negotiate) { result = (authType.Equals("ntlm", StringComparison.OrdinalIgnoreCase) || authType.Equals("kerberos", StringComparison.OrdinalIgnoreCase) || authType.Equals("negotiate", StringComparison.OrdinalIgnoreCase)); } else { result = authScheme.ToString().Equals(authType, StringComparison.OrdinalIgnoreCase); } } return result; } public static bool IsSingleton(AuthenticationSchemes v) { bool result; switch (v) { case AuthenticationSchemes.Digest: case AuthenticationSchemes.Negotiate: case AuthenticationSchemes.Ntlm: case AuthenticationSchemes.Basic: case AuthenticationSchemes.Anonymous: result = true; break; default: result = false; break; } return result; } public static bool IsWindowsAuth(AuthenticationSchemes authScheme) { return ((authScheme == AuthenticationSchemes.Negotiate) || (authScheme == AuthenticationSchemes.Ntlm)); } internal static string ToString(AuthenticationSchemes authScheme) { string result; switch (authScheme) { case AuthenticationSchemes.Anonymous: result = "anonymous"; break; case AuthenticationSchemes.Basic: result = "basic"; break; case AuthenticationSchemes.Digest: result = "digest"; break; case AuthenticationSchemes.Negotiate: result = "negotiate"; break; case AuthenticationSchemes.Ntlm: result = "ntlm"; break; default: DiagnosticUtility.DebugAssert("unknown authentication scheme"); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException( "authScheme", (int)authScheme, typeof(AuthenticationSchemes))); } #if DEBUG DiagnosticUtility.DebugAssert(result.Equals(authScheme.ToString().ToLowerInvariant()), "incorrect auth scheme conversion"); #endif 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
- AggregateNode.cs
- ADConnectionHelper.cs
- ObjectQuery.cs
- ISessionStateStore.cs
- UdpTransportBindingElement.cs
- EntityDataSourceDesigner.cs
- XmlIgnoreAttribute.cs
- RelationshipSet.cs
- EdmSchemaAttribute.cs
- Oid.cs
- TextReader.cs
- TrackingQuery.cs
- StrokeRenderer.cs
- XmlSerializerFormatAttribute.cs
- WebPartPersonalization.cs
- StorageMappingItemLoader.cs
- SecurityState.cs
- RoutedEvent.cs
- SQLInt32Storage.cs
- RemotingException.cs
- DrawingContextFlattener.cs
- documentsequencetextcontainer.cs
- sqlser.cs
- TextServicesDisplayAttribute.cs
- DataGridTextBoxColumn.cs
- ActivityDesignerHelper.cs
- TypePresenter.xaml.cs
- EDesignUtil.cs
- ListBoxChrome.cs
- StylusDownEventArgs.cs
- CqlBlock.cs
- SizeAnimationBase.cs
- TreeViewImageIndexConverter.cs
- CompilerError.cs
- SqlNodeAnnotation.cs
- WebExceptionStatus.cs
- RenderCapability.cs
- XmlAttributeProperties.cs
- Rect3D.cs
- CodeObjectCreateExpression.cs
- HttpProfileGroupBase.cs
- DbConnectionHelper.cs
- ProfilePropertySettings.cs
- ContentHostHelper.cs
- CorrelationActionMessageFilter.cs
- StylusButton.cs
- Viewport2DVisual3D.cs
- SynchronizationScope.cs
- HttpModuleCollection.cs
- OleDbException.cs
- ADRoleFactoryConfiguration.cs
- UrlParameterReader.cs
- TimeoutValidationAttribute.cs
- ToolStripOverflow.cs
- CngProvider.cs
- SkipQueryOptionExpression.cs
- CultureTable.cs
- NamespaceQuery.cs
- RNGCryptoServiceProvider.cs
- TextBox.cs
- DataProtection.cs
- ToolStripPanelRow.cs
- Rect3D.cs
- DesignerSelectionListAdapter.cs
- XhtmlTextWriter.cs
- SqlNodeAnnotation.cs
- ResourcePart.cs
- ToolStripDropDownButton.cs
- SqlServer2KCompatibilityAnnotation.cs
- CodeAttachEventStatement.cs
- HScrollProperties.cs
- JavaScriptString.cs
- WebFaultClientMessageInspector.cs
- Style.cs
- WmlCommandAdapter.cs
- TableLayoutPanelResizeGlyph.cs
- RuleInfoComparer.cs
- Vector3DAnimationBase.cs
- QilTargetType.cs
- X509CertificateValidator.cs
- ModelToObjectValueConverter.cs
- SchemaCollectionPreprocessor.cs
- SaveFileDialog.cs
- MenuStrip.cs
- DataGridColumnCollection.cs
- Splitter.cs
- PlanCompilerUtil.cs
- WebPartZoneAutoFormat.cs
- updatecommandorderer.cs
- WorkflowDefinitionDispenser.cs
- HttpWriter.cs
- ContentOperations.cs
- CodeSubDirectory.cs
- DocumentGrid.cs
- SkinBuilder.cs
- BStrWrapper.cs
- Int32AnimationBase.cs
- PropertySourceInfo.cs
- ExpandableObjectConverter.cs
- RemoveStoryboard.cs