Code:
/ DotNET / DotNET / 8.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
- IssuedTokenClientBehaviorsElementCollection.cs
- QilReplaceVisitor.cs
- MessageSecurityProtocol.cs
- PathStreamGeometryContext.cs
- UnmanagedHandle.cs
- Padding.cs
- HitTestDrawingContextWalker.cs
- ISCIIEncoding.cs
- ToolZone.cs
- IdentityHolder.cs
- UnmanagedBitmapWrapper.cs
- ExtensibleClassFactory.cs
- SqlStream.cs
- SHA256.cs
- ManagementEventArgs.cs
- KeyValueConfigurationCollection.cs
- ModulesEntry.cs
- ThaiBuddhistCalendar.cs
- ConfigXmlAttribute.cs
- ConfigurationElement.cs
- HandlerElementCollection.cs
- TraceContextEventArgs.cs
- SchemaType.cs
- DataSourceCache.cs
- ReadOnlyActivityGlyph.cs
- AutoGeneratedField.cs
- EntityDataSourceWrapper.cs
- CompleteWizardStep.cs
- AssociationEndMember.cs
- TextElementCollectionHelper.cs
- Byte.cs
- CmsInterop.cs
- FlowDocumentFormatter.cs
- Camera.cs
- RoutedCommand.cs
- Win32KeyboardDevice.cs
- ManagementEventWatcher.cs
- XmlUtilWriter.cs
- ContentHostHelper.cs
- IdleTimeoutMonitor.cs
- QilTargetType.cs
- propertyentry.cs
- BackStopAuthenticationModule.cs
- ReflectionUtil.cs
- ContractHandle.cs
- XmlILStorageConverter.cs
- DrawItemEvent.cs
- ConditionalDesigner.cs
- RegistryConfigurationProvider.cs
- StatusBarPanelClickEvent.cs
- CatalogPart.cs
- ProfileProvider.cs
- DragEvent.cs
- TransformedBitmap.cs
- ControlBuilderAttribute.cs
- NamedPipeTransportSecurity.cs
- AdRotator.cs
- TdsParserSafeHandles.cs
- TextBlockAutomationPeer.cs
- SecurityPermission.cs
- WebBrowserDesigner.cs
- Message.cs
- ExternalFile.cs
- AutomationAttributeInfo.cs
- TextTreeUndoUnit.cs
- TreeChangeInfo.cs
- KeyToListMap.cs
- ListView.cs
- Int16Animation.cs
- InvokeWebServiceDesigner.cs
- StatusBarDrawItemEvent.cs
- ConnectionStringsExpressionBuilder.cs
- HandlerFactoryCache.cs
- TabControlCancelEvent.cs
- PeerApplication.cs
- Light.cs
- MarginsConverter.cs
- PermissionToken.cs
- FrameworkElementAutomationPeer.cs
- AnnotationMap.cs
- DynamicObjectAccessor.cs
- BitmapEffectDrawing.cs
- DecimalStorage.cs
- ObjectSet.cs
- FormsAuthenticationConfiguration.cs
- ListViewItemEventArgs.cs
- MorphHelper.cs
- WeakReferenceKey.cs
- DatePicker.cs
- ClientTarget.cs
- RSAPKCS1SignatureDeformatter.cs
- Deflater.cs
- IOThreadTimer.cs
- UnknownWrapper.cs
- ToolStripSystemRenderer.cs
- ToolStripDropDownItemDesigner.cs
- ScriptingRoleServiceSection.cs
- LineProperties.cs
- SqlFunctionAttribute.cs
- SynchronizationHandlesCodeDomSerializer.cs