Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Net / System / Net / Mail / SmtpDigestAuthenticationModule.cs / 2 / 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; using System.Security.Authentication.ExtendedProtection; // #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, string spn, ChannelBinding channelBindingToken) { 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, spn, ContextFlags.Connection, channelBindingToken); } string resp = clientContext.GetOutgoingBlob(challenge); 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; using System.Security.Authentication.ExtendedProtection; // #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, string spn, ChannelBinding channelBindingToken) { 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, spn, ContextFlags.Connection, channelBindingToken); } string resp = clientContext.GetOutgoingBlob(challenge); 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
- WebPartConnectionsConnectVerb.cs
- SoapElementAttribute.cs
- FileDataSourceCache.cs
- FontDriver.cs
- DataGridTable.cs
- TrustManagerPromptUI.cs
- ChildDocumentBlock.cs
- SqlDataRecord.cs
- BufferModeSettings.cs
- SecurityCriticalDataForSet.cs
- ParseNumbers.cs
- FtpCachePolicyElement.cs
- ReflectionUtil.cs
- Tokenizer.cs
- GlyphsSerializer.cs
- GroupBoxRenderer.cs
- QuaternionAnimation.cs
- ExpressionHelper.cs
- CmsUtils.cs
- MappingModelBuildProvider.cs
- ColumnTypeConverter.cs
- HtmlButton.cs
- ObjectDataSourceStatusEventArgs.cs
- TreeViewImageIndexConverter.cs
- WindowsListView.cs
- InitializeCorrelation.cs
- HttpUnhandledOperationInvoker.cs
- HyperLinkDataBindingHandler.cs
- PlainXmlWriter.cs
- StylusPlugInCollection.cs
- SynchronizationContext.cs
- RuntimeIdentifierPropertyAttribute.cs
- WebPartDescription.cs
- HttpListenerResponse.cs
- PackagingUtilities.cs
- FlowDocumentPaginator.cs
- XmlDownloadManager.cs
- GeneralTransform3DCollection.cs
- UnsafeNativeMethods.cs
- SafeNativeMethods.cs
- PageSettings.cs
- ToolTipAutomationPeer.cs
- RelativeSource.cs
- DesignerListAdapter.cs
- MergeFilterQuery.cs
- RegexParser.cs
- BamlStream.cs
- FileClassifier.cs
- PropertyCollection.cs
- ResourceWriter.cs
- FixedSOMLineRanges.cs
- ListControl.cs
- ScriptServiceAttribute.cs
- SqlConnectionManager.cs
- KoreanCalendar.cs
- EndpointAddressMessageFilter.cs
- InstanceDescriptor.cs
- WindowCollection.cs
- ProcessModule.cs
- RewritingSimplifier.cs
- FontFamilyIdentifier.cs
- Odbc32.cs
- FileLevelControlBuilderAttribute.cs
- ProtocolElementCollection.cs
- MimeMapping.cs
- Message.cs
- CharacterShapingProperties.cs
- _SslSessionsCache.cs
- XPathAncestorQuery.cs
- LinkedResourceCollection.cs
- SecureEnvironment.cs
- GacUtil.cs
- Metafile.cs
- TextBoxRenderer.cs
- RouteTable.cs
- DispatcherHooks.cs
- PartialTrustVisibleAssembliesSection.cs
- TableProviderWrapper.cs
- MarshalByValueComponent.cs
- WebPartEditorOkVerb.cs
- ServiceContractAttribute.cs
- XamlTemplateSerializer.cs
- NestedContainer.cs
- RelationshipNavigation.cs
- ObjectDataSourceDisposingEventArgs.cs
- StateDesigner.Helpers.cs
- DockPattern.cs
- AssemblyBuilderData.cs
- Psha1DerivedKeyGeneratorHelper.cs
- BlurEffect.cs
- ExceptionCollection.cs
- IgnoreSection.cs
- KeyedHashAlgorithm.cs
- Dispatcher.cs
- ToolStripItem.cs
- VideoDrawing.cs
- BitmapMetadataBlob.cs
- AdornerHitTestResult.cs
- UnsafeNativeMethods.cs
- ComMethodElementCollection.cs