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
- FixedFindEngine.cs
- FormsAuthenticationTicket.cs
- HorizontalAlignConverter.cs
- MembershipSection.cs
- TrustManager.cs
- SecurityContextTokenValidationException.cs
- WebPartCloseVerb.cs
- Quaternion.cs
- IgnoreDataMemberAttribute.cs
- Latin1Encoding.cs
- Message.cs
- Annotation.cs
- LinearGradientBrush.cs
- DataGridHeaderBorder.cs
- CriticalFinalizerObject.cs
- ApplicationInfo.cs
- EntityDataSourceColumn.cs
- AnimatedTypeHelpers.cs
- ConfigurationManagerInternal.cs
- Resources.Designer.cs
- coordinatorfactory.cs
- BitFlagsGenerator.cs
- Stroke.cs
- QilReplaceVisitor.cs
- ConfigurationManagerHelper.cs
- SmtpDigestAuthenticationModule.cs
- HttpCacheVaryByContentEncodings.cs
- RuntimeResourceSet.cs
- ProxyGenerator.cs
- InheritedPropertyChangedEventArgs.cs
- GlyphInfoList.cs
- Paragraph.cs
- XmlSchemaSequence.cs
- ContactManager.cs
- ManagedWndProcTracker.cs
- ExistsInCollection.cs
- Link.cs
- WsiProfilesElementCollection.cs
- CollectionChangeEventArgs.cs
- PolyBezierSegment.cs
- ModelItem.cs
- ValidateNames.cs
- ServiceElement.cs
- CaseKeyBox.xaml.cs
- StructuredProperty.cs
- BitmapEffectInputData.cs
- UpdatePanelTriggerCollection.cs
- QuotedPrintableStream.cs
- QilChoice.cs
- ToolZoneDesigner.cs
- ResponseStream.cs
- XmlNodeChangedEventArgs.cs
- ResourceReferenceExpression.cs
- LineGeometry.cs
- WmlCommandAdapter.cs
- ControlParameter.cs
- SafeThemeHandle.cs
- Message.cs
- Task.cs
- Clipboard.cs
- DataSourceDesigner.cs
- Column.cs
- BaseComponentEditor.cs
- ExpressionPrefixAttribute.cs
- ImageSource.cs
- ComEventsMethod.cs
- util.cs
- sqlcontext.cs
- VerificationAttribute.cs
- ListBase.cs
- NamespaceQuery.cs
- DependencyPropertyAttribute.cs
- PackWebResponse.cs
- DesignerAutoFormatStyle.cs
- XmlCountingReader.cs
- HandledEventArgs.cs
- SerializableAuthorizationContext.cs
- Registry.cs
- AdRotator.cs
- ReadOnlyDataSource.cs
- CodeExpressionCollection.cs
- TextMarkerSource.cs
- CodeBlockBuilder.cs
- DashStyle.cs
- DeviceContexts.cs
- ControlParameter.cs
- ObjectDataSourceEventArgs.cs
- handlecollector.cs
- ToolStripMenuItem.cs
- ButtonChrome.cs
- ObjectNotFoundException.cs
- ObjectItemLoadingSessionData.cs
- WorkflowRuntimeServiceElement.cs
- StylusDevice.cs
- Privilege.cs
- ProofTokenCryptoHandle.cs
- IPEndPoint.cs
- ResourcePool.cs
- HttpCookiesSection.cs
- TransactionBridgeSection.cs