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
- RotationValidation.cs
- ColumnProvider.cs
- HighlightComponent.cs
- TextRangeSerialization.cs
- NullableDoubleAverageAggregationOperator.cs
- ToolboxDataAttribute.cs
- BitmapMetadataEnumerator.cs
- DataKeyArray.cs
- ControlBuilder.cs
- BypassElement.cs
- ListBoxChrome.cs
- AutomationIdentifierGuids.cs
- ToolBarTray.cs
- SettingsProperty.cs
- FontStretch.cs
- GridViewHeaderRowPresenter.cs
- WindowCollection.cs
- ComponentTray.cs
- SoapAttributeOverrides.cs
- LateBoundBitmapDecoder.cs
- IndexedString.cs
- PropertiesTab.cs
- WindowsNonControl.cs
- TypeUtil.cs
- IndentedWriter.cs
- ReadWriteObjectLock.cs
- XmlAnyElementAttribute.cs
- ButtonBaseAdapter.cs
- ErrorProvider.cs
- XamlDesignerSerializationManager.cs
- UndirectedGraph.cs
- HtmlTextArea.cs
- EditorPart.cs
- LinkedResourceCollection.cs
- XmlSchemaAnnotation.cs
- BCryptHashAlgorithm.cs
- FormsAuthenticationCredentials.cs
- Tablet.cs
- AnonymousIdentificationSection.cs
- SystemInfo.cs
- MediaPlayerState.cs
- ISFClipboardData.cs
- ListViewItemEventArgs.cs
- ListViewGroupItemCollection.cs
- ToolStripProgressBar.cs
- AnnouncementEndpointElement.cs
- Operand.cs
- DataRecordInternal.cs
- selecteditemcollection.cs
- Binding.cs
- PartBasedPackageProperties.cs
- XmlPropertyBag.cs
- WorkflowLayouts.cs
- BamlResourceSerializer.cs
- ListBoxItemAutomationPeer.cs
- Int64Storage.cs
- WebServiceHandlerFactory.cs
- HttpRequestCacheValidator.cs
- ControlBuilder.cs
- TargetParameterCountException.cs
- ReceiveErrorHandling.cs
- PngBitmapEncoder.cs
- EventBuilder.cs
- PasswordBox.cs
- ClientViaElement.cs
- Symbol.cs
- _OSSOCK.cs
- XamlInt32CollectionSerializer.cs
- SafeNativeMethods.cs
- VectorKeyFrameCollection.cs
- RemoteWebConfigurationHost.cs
- ObjectSet.cs
- WindowsSysHeader.cs
- ChtmlMobileTextWriter.cs
- WmpBitmapDecoder.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ProfileParameter.cs
- mediapermission.cs
- LOSFormatter.cs
- DataFormats.cs
- SectionRecord.cs
- PtsHelper.cs
- SslStream.cs
- TypeInformation.cs
- Command.cs
- EvidenceBase.cs
- EpmContentDeSerializer.cs
- AlphaSortedEnumConverter.cs
- FastPropertyAccessor.cs
- parserscommon.cs
- PageThemeCodeDomTreeGenerator.cs
- ProfileGroupSettings.cs
- ToolStripPanelRow.cs
- DetailsViewUpdatedEventArgs.cs
- PropertyManager.cs
- ViewStateModeByIdAttribute.cs
- COM2PropertyDescriptor.cs
- MenuItem.cs
- HeaderLabel.cs
- SkipStoryboardToFill.cs