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
- RuleInfoComparer.cs
- storepermissionattribute.cs
- IsolatedStorageFilePermission.cs
- SoapAttributeAttribute.cs
- Compiler.cs
- ComboBoxAutomationPeer.cs
- Utils.cs
- SecurityContext.cs
- KeyedCollection.cs
- ModelItemImpl.cs
- TemplateBamlRecordReader.cs
- RectangleGeometry.cs
- OrderingQueryOperator.cs
- DesignerResources.cs
- UTF8Encoding.cs
- DataPager.cs
- RadioButtonRenderer.cs
- PresentationSource.cs
- ObjectStateManager.cs
- CookieParameter.cs
- TextCollapsingProperties.cs
- InplaceBitmapMetadataWriter.cs
- RegexCompilationInfo.cs
- ConstraintStruct.cs
- DataGridState.cs
- WebPartDisplayModeCancelEventArgs.cs
- OdbcConnectionHandle.cs
- AsmxEndpointPickerExtension.cs
- DocobjHost.cs
- DetailsViewUpdatedEventArgs.cs
- MonthCalendar.cs
- FunctionDefinition.cs
- DesignerMetadata.cs
- CheckBoxStandardAdapter.cs
- PageRouteHandler.cs
- EventLogPermission.cs
- DelegateArgumentReference.cs
- AppLevelCompilationSectionCache.cs
- TextBox.cs
- X509ChainPolicy.cs
- XsdValidatingReader.cs
- DataGridViewCellCancelEventArgs.cs
- webclient.cs
- QuaternionRotation3D.cs
- GeneralTransform2DTo3DTo2D.cs
- PointLight.cs
- WindowInteropHelper.cs
- RegisteredArrayDeclaration.cs
- SchemaImporterExtension.cs
- PartialCachingAttribute.cs
- FakeModelItemImpl.cs
- TextEndOfSegment.cs
- ProtocolsConfigurationHandler.cs
- StateMachine.cs
- InvalidOleVariantTypeException.cs
- ConfigurationManager.cs
- XmlSchemaAttributeGroup.cs
- ScaleTransform3D.cs
- SpecialTypeDataContract.cs
- IPipelineRuntime.cs
- TemplateBuilder.cs
- RegularExpressionValidator.cs
- Opcode.cs
- ViewEvent.cs
- PolyBezierSegment.cs
- LinkedResource.cs
- ContractUtils.cs
- Vector3DCollectionValueSerializer.cs
- PartitionerQueryOperator.cs
- XmlSchemaAttributeGroupRef.cs
- DirectionalLight.cs
- GroupByQueryOperator.cs
- SessionStateItemCollection.cs
- UxThemeWrapper.cs
- AttributeQuery.cs
- DropSourceBehavior.cs
- ColumnResizeUndoUnit.cs
- CultureInfoConverter.cs
- GenericAuthenticationEventArgs.cs
- InstanceData.cs
- Vector3DAnimationBase.cs
- precedingsibling.cs
- XmlFormatMapping.cs
- SystemPens.cs
- Partitioner.cs
- Executor.cs
- WebServiceFaultDesigner.cs
- SourceChangedEventArgs.cs
- TemplatedControlDesigner.cs
- ProfilePropertyNameValidator.cs
- Vector3D.cs
- CompositeCollectionView.cs
- EdmError.cs
- IdentitySection.cs
- ClientCultureInfo.cs
- LogicalExpr.cs
- SafeWaitHandle.cs
- KeyValuePair.cs
- coordinator.cs
- SelectionRangeConverter.cs