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
- AndCondition.cs
- BasicViewGenerator.cs
- DateTime.cs
- ExpandCollapseIsCheckedConverter.cs
- ImageSource.cs
- UIPermission.cs
- TransformCryptoHandle.cs
- CodeSnippetCompileUnit.cs
- InstancePersistenceContext.cs
- CollectionViewGroupRoot.cs
- DataServiceQueryOfT.cs
- DesignOnlyAttribute.cs
- TextEditorCharacters.cs
- TiffBitmapDecoder.cs
- ToolboxCategoryItems.cs
- WebPartAddingEventArgs.cs
- BindingListCollectionView.cs
- ListViewAutomationPeer.cs
- RawStylusInputCustomDataList.cs
- SoapMessage.cs
- dbenumerator.cs
- DiagnosticTraceSource.cs
- PagerSettings.cs
- PackageDigitalSignature.cs
- Helper.cs
- ProfileInfo.cs
- CacheForPrimitiveTypes.cs
- _Win32.cs
- DecimalAnimationUsingKeyFrames.cs
- DropSource.cs
- FloaterParaClient.cs
- MethodToken.cs
- dbdatarecord.cs
- HuffmanTree.cs
- TimersDescriptionAttribute.cs
- UnknownWrapper.cs
- StyleBamlRecordReader.cs
- ComplexType.cs
- DiagnosticsConfigurationHandler.cs
- ContentElementAutomationPeer.cs
- XmlSiteMapProvider.cs
- ComPlusTypeValidator.cs
- OutputScopeManager.cs
- GenericTextProperties.cs
- WCFModelStrings.Designer.cs
- FormatVersion.cs
- MailMessageEventArgs.cs
- NumberFunctions.cs
- SortAction.cs
- BaseTransportHeaders.cs
- DataGrid.cs
- WeakHashtable.cs
- BitmapDownload.cs
- NumberFormatter.cs
- MimeFormImporter.cs
- ListViewDeletedEventArgs.cs
- RTTrackingProfile.cs
- DataViewListener.cs
- XmlStreamStore.cs
- InsufficientMemoryException.cs
- NoneExcludedImageIndexConverter.cs
- ObjectConverter.cs
- ObjectDataSourceStatusEventArgs.cs
- InkCanvasFeedbackAdorner.cs
- PropertyGridEditorPart.cs
- DateTimeConverter.cs
- XmlBinaryReader.cs
- PolicyManager.cs
- SecurityException.cs
- Normalizer.cs
- ClosableStream.cs
- initElementDictionary.cs
- RemotingService.cs
- DSACryptoServiceProvider.cs
- WithStatement.cs
- DispatchWrapper.cs
- IList.cs
- TemplateBindingExpressionConverter.cs
- File.cs
- _ProxyChain.cs
- NameObjectCollectionBase.cs
- MetafileHeader.cs
- Literal.cs
- ProcessRequestArgs.cs
- ToolStripContainerActionList.cs
- StrokeDescriptor.cs
- NativeMethods.cs
- DataService.cs
- WMIInterop.cs
- SettingsSavedEventArgs.cs
- JsonDeserializer.cs
- DbParameterCollectionHelper.cs
- FaultPropagationQuery.cs
- CommonDialog.cs
- MsmqAppDomainProtocolHandler.cs
- ListViewTableRow.cs
- HttpModuleActionCollection.cs
- UserPreferenceChangedEventArgs.cs
- InputProcessorProfiles.cs
- XmlSchemaException.cs