Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Net / System / Net / Mail / SmtpDigestAuthenticationModule.cs / 5 / 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
- Selection.cs
- XmlBindingWorker.cs
- EnterpriseServicesHelper.cs
- ClientBuildManager.cs
- TableHeaderCell.cs
- XmlMtomWriter.cs
- SecurityKeyIdentifier.cs
- XmlUrlResolver.cs
- ListViewAutomationPeer.cs
- SystemColors.cs
- KeyEventArgs.cs
- StreamUpgradeInitiator.cs
- NavigatorOutput.cs
- FlatButtonAppearance.cs
- ZipIOModeEnforcingStream.cs
- HttpListenerResponse.cs
- DBBindings.cs
- IPipelineRuntime.cs
- MissingMemberException.cs
- ResourceKey.cs
- BitmapEffectCollection.cs
- JsonFormatGeneratorStatics.cs
- HostAdapter.cs
- PointAnimationUsingKeyFrames.cs
- SQLInt16Storage.cs
- AuthorizationSection.cs
- XmlSchemaSimpleTypeRestriction.cs
- DbMetaDataFactory.cs
- File.cs
- DelegateBodyWriter.cs
- FacetValues.cs
- TextEditorCharacters.cs
- AmbientEnvironment.cs
- TableAdapterManagerMethodGenerator.cs
- ConnectionsZone.cs
- TransactionChannelFactory.cs
- ReflectPropertyDescriptor.cs
- HebrewCalendar.cs
- ToolStripDesignerAvailabilityAttribute.cs
- ProbeMatchesMessageCD1.cs
- UrlMappingCollection.cs
- ConstructorArgumentAttribute.cs
- PerformanceCounterManager.cs
- MailHeaderInfo.cs
- WindowsFormsSynchronizationContext.cs
- SiteMapPath.cs
- URI.cs
- MsmqTransportSecurityElement.cs
- ButtonRenderer.cs
- MsmqIntegrationChannelFactory.cs
- Image.cs
- __ConsoleStream.cs
- RepeatButton.cs
- ValidationSummary.cs
- JsonEnumDataContract.cs
- FigureHelper.cs
- BaseUriHelper.cs
- FrameworkContentElement.cs
- SettingsAttributeDictionary.cs
- RandomNumberGenerator.cs
- DataGridHyperlinkColumn.cs
- PassportAuthentication.cs
- SpAudioStreamWrapper.cs
- FamilyMap.cs
- HtmlEmptyTagControlBuilder.cs
- XmlSchemaAny.cs
- DesignTimeData.cs
- DbDataAdapter.cs
- RichTextBoxConstants.cs
- FullTrustAssembliesSection.cs
- XPathConvert.cs
- AutomationPropertyInfo.cs
- Char.cs
- UnsafeNativeMethodsPenimc.cs
- ImageCreator.cs
- HostedBindingBehavior.cs
- NavigationFailedEventArgs.cs
- FileEnumerator.cs
- BrushProxy.cs
- IndividualDeviceConfig.cs
- PropertyGridView.cs
- Literal.cs
- AuthenticationSection.cs
- ListenerSessionConnection.cs
- Transaction.cs
- InvalidAsynchronousStateException.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- Win32.cs
- BasePattern.cs
- IdentitySection.cs
- InputMethodStateChangeEventArgs.cs
- WindowsIPAddress.cs
- ColorDialog.cs
- BaseParagraph.cs
- peersecuritysettings.cs
- TypeConstant.cs
- SqlDataSourceEnumerator.cs
- CompilerGlobalScopeAttribute.cs
- DropShadowEffect.cs
- PersonalizationStateQuery.cs