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
- NotifyIcon.cs
- ObsoleteAttribute.cs
- ReflectionPermission.cs
- CryptographicAttribute.cs
- PagePropertiesChangingEventArgs.cs
- TouchDevice.cs
- PrimitiveType.cs
- DataBindingHandlerAttribute.cs
- ProfileGroupSettings.cs
- TileModeValidation.cs
- ObjectDataSourceEventArgs.cs
- AlphabeticalEnumConverter.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- TreeIterators.cs
- ReadOnlyState.cs
- SQLSingle.cs
- Inline.cs
- DataSourceSelectArguments.cs
- ConditionedDesigner.cs
- XmlStrings.cs
- DataGridColumnCollection.cs
- RadioButtonFlatAdapter.cs
- ActivityExecutionFilter.cs
- ItemsPanelTemplate.cs
- ScriptModule.cs
- StaticResourceExtension.cs
- GraphicsContext.cs
- DirectoryInfo.cs
- SettingsPropertyCollection.cs
- CatalogZoneBase.cs
- CalloutQueueItem.cs
- SmtpNetworkElement.cs
- OperationAbortedException.cs
- MergablePropertyAttribute.cs
- DataTablePropertyDescriptor.cs
- PathFigureCollectionConverter.cs
- sqlser.cs
- LinearGradientBrush.cs
- EntityType.cs
- ExceptQueryOperator.cs
- TemplateNodeContextMenu.cs
- TimersDescriptionAttribute.cs
- SqlExpander.cs
- JsonEnumDataContract.cs
- TemplateKeyConverter.cs
- ByteKeyFrameCollection.cs
- RuntimeEnvironment.cs
- DecoderExceptionFallback.cs
- ToolStripCustomTypeDescriptor.cs
- KeySplineConverter.cs
- DrawingGroupDrawingContext.cs
- Header.cs
- PersonalizationProviderCollection.cs
- PackageProperties.cs
- MsmqAuthenticationMode.cs
- RequestBringIntoViewEventArgs.cs
- Trace.cs
- BitmapImage.cs
- SettingsAttributes.cs
- RegexCapture.cs
- ChangeInterceptorAttribute.cs
- AbstractSvcMapFileLoader.cs
- xdrvalidator.cs
- ADMembershipProvider.cs
- ColorMatrix.cs
- ClientTargetSection.cs
- MenuAdapter.cs
- BoolExpressionVisitors.cs
- indexingfiltermarshaler.cs
- LogLogRecordEnumerator.cs
- AtomPub10CategoriesDocumentFormatter.cs
- WebConfigurationManager.cs
- ListCommandEventArgs.cs
- AsyncStreamReader.cs
- NamespaceInfo.cs
- GenericAuthenticationEventArgs.cs
- BooleanExpr.cs
- SetUserLanguageRequest.cs
- PLINQETWProvider.cs
- ObjectAnimationUsingKeyFrames.cs
- MailWebEventProvider.cs
- XmlStreamStore.cs
- SessionState.cs
- DefaultMemberAttribute.cs
- XmlHierarchicalEnumerable.cs
- BlockUIContainer.cs
- CellCreator.cs
- Translator.cs
- KnownTypesHelper.cs
- EdmItemCollection.cs
- ColorAnimationBase.cs
- ComponentSerializationService.cs
- ImageBrush.cs
- xmlfixedPageInfo.cs
- CmsInterop.cs
- SqlReferenceCollection.cs
- ClosableStream.cs
- CodeCatchClauseCollection.cs
- ThousandthOfEmRealPoints.cs
- Tuple.cs