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
- TimeoutValidationAttribute.cs
- CodeCompileUnit.cs
- MailWebEventProvider.cs
- MembershipUser.cs
- XmlSchemaComplexType.cs
- SystemDiagnosticsSection.cs
- WindowsTokenRoleProvider.cs
- AssemblyContextControlItem.cs
- BrowserTree.cs
- DrawTreeNodeEventArgs.cs
- TextChangedEventArgs.cs
- DataGridViewRowHeaderCell.cs
- XmlSigningNodeWriter.cs
- MetadataCollection.cs
- HandleInitializationContext.cs
- PixelFormats.cs
- EqualityComparer.cs
- TextFormatterContext.cs
- HwndHostAutomationPeer.cs
- HtmlToClrEventProxy.cs
- TextDecorationUnitValidation.cs
- CustomAttribute.cs
- SimpleType.cs
- XamlSerializer.cs
- precedingquery.cs
- Win32.cs
- ConfigurationManagerInternal.cs
- EventTrigger.cs
- TextRange.cs
- ToolBarButtonClickEvent.cs
- designeractionlistschangedeventargs.cs
- ListViewItemSelectionChangedEvent.cs
- GraphicsContainer.cs
- HtmlInputCheckBox.cs
- DecimalAnimationBase.cs
- TextMessageEncodingBindingElement.cs
- InvalidComObjectException.cs
- SingleBodyParameterMessageFormatter.cs
- Number.cs
- OrderingQueryOperator.cs
- WorkflowClientDeliverMessageWrapper.cs
- WebBrowserNavigatingEventHandler.cs
- WebProxyScriptElement.cs
- TextElementEnumerator.cs
- Shape.cs
- GraphicsPathIterator.cs
- DesignerActionService.cs
- WebUtil.cs
- ComponentTray.cs
- NodeFunctions.cs
- X509RawDataKeyIdentifierClause.cs
- VisualProxy.cs
- StateRuntime.cs
- HtmlLabelAdapter.cs
- ConfigurationConverterBase.cs
- XmlWhitespace.cs
- TaiwanCalendar.cs
- InternalConfigConfigurationFactory.cs
- XmlAttribute.cs
- ManagedIStream.cs
- WebPartEditorCancelVerb.cs
- XslNumber.cs
- MonikerUtility.cs
- UnknownWrapper.cs
- FullTextState.cs
- EncoderReplacementFallback.cs
- FixedTextContainer.cs
- ColorConvertedBitmap.cs
- XXXInfos.cs
- DialogResultConverter.cs
- DisposableCollectionWrapper.cs
- Registry.cs
- TextContainerHelper.cs
- StylusPointPropertyId.cs
- VBCodeProvider.cs
- ImageAnimator.cs
- M3DUtil.cs
- ZoneLinkButton.cs
- UrlMapping.cs
- TabItemWrapperAutomationPeer.cs
- SelectionProviderWrapper.cs
- IconBitmapDecoder.cs
- OdbcConnectionHandle.cs
- DataServiceResponse.cs
- DataGridViewTextBoxEditingControl.cs
- AsyncStreamReader.cs
- externdll.cs
- BufferedReadStream.cs
- DisplayNameAttribute.cs
- PropertyRecord.cs
- PasswordRecovery.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- listitem.cs
- __TransparentProxy.cs
- NCryptNative.cs
- MetaData.cs
- SocketPermission.cs
- XAMLParseException.cs
- ValidatorAttribute.cs
- RolePrincipal.cs