Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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; // #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 } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- QuadraticBezierSegment.cs
- CachedRequestParams.cs
- ISAPIRuntime.cs
- base64Transforms.cs
- HtmlHead.cs
- MessageEnumerator.cs
- ImageDrawing.cs
- DataGridViewRowHeaderCell.cs
- UpdateCommand.cs
- CompoundFileStorageReference.cs
- Cursor.cs
- AuthenticatingEventArgs.cs
- WindowsSpinner.cs
- BitmapEffectDrawingContent.cs
- HeaderedItemsControl.cs
- HttpListener.cs
- StreamGeometryContext.cs
- CodeDOMUtility.cs
- RayHitTestParameters.cs
- URLIdentityPermission.cs
- Triplet.cs
- JoinTreeNode.cs
- KeyValuePairs.cs
- HierarchicalDataSourceDesigner.cs
- PieceDirectory.cs
- RenamedEventArgs.cs
- PermissionSet.cs
- ContentType.cs
- ReadOnlyDataSourceView.cs
- OptimizerPatterns.cs
- Point3DCollection.cs
- EmptyEnumerator.cs
- ToolStripPanelDesigner.cs
- CatalogZoneDesigner.cs
- WizardPanel.cs
- BuildResult.cs
- CompilerError.cs
- WorkflowMarkupSerializer.cs
- RuntimeWrappedException.cs
- DesignerHost.cs
- AssemblyBuilder.cs
- JoinGraph.cs
- TemplateBindingExtension.cs
- DrawToolTipEventArgs.cs
- ProviderBase.cs
- KeyValuePair.cs
- listitem.cs
- CoTaskMemHandle.cs
- CmsInterop.cs
- LocalizabilityAttribute.cs
- WeakEventManager.cs
- CultureInfo.cs
- FileCodeGroup.cs
- KeyedCollection.cs
- DropShadowEffect.cs
- SpnegoTokenProvider.cs
- SynchronizingStream.cs
- EmptyEnumerable.cs
- loginstatus.cs
- ExpressionTextBoxAutomationPeer.cs
- PopupRoot.cs
- Margins.cs
- PostBackTrigger.cs
- PropertyChangingEventArgs.cs
- CorrelationService.cs
- PassportAuthenticationModule.cs
- InputMethodStateChangeEventArgs.cs
- OleDbConnectionInternal.cs
- IssuedTokenClientBehaviorsElement.cs
- HttpCacheVary.cs
- RegionData.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- ApplicationDirectory.cs
- RelatedPropertyManager.cs
- MultiTargetingUtil.cs
- XmlQueryContext.cs
- ConfigurationLocation.cs
- DataRecordInfo.cs
- JsonFaultDetail.cs
- OdbcReferenceCollection.cs
- AsyncStreamReader.cs
- Comparer.cs
- HwndStylusInputProvider.cs
- XmlSchemaObjectCollection.cs
- WorkflowPersistenceContext.cs
- AstTree.cs
- AuthStoreRoleProvider.cs
- UserPreferenceChangedEventArgs.cs
- RC2.cs
- HttpCapabilitiesBase.cs
- Pen.cs
- LocalBuilder.cs
- TableParaClient.cs
- FileDialog_Vista.cs
- OutOfProcStateClientManager.cs
- DataGridViewCellEventArgs.cs
- ToolboxBitmapAttribute.cs
- ImageMapEventArgs.cs
- ConditionCollection.cs
- _AutoWebProxyScriptHelper.cs