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
- FormatSettings.cs
- NotFiniteNumberException.cs
- ForceCopyBuildProvider.cs
- WSSecurityPolicy.cs
- AssemblyBuilder.cs
- ObjectResult.cs
- SqlErrorCollection.cs
- PageBreakRecord.cs
- Model3D.cs
- PowerStatus.cs
- CodeSubDirectory.cs
- StorageMappingItemCollection.cs
- EventQueueState.cs
- DropTarget.cs
- AudioDeviceOut.cs
- BinHexDecoder.cs
- FieldNameLookup.cs
- Thread.cs
- ButtonPopupAdapter.cs
- ParenthesizePropertyNameAttribute.cs
- AppDomainAttributes.cs
- StringResourceManager.cs
- NonSerializedAttribute.cs
- MinMaxParagraphWidth.cs
- Section.cs
- DSACryptoServiceProvider.cs
- DbConnectionPoolIdentity.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- MediaPlayerState.cs
- DataFieldConverter.cs
- ParamArrayAttribute.cs
- CommandDesigner.cs
- DragEvent.cs
- VisualStyleRenderer.cs
- Directory.cs
- RegularExpressionValidator.cs
- WsdlContractConversionContext.cs
- SafeHandle.cs
- DataGridViewSelectedColumnCollection.cs
- ListViewInsertionMark.cs
- TypeBuilderInstantiation.cs
- StructureChangedEventArgs.cs
- MessageQueue.cs
- WindowsAuthenticationModule.cs
- newitemfactory.cs
- Rectangle.cs
- Timeline.cs
- Number.cs
- ThousandthOfEmRealDoubles.cs
- SchemaImporterExtensionsSection.cs
- KeyEvent.cs
- SmtpAuthenticationManager.cs
- Container.cs
- InfoCardTrace.cs
- EntityCommandExecutionException.cs
- ping.cs
- SR.cs
- CustomValidator.cs
- AnnotationComponentChooser.cs
- WriteTimeStream.cs
- DLinqColumnProvider.cs
- DataKey.cs
- TextRenderingModeValidation.cs
- FontCollection.cs
- TextRunProperties.cs
- XmlCodeExporter.cs
- SafeTimerHandle.cs
- PropertyConverter.cs
- EntryWrittenEventArgs.cs
- Visitor.cs
- ProviderSettingsCollection.cs
- XmlUtil.cs
- Schema.cs
- GroupStyle.cs
- SchemaNamespaceManager.cs
- TextEditorCharacters.cs
- DefaultHttpHandler.cs
- URLMembershipCondition.cs
- HttpResponseWrapper.cs
- ConstructorNeedsTagAttribute.cs
- CacheDependency.cs
- ServiceTimeoutsBehavior.cs
- SqlDataReaderSmi.cs
- SqlUtils.cs
- BulletDecorator.cs
- SID.cs
- WebPartChrome.cs
- SmiMetaData.cs
- NotifyIcon.cs
- LOSFormatter.cs
- RectangleHotSpot.cs
- ReaderWriterLock.cs
- CodeEntryPointMethod.cs
- SmtpDigestAuthenticationModule.cs
- TextDecorations.cs
- XmlSchemaValidator.cs
- OleStrCAMarshaler.cs
- DesignerHelpers.cs
- GeneralTransform2DTo3D.cs
- RenderCapability.cs