Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Net / System / Net / Mail / SmtpDigestAuthenticationModule.cs / 1 / SmtpDigestAuthenticationModule.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 SmtpDigestAuthenticationModule : ISmtpAuthenticationModule { Hashtable sessions = new Hashtable(); internal SmtpDigestAuthenticationModule() { } #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) { 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,"WDigest",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); } } } public string AuthenticationType { get { return "WDigest"; } } 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. //------------------------------------------------------------------------------ //// 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 SmtpDigestAuthenticationModule : ISmtpAuthenticationModule { Hashtable sessions = new Hashtable(); internal SmtpDigestAuthenticationModule() { } #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) { 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,"WDigest",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); } } } public string AuthenticationType { get { return "WDigest"; } } 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
- SystemIPv6InterfaceProperties.cs
- OleDbDataReader.cs
- DefaultShape.cs
- DeploymentExceptionMapper.cs
- GraphicsPath.cs
- CompatibleIComparer.cs
- ToolStripDropDownMenu.cs
- Parser.cs
- XmlSerializationReader.cs
- EdmValidator.cs
- XmlDocumentType.cs
- SSmlParser.cs
- DetailsViewInsertedEventArgs.cs
- Soap12ProtocolReflector.cs
- ImageUrlEditor.cs
- GenerateTemporaryTargetAssembly.cs
- _ServiceNameStore.cs
- ToolStripItemRenderEventArgs.cs
- DataSourceXmlClassAttribute.cs
- EventLog.cs
- PaperSize.cs
- ContainerControl.cs
- ProcessingInstructionAction.cs
- DesignTimeVisibleAttribute.cs
- InstancePersistence.cs
- DataRecordInternal.cs
- WindowsSolidBrush.cs
- BamlCollectionHolder.cs
- And.cs
- AnchorEditor.cs
- MouseButtonEventArgs.cs
- CompositeActivityMarkupSerializer.cs
- WindowsClaimSet.cs
- CustomSignedXml.cs
- IDReferencePropertyAttribute.cs
- DefaultValueAttribute.cs
- SiteMapNodeItemEventArgs.cs
- Missing.cs
- EntitySetDataBindingList.cs
- AnonymousIdentificationSection.cs
- SetterBase.cs
- XmlSignificantWhitespace.cs
- EditorZoneBase.cs
- MarkerProperties.cs
- SafeSystemMetrics.cs
- GuidelineSet.cs
- LingerOption.cs
- DataGridViewCellValidatingEventArgs.cs
- DataGridViewCellValueEventArgs.cs
- TextTreeInsertElementUndoUnit.cs
- ChildTable.cs
- DataControlCommands.cs
- BinaryConverter.cs
- ReverseComparer.cs
- LineBreak.cs
- ScrollBarAutomationPeer.cs
- Assembly.cs
- SerializationInfo.cs
- ResourceProviderFactory.cs
- KnownBoxes.cs
- SymbolEqualComparer.cs
- FixedSOMTextRun.cs
- DispatcherHooks.cs
- InputElement.cs
- SchemaNames.cs
- CodeAttributeDeclarationCollection.cs
- GeometryCombineModeValidation.cs
- XmlBinaryReader.cs
- RuntimeArgumentHandle.cs
- DropAnimation.xaml.cs
- DataFieldEditor.cs
- TextModifier.cs
- TrustLevel.cs
- TableRowCollection.cs
- FilterableAttribute.cs
- TextSelectionHelper.cs
- TypeExtensionConverter.cs
- BinaryNode.cs
- TypeDelegator.cs
- Converter.cs
- DataGridViewTextBoxEditingControl.cs
- HtmlEmptyTagControlBuilder.cs
- MdiWindowListItemConverter.cs
- DefaultProxySection.cs
- ConfigXmlText.cs
- SHA1CryptoServiceProvider.cs
- Imaging.cs
- ImpersonateTokenRef.cs
- XmlDigitalSignatureProcessor.cs
- SizeAnimationBase.cs
- PlatformCulture.cs
- DrawingVisualDrawingContext.cs
- SingleTagSectionHandler.cs
- ClassHandlersStore.cs
- CacheSection.cs
- UserCancellationException.cs
- RequestQueue.cs
- ValidationService.cs
- IResourceProvider.cs
- StyleSheetComponentEditor.cs