Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Mail / SmtpNtlmAuthenticationModule.cs / 2 / 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; // #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) { 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,null,ContextFlags.Connection); } string resp = (challenge != null ? clientContext.GetOutgoingBlob(challenge) : clientContext.GetOutgoingBlob(null)); 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 } }
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextPointerBase.cs
- MetadataCache.cs
- SafeNativeMethods.cs
- DefaultBinder.cs
- versioninfo.cs
- SchemaTableOptionalColumn.cs
- cookie.cs
- PortCache.cs
- GridViewDesigner.cs
- SaveFileDialog.cs
- EntityDataReader.cs
- SaveFileDialog.cs
- DBSchemaTable.cs
- UpdateProgress.cs
- MarkerProperties.cs
- CryptoStream.cs
- DrawingBrush.cs
- AppSettingsExpressionBuilder.cs
- CssClassPropertyAttribute.cs
- TableLayoutPanelResizeGlyph.cs
- CatalogPartChrome.cs
- Scheduling.cs
- CompositeKey.cs
- XPathException.cs
- CodeAccessSecurityEngine.cs
- ItemCollection.cs
- WebPartCancelEventArgs.cs
- WebControlAdapter.cs
- DesignerVerb.cs
- DBConnection.cs
- AsyncPostBackTrigger.cs
- BitmapFrame.cs
- TerminatorSinks.cs
- DataKey.cs
- RectAnimationClockResource.cs
- DnsEndpointIdentity.cs
- XPathDescendantIterator.cs
- HtmlHistory.cs
- DbSource.cs
- X509ChainPolicy.cs
- BaseTemplateBuildProvider.cs
- StaticTextPointer.cs
- LabelExpression.cs
- SourceInterpreter.cs
- BitmapSourceSafeMILHandle.cs
- Profiler.cs
- ReaderContextStackData.cs
- ConfigXmlSignificantWhitespace.cs
- DesignerOptionService.cs
- Stroke.cs
- ReturnEventArgs.cs
- HttpModule.cs
- MappedMetaModel.cs
- InvalidPrinterException.cs
- Setter.cs
- ApplicationActivator.cs
- FloaterParagraph.cs
- ColorTransformHelper.cs
- TitleStyle.cs
- ListViewItem.cs
- _ListenerAsyncResult.cs
- TypeDependencyAttribute.cs
- MimeImporter.cs
- PeerPresenceInfo.cs
- WebPartDisplayModeCancelEventArgs.cs
- SourceFileBuildProvider.cs
- PerformanceCounters.cs
- Figure.cs
- DataGridViewDataErrorEventArgs.cs
- PropertyDescriptorComparer.cs
- OleDbError.cs
- LeftCellWrapper.cs
- ContextBase.cs
- baseshape.cs
- Win32SafeHandles.cs
- _LazyAsyncResult.cs
- RepeaterItemEventArgs.cs
- UrlPath.cs
- DoubleCollection.cs
- OutputWindow.cs
- FastEncoder.cs
- ConfigurationStrings.cs
- AuthenticationModuleElement.cs
- Regex.cs
- ObjectComplexPropertyMapping.cs
- PopupEventArgs.cs
- FullTrustAssemblyCollection.cs
- basecomparevalidator.cs
- TypeConverterAttribute.cs
- MetadataItemCollectionFactory.cs
- PersonalizationStateQuery.cs
- BridgeDataReader.cs
- SecurityElement.cs
- HwndHost.cs
- SmtpLoginAuthenticationModule.cs
- ChannelFactoryBase.cs
- InfiniteTimeSpanConverter.cs
- HtmlButton.cs
- ListDictionaryInternal.cs
- MessageQueuePermissionEntryCollection.cs