Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Mail / SmtpNtlmAuthenticationModule.cs / 1305376 / SmtpNtlmAuthenticationModule.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net.Mail { using System; using System.Collections; using System.IO; using System.Net; using System.Security.Permissions; using System.Security.Authentication.ExtendedProtection; // #if MAKE_MAILCLIENT_PUBLIC internal #else internal #endif class SmtpNtlmAuthenticationModule : ISmtpAuthenticationModule { Hashtable sessions = new Hashtable(); internal SmtpNtlmAuthenticationModule() { } #region ISmtpAuthenticationModule Members // Security this method will access NetworkCredential properties that demand UnmanagedCode and Environment Permission [EnvironmentPermission(SecurityAction.Assert, Unrestricted=true)] [SecurityPermission(SecurityAction.Assert, Flags=SecurityPermissionFlag.UnmanagedCode)] public Authorization Authenticate(string challenge, NetworkCredential credential, object sessionCookie, string spn, ChannelBinding channelBindingToken) { if(Logging.On)Logging.Enter(Logging.Web, this, "Authenticate", null); try { lock (this.sessions) { NTAuthentication clientContext = this.sessions[sessionCookie] as NTAuthentication; if (clientContext == null) { if(credential == null){ return null; } this.sessions[sessionCookie] = clientContext = new NTAuthentication(false, "Ntlm", credential, spn, ContextFlags.Connection, channelBindingToken); } string resp = clientContext.GetOutgoingBlob(challenge); if (!clientContext.IsCompleted) { return new Authorization(resp, false); } else { this.sessions.Remove(sessionCookie); return new Authorization(resp, true); } } } finally { if(Logging.On)Logging.Exit(Logging.Web, this, "Authenticate", null); } } public string AuthenticationType { get { return "ntlm"; } } public void CloseContext(object sessionCookie) { // This is a no-op since the context is not // kept open by this module beyond auth completion. } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DesignTimeVisibleAttribute.cs
- TerminatorSinks.cs
- Crc32.cs
- XomlCompiler.cs
- XmlSequenceWriter.cs
- Stacktrace.cs
- PasswordPropertyTextAttribute.cs
- initElementDictionary.cs
- DataGridTableCollection.cs
- AutoResetEvent.cs
- MenuItemAutomationPeer.cs
- ExtendedPropertyCollection.cs
- DataRowComparer.cs
- ResourcesGenerator.cs
- ControlParameter.cs
- IBuiltInEvidence.cs
- SafeFileMapViewHandle.cs
- NullableConverter.cs
- StorageAssociationSetMapping.cs
- SizeChangedInfo.cs
- ButtonPopupAdapter.cs
- RegexInterpreter.cs
- RawStylusInputCustomData.cs
- ExitEventArgs.cs
- CompiledXpathExpr.cs
- PointAnimation.cs
- HttpCookieCollection.cs
- CharUnicodeInfo.cs
- GenerateScriptTypeAttribute.cs
- PLINQETWProvider.cs
- EntityKeyElement.cs
- ObjectAnimationUsingKeyFrames.cs
- EntityDataSourceReferenceGroup.cs
- Cursor.cs
- AuthenticationServiceManager.cs
- WindowsStreamSecurityUpgradeProvider.cs
- DocumentXPathNavigator.cs
- GridEntryCollection.cs
- TextEvent.cs
- DataRowView.cs
- SecurityDescriptor.cs
- HttpHeaderCollection.cs
- Dynamic.cs
- LinkLabel.cs
- MenuItemBindingCollection.cs
- Screen.cs
- TableProvider.cs
- DependencyPropertyChangedEventArgs.cs
- DataControlCommands.cs
- DecimalKeyFrameCollection.cs
- ArcSegment.cs
- WMICapabilities.cs
- InvalidWMPVersionException.cs
- SemaphoreFullException.cs
- InterleavedZipPartStream.cs
- SqlUserDefinedTypeAttribute.cs
- Matrix3DConverter.cs
- dataSvcMapFileLoader.cs
- NumberFormatter.cs
- _DomainName.cs
- NonParentingControl.cs
- TransportChannelListener.cs
- TrackingMemoryStream.cs
- ControlValuePropertyAttribute.cs
- EventLogTraceListener.cs
- HwndSourceKeyboardInputSite.cs
- FileUtil.cs
- Bits.cs
- DecimalConverter.cs
- ListBase.cs
- WebRequestModuleElement.cs
- ObjectSpanRewriter.cs
- AttachedProperty.cs
- OneToOneMappingSerializer.cs
- InstanceDataCollection.cs
- NumberFormatInfo.cs
- AutoGeneratedFieldProperties.cs
- QueryCursorEventArgs.cs
- UnsafeNativeMethods.cs
- ProtocolProfile.cs
- DiscoveryInnerClientManaged11.cs
- SessionEndedEventArgs.cs
- BufferedWebEventProvider.cs
- DataMemberFieldEditor.cs
- XDRSchema.cs
- MailSettingsSection.cs
- SqlDataSourceCommandEventArgs.cs
- ParenExpr.cs
- StorageMappingItemCollection.cs
- MasterPage.cs
- ConfigPathUtility.cs
- login.cs
- InkCanvasSelection.cs
- HandledEventArgs.cs
- MethodBuilder.cs
- TextEditorSpelling.cs
- LocationSectionRecord.cs
- Variable.cs
- HttpHandlersSection.cs
- CustomGrammar.cs