Code:
/ DotNET / DotNET / 8.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

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextServicesDisplayAttribute.cs
- AssemblyFilter.cs
- RelatedView.cs
- BCLDebug.cs
- Gdiplus.cs
- PropertyIdentifier.cs
- AppSettingsExpressionBuilder.cs
- Vector3DConverter.cs
- WhileDesigner.cs
- Tablet.cs
- UnregisterInfo.cs
- Simplifier.cs
- GeneralTransform3DGroup.cs
- DataContractSerializerFaultFormatter.cs
- PingOptions.cs
- ColorTypeConverter.cs
- DataGridRelationshipRow.cs
- ManagedIStream.cs
- PerformanceCounterPermission.cs
- FileSystemEventArgs.cs
- ImageFormat.cs
- HasCopySemanticsAttribute.cs
- ComponentEvent.cs
- SharedStatics.cs
- WorkflowTraceTransfer.cs
- UserNameSecurityTokenProvider.cs
- AddInServer.cs
- UpWmlPageAdapter.cs
- PackageRelationship.cs
- AnimationException.cs
- CompressStream.cs
- ServiceHost.cs
- ClientSettings.cs
- TiffBitmapEncoder.cs
- CatalogPartChrome.cs
- ResourceDisplayNameAttribute.cs
- RealProxy.cs
- ElapsedEventArgs.cs
- DefaultProfileManager.cs
- LogExtentCollection.cs
- DesignerWebPartChrome.cs
- pingexception.cs
- VScrollProperties.cs
- FormViewInsertEventArgs.cs
- HashHelpers.cs
- RectValueSerializer.cs
- ConnectionPoolManager.cs
- DataSourceCacheDurationConverter.cs
- StorageConditionPropertyMapping.cs
- ContextInformation.cs
- HandoffBehavior.cs
- PropertyIDSet.cs
- StickyNoteHelper.cs
- ElementsClipboardData.cs
- OrCondition.cs
- HttpModulesSection.cs
- List.cs
- PaperSource.cs
- QueryReaderSettings.cs
- GifBitmapDecoder.cs
- Semaphore.cs
- ErrorStyle.cs
- ISessionStateStore.cs
- CollectionChangeEventArgs.cs
- ExportOptions.cs
- SiteMapDataSourceView.cs
- COM2Properties.cs
- ParameterRetriever.cs
- ReturnType.cs
- ToolStripDropDown.cs
- NavigatorOutput.cs
- UIElement3D.cs
- BulletedListEventArgs.cs
- TypeDescriptor.cs
- Visitors.cs
- ObjectViewFactory.cs
- DelegatingTypeDescriptionProvider.cs
- ImageAutomationPeer.cs
- FixedDSBuilder.cs
- XmlDataLoader.cs
- DataGridViewBand.cs
- SupportsEventValidationAttribute.cs
- Utilities.cs
- ImageCodecInfoPrivate.cs
- CryptoKeySecurity.cs
- WorkflowRuntimeBehavior.cs
- GCHandleCookieTable.cs
- SqlNode.cs
- XmlSchemaInfo.cs
- SHA384.cs
- RelationshipEndMember.cs
- SHA256Managed.cs
- BaseValidator.cs
- ViewService.cs
- UInt64Converter.cs
- ObjectConverter.cs
- StorageBasedPackageProperties.cs
- GatewayDefinition.cs
- ExpressionBuilder.cs
- SmiEventSink_DeferedProcessing.cs