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
- ServicePointManager.cs
- MembershipValidatePasswordEventArgs.cs
- SQLGuid.cs
- DataGridViewDataConnection.cs
- ToggleButtonAutomationPeer.cs
- HitTestParameters.cs
- PersonalizablePropertyEntry.cs
- HandledEventArgs.cs
- WebPartTransformer.cs
- WsatAdminException.cs
- SystemResourceKey.cs
- GridViewRowEventArgs.cs
- HostingEnvironment.cs
- COM2EnumConverter.cs
- CharacterBuffer.cs
- QuaternionAnimationBase.cs
- BindingExpression.cs
- RSAPKCS1KeyExchangeFormatter.cs
- PanelStyle.cs
- MenuStrip.cs
- Int64Storage.cs
- TaiwanCalendar.cs
- KeysConverter.cs
- CommonGetThemePartSize.cs
- WebColorConverter.cs
- FloaterParaClient.cs
- TextAction.cs
- XmlSchemaProviderAttribute.cs
- PromptStyle.cs
- CompilerCollection.cs
- SystemTcpStatistics.cs
- ErrorHandler.cs
- TrackingParticipant.cs
- IdnElement.cs
- XmlNamedNodeMap.cs
- AssertFilter.cs
- XsltContext.cs
- ZipPackage.cs
- Task.cs
- AdornerDecorator.cs
- ImageIndexConverter.cs
- ResourceAttributes.cs
- WebAdminConfigurationHelper.cs
- HttpDictionary.cs
- HelloMessageCD1.cs
- TextSimpleMarkerProperties.cs
- DockingAttribute.cs
- CellNormalizer.cs
- CaseInsensitiveHashCodeProvider.cs
- ComponentResourceKey.cs
- WindowVisualStateTracker.cs
- HttpCachePolicyElement.cs
- ContourSegment.cs
- Resources.Designer.cs
- TextEditorTyping.cs
- ModelItemDictionaryImpl.cs
- SendKeys.cs
- ObjectNavigationPropertyMapping.cs
- FileUtil.cs
- TextFindEngine.cs
- HtmlImage.cs
- InvalidComObjectException.cs
- ClientConfigurationSystem.cs
- ElapsedEventArgs.cs
- CngKey.cs
- FlowDocumentPaginator.cs
- ContainerCodeDomSerializer.cs
- FontStretches.cs
- CacheChildrenQuery.cs
- VirtualDirectoryMapping.cs
- SchemaCollectionCompiler.cs
- InitiatorSessionSymmetricTransportSecurityProtocol.cs
- SqlDataSource.cs
- UnionCqlBlock.cs
- Int64AnimationUsingKeyFrames.cs
- WebServiceClientProxyGenerator.cs
- X509PeerCertificateAuthenticationElement.cs
- BitmapSource.cs
- MouseWheelEventArgs.cs
- Compilation.cs
- FileDataSourceCache.cs
- _Events.cs
- WorkflowDesignerColors.cs
- ExpressionNode.cs
- ThreadAttributes.cs
- UriTemplateEquivalenceComparer.cs
- MemberPath.cs
- AsyncPostBackErrorEventArgs.cs
- SparseMemoryStream.cs
- ComplexObject.cs
- ZoneButton.cs
- GenericTextProperties.cs
- EntityModelBuildProvider.cs
- XmlNodeReader.cs
- ProxyWebPartManager.cs
- DbConnectionPoolGroup.cs
- Section.cs
- XmlSchemaAnyAttribute.cs
- AsymmetricKeyExchangeFormatter.cs
- Scalars.cs