Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / NegotiationTokenAuthenticatorStateCache.cs / 1 / NegotiationTokenAuthenticatorStateCache.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Security { using System; using System.ServiceModel; using System.Collections; using System.Runtime.InteropServices; using System.Threading; using System.Diagnostics; sealed class NegotiationTokenAuthenticatorStateCache: TimeBoundedCache where T : NegotiationTokenAuthenticatorState { static int lowWaterMark = 50; static TimeSpan purgingInterval = TimeSpan.FromMinutes(10); TimeSpan cachingSpan; public NegotiationTokenAuthenticatorStateCache(TimeSpan cachingSpan, int maximumCachedState) : base(lowWaterMark, maximumCachedState, null, PurgingMode.TimerBasedPurge, TimeSpan.FromTicks(cachingSpan.Ticks >> 2), true) { this.cachingSpan = cachingSpan; } public void AddState(string context, T state) { DateTime expirationTime = TimeoutHelper.Add(DateTime.UtcNow, this.cachingSpan); bool wasStateAdded = base.TryAddItem(context, state, expirationTime, false); if (!wasStateAdded) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new SecurityNegotiationException(SR.GetString(SR.NegotiationStateAlreadyPresent, context))); } } public T GetState(string context) { return (this.GetItem(context) as T); } public void RemoveState(string context) { this.TryRemoveItem(context); } protected override ArrayList OnQuotaReached(Hashtable cacheTable) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QuotaExceededException(SR.GetString(SR.CachedNegotiationStateQuotaReached, this.Capacity))); } protected override void OnRemove(object item) { ((IDisposable)item).Dispose(); base.OnRemove(item); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RuleRefElement.cs
- CounterCreationDataConverter.cs
- RegexCapture.cs
- CapabilitiesAssignment.cs
- BaseDataListDesigner.cs
- OdbcStatementHandle.cs
- Span.cs
- SetState.cs
- PrincipalPermission.cs
- TextSerializer.cs
- HttpCacheParams.cs
- itemelement.cs
- TextEffect.cs
- XamlTemplateSerializer.cs
- Ipv6Element.cs
- TableLayoutPanelResizeGlyph.cs
- WSTransactionSection.cs
- BindingsCollection.cs
- FileAuthorizationModule.cs
- CoreSwitches.cs
- CompatibleIComparer.cs
- SiteMapNode.cs
- TypedTableBaseExtensions.cs
- DateBoldEvent.cs
- InkCanvasSelectionAdorner.cs
- JsonWriter.cs
- XmlSchemaComplexContent.cs
- InputProcessorProfiles.cs
- SimplePropertyEntry.cs
- filewebresponse.cs
- GenericRootAutomationPeer.cs
- SchemaMapping.cs
- TemplatingOptionsDialog.cs
- MouseGesture.cs
- COM2ComponentEditor.cs
- UnrecognizedPolicyAssertionElement.cs
- PropertyDescriptorCollection.cs
- Token.cs
- HttpHandlerAction.cs
- WebDescriptionAttribute.cs
- CodeMethodReturnStatement.cs
- ActivityInstanceMap.cs
- MultiDataTrigger.cs
- SystemParameters.cs
- X509CertificateValidationMode.cs
- FontEmbeddingManager.cs
- WinEventWrap.cs
- GlobalizationSection.cs
- PageStatePersister.cs
- TreeNodeCollectionEditor.cs
- RoleBoolean.cs
- ZipFileInfo.cs
- WindowsRichEditRange.cs
- DataGridViewLinkCell.cs
- InternalsVisibleToAttribute.cs
- AssemblyName.cs
- WebColorConverter.cs
- PeerObject.cs
- DelayLoadType.cs
- RawMouseInputReport.cs
- PageBuildProvider.cs
- RepeaterItemEventArgs.cs
- HtmlToClrEventProxy.cs
- QueryOperationResponseOfT.cs
- MD5HashHelper.cs
- PiiTraceSource.cs
- RegisteredScript.cs
- XamlParser.cs
- PaintValueEventArgs.cs
- PermissionSetEnumerator.cs
- iisPickupDirectory.cs
- ValidatedControlConverter.cs
- XhtmlBasicLiteralTextAdapter.cs
- IndentTextWriter.cs
- ListViewAutomationPeer.cs
- SQLConvert.cs
- BaseProcessor.cs
- UpdatePanelControlTrigger.cs
- ReadOnlyMetadataCollection.cs
- DateTimeConverter2.cs
- XmlFormatMapping.cs
- QEncodedStream.cs
- DetailsViewCommandEventArgs.cs
- Completion.cs
- PersonalizableTypeEntry.cs
- CompilationRelaxations.cs
- ReachPageContentCollectionSerializerAsync.cs
- SortExpressionBuilder.cs
- MetadataSource.cs
- BamlCollectionHolder.cs
- TraceHandler.cs
- AddingNewEventArgs.cs
- DynamicEntity.cs
- SessionStateContainer.cs
- TrustManagerPromptUI.cs
- HwndSourceParameters.cs
- TextOnlyOutput.cs
- EntityObject.cs
- DoubleAverageAggregationOperator.cs
- WebPartEditorApplyVerb.cs