Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / ComIntegration / SecurityCookieModeValidator.cs / 1 / SecurityCookieModeValidator.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.ComIntegration { using System; using System.ServiceModel.Channels; using System.ServiceModel.Description; using System.ServiceModel.Dispatcher; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ServiceModel; using System.ServiceModel.Security.Tokens; class SecurityCookieModeValidator : IServiceBehavior { void CheckForCookie(SecurityTokenParameters tokenParameters, ServiceEndpoint endpoint) { bool cookie = false; SecureConversationSecurityTokenParameters sc = tokenParameters as SecureConversationSecurityTokenParameters; if (sc != null && sc.RequireCancellation == false) cookie = true; SspiSecurityTokenParameters sspi = tokenParameters as SspiSecurityTokenParameters; if (sspi != null && sspi.RequireCancellation == false) cookie = true; SspiSecurityTokenParameters ssl = tokenParameters as SspiSecurityTokenParameters; if (ssl != null && ssl.RequireCancellation == false) cookie = true; if (cookie) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.RequireNonCookieMode, endpoint.Binding.Name, endpoint.Binding.Namespace))); } void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collectionendpoints, BindingParameterCollection parameters) { } void IServiceBehavior.Validate(ServiceDescription service, ServiceHostBase serviceHostBase) { } void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription service, ServiceHostBase serviceHostBase) { // The philosophy here is to respect settings obtained from the // service surrogate class' attributes, as written by the user, // while rejecting those that contradict our requirements. // We never want to silently overwrite a user's attributes. // So we either accept overrides or reject them. // // If you're changing this code, you'll probably also want to change // ComPlusServiceLoader.AddBehaviors foreach (ServiceEndpoint endpoint in service.Endpoints) { ICollection bindingElements = endpoint.Binding.CreateBindingElements(); foreach (BindingElement element in bindingElements) { SymmetricSecurityBindingElement sbe = (element as SymmetricSecurityBindingElement); if (sbe != null) { this.CheckForCookie(sbe.ProtectionTokenParameters, endpoint); foreach (SecurityTokenParameters p in sbe.EndpointSupportingTokenParameters.Endorsing) this.CheckForCookie(p, endpoint); break; } } } } } } // 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
- XmlSerializerNamespaces.cs
- Random.cs
- Trace.cs
- InfoCardUIAgent.cs
- InstancePersistenceEvent.cs
- AmbientLight.cs
- GridEntry.cs
- QueryOptionExpression.cs
- RTTypeWrapper.cs
- X509CertificateValidator.cs
- ACE.cs
- MarkupExtensionReturnTypeAttribute.cs
- HttpFileCollection.cs
- PageContent.cs
- MachineKeySection.cs
- CompilerCollection.cs
- _ListenerRequestStream.cs
- WebColorConverter.cs
- PkcsUtils.cs
- Light.cs
- InputScope.cs
- ImageInfo.cs
- PrintPageEvent.cs
- DateTimeFormatInfo.cs
- InterleavedZipPartStream.cs
- DelimitedListTraceListener.cs
- ClockGroup.cs
- DefaultValidator.cs
- NumberSubstitution.cs
- DetailsViewModeEventArgs.cs
- PatternMatcher.cs
- QueryContinueDragEventArgs.cs
- ObjectStateEntryDbDataRecord.cs
- SelectionWordBreaker.cs
- CqlQuery.cs
- HandleCollector.cs
- PaperSize.cs
- NumberSubstitution.cs
- StylusPointPropertyInfo.cs
- WebPartHelpVerb.cs
- HierarchicalDataBoundControlAdapter.cs
- InteropBitmapSource.cs
- RegexParser.cs
- ValueUtilsSmi.cs
- SystemBrushes.cs
- DictionaryEntry.cs
- LinkArea.cs
- DesignConnection.cs
- LookupNode.cs
- BitmapMetadata.cs
- LightweightCodeGenerator.cs
- ActiveXMessageFormatter.cs
- keycontainerpermission.cs
- SqlTransaction.cs
- TextContainerHelper.cs
- BindingListCollectionView.cs
- OdbcErrorCollection.cs
- PnrpPermission.cs
- _CommandStream.cs
- UInt32Storage.cs
- SystemIdentity.cs
- XmlValidatingReaderImpl.cs
- ProxySimple.cs
- WinFormsComponentEditor.cs
- Scheduler.cs
- DeriveBytes.cs
- EventEntry.cs
- PolygonHotSpot.cs
- GlyphShapingProperties.cs
- ListBase.cs
- AutoCompleteStringCollection.cs
- ProcessInfo.cs
- DocumentPage.cs
- CancelEventArgs.cs
- VideoDrawing.cs
- EmbeddedMailObjectsCollection.cs
- OwnerDrawPropertyBag.cs
- SinglePageViewer.cs
- PriorityChain.cs
- InternalMappingException.cs
- StateMachineSubscriptionManager.cs
- StrongNameKeyPair.cs
- XmlDataSourceNodeDescriptor.cs
- DescriptionAttribute.cs
- GeometryGroup.cs
- Storyboard.cs
- MimeFormatter.cs
- CfgRule.cs
- Base64Encoding.cs
- DataGridViewRowsRemovedEventArgs.cs
- CompoundFileStreamReference.cs
- ColumnMapVisitor.cs
- LazyInitializer.cs
- KeyTime.cs
- FileDataSourceCache.cs
- shaperfactory.cs
- DataSourceControl.cs
- TextElementAutomationPeer.cs
- AdornerLayer.cs
- SiteMapPath.cs