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
- ZipIOModeEnforcingStream.cs
- IEnumerable.cs
- CallContext.cs
- DateTime.cs
- XmlCharType.cs
- Queue.cs
- ListBoxDesigner.cs
- ContractCodeDomInfo.cs
- SoapException.cs
- RadioButton.cs
- GetWinFXPath.cs
- DynamicILGenerator.cs
- WizardPanel.cs
- RectValueSerializer.cs
- XmlSchemaAttribute.cs
- FixedDocumentPaginator.cs
- SimpleApplicationHost.cs
- WebPartConnectionsCloseVerb.cs
- ASCIIEncoding.cs
- ViewCellRelation.cs
- AccessedThroughPropertyAttribute.cs
- GiveFeedbackEventArgs.cs
- WindowInteractionStateTracker.cs
- SocketInformation.cs
- EventSinkHelperWriter.cs
- ExplicitDiscriminatorMap.cs
- ServicesUtilities.cs
- RSAOAEPKeyExchangeDeformatter.cs
- FieldAccessException.cs
- IgnoreDeviceFilterElement.cs
- RepeatInfo.cs
- DesignerCommandAdapter.cs
- Soap.cs
- EventToken.cs
- LowerCaseStringConverter.cs
- EventDescriptorCollection.cs
- MouseButtonEventArgs.cs
- RepeatInfo.cs
- ButtonBase.cs
- OperandQuery.cs
- CodeTypeDelegate.cs
- StrongNamePublicKeyBlob.cs
- PropertyValidationContext.cs
- DefaultBinder.cs
- XsdValidatingReader.cs
- EventSetter.cs
- DSASignatureDeformatter.cs
- InputProcessorProfilesLoader.cs
- XamlFilter.cs
- SerTrace.cs
- ExceptionUtil.cs
- RTLAwareMessageBox.cs
- ParameterToken.cs
- DelayedRegex.cs
- ContentElement.cs
- MetadataPropertyAttribute.cs
- KnownTypesHelper.cs
- ToggleProviderWrapper.cs
- PerformanceCounterPermission.cs
- MetadataAssemblyHelper.cs
- MetroSerializationManager.cs
- TableLayoutPanelCellPosition.cs
- BlurBitmapEffect.cs
- SmtpNetworkElement.cs
- EntityEntry.cs
- ParameterEditorUserControl.cs
- AttachmentCollection.cs
- ActivityDesignerResources.cs
- PageParser.cs
- QuaternionKeyFrameCollection.cs
- XmlUtilWriter.cs
- StringHelper.cs
- DataGridViewButtonColumn.cs
- StyleTypedPropertyAttribute.cs
- TextCharacters.cs
- RectangleHotSpot.cs
- EventLogPermission.cs
- BufferedWebEventProvider.cs
- _PooledStream.cs
- HashSetDebugView.cs
- DesignTimeTemplateParser.cs
- IisTraceWebEventProvider.cs
- ISessionStateStore.cs
- SslStream.cs
- ProfileParameter.cs
- WorkflowExecutor.cs
- NumberSubstitution.cs
- UrlMappingCollection.cs
- DataViewSetting.cs
- AppSettingsExpressionBuilder.cs
- ZipIOLocalFileBlock.cs
- PolicyValidationException.cs
- ExtentJoinTreeNode.cs
- EntityViewContainer.cs
- MenuAdapter.cs
- TabControl.cs
- SetterBase.cs
- ConfigurationStrings.cs
- SchemaCreator.cs
- ContentTextAutomationPeer.cs