Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / WSDualHttpSecurity.cs / 1 / WSDualHttpSecurity.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel { using System.Diagnostics; using System.Net.Security; using System.ServiceModel.Channels; using System.ServiceModel.Security; using System.ServiceModel.Configuration; public sealed class WSDualHttpSecurity { static readonly MessageSecurityVersion WSDualMessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10; internal const WSDualHttpSecurityMode DefaultMode = WSDualHttpSecurityMode.Message; WSDualHttpSecurityMode mode; MessageSecurityOverHttp messageSecurity; internal WSDualHttpSecurity() : this(DefaultMode, new MessageSecurityOverHttp()) { } WSDualHttpSecurity(WSDualHttpSecurityMode mode, MessageSecurityOverHttp messageSecurity) { DiagnosticUtility.DebugAssert(WSDualHttpSecurityModeHelper.IsDefined(mode), string.Format("Invalid WSDualHttpSecurityMode value: {0}", mode.ToString())); this.mode = mode; this.messageSecurity = messageSecurity == null ? new MessageSecurityOverHttp() : messageSecurity; } public WSDualHttpSecurityMode Mode { get { return this.mode; } set { if (!WSDualHttpSecurityModeHelper.IsDefined(value)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value")); } this.mode = value; } } public MessageSecurityOverHttp Message { get { return this.messageSecurity; } } internal SecurityBindingElement CreateMessageSecurity() { if (this.mode == WSDualHttpSecurityMode.Message) { return this.messageSecurity.CreateSecurityBindingElement(false, true, WSDualMessageSecurityVersion); } else { return null; } } internal static bool TryCreate(SecurityBindingElement sbe, out WSDualHttpSecurity security) { security = null; if (sbe == null) security = new WSDualHttpSecurity(WSDualHttpSecurityMode.None, null); else { MessageSecurityOverHttp messageSecurity; if (!MessageSecurityOverHttp.TryCreate(sbe, false, true, out messageSecurity)) return false; security = new WSDualHttpSecurity(WSDualHttpSecurityMode.Message, messageSecurity); } // the last check: make sure that security binding element match the incoming security return SecurityElement.AreBindingsMatching(security.CreateMessageSecurity(), sbe); } } } // 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
- BinaryParser.cs
- ByteStreamGeometryContext.cs
- ObjectListFieldsPage.cs
- DefaultBinder.cs
- DataTableExtensions.cs
- ClockController.cs
- CodeDomConfigurationHandler.cs
- Light.cs
- _ListenerResponseStream.cs
- TypeDescriptorFilterService.cs
- URLAttribute.cs
- SystemUdpStatistics.cs
- XhtmlBasicLiteralTextAdapter.cs
- CodeExpressionCollection.cs
- WebControlParameterProxy.cs
- DataServiceEntityAttribute.cs
- GridViewCommandEventArgs.cs
- RootBrowserWindowProxy.cs
- QilSortKey.cs
- CompilerLocalReference.cs
- IisTraceListener.cs
- StoreAnnotationsMap.cs
- XMLUtil.cs
- IdentityManager.cs
- BuildDependencySet.cs
- PropertyChangedEventArgs.cs
- BindingValueChangedEventArgs.cs
- WindowsAltTab.cs
- BevelBitmapEffect.cs
- DoubleUtil.cs
- NetStream.cs
- PeoplePickerWrapper.cs
- WebPartDeleteVerb.cs
- FormViewUpdateEventArgs.cs
- UIElementParaClient.cs
- PointConverter.cs
- StickyNote.cs
- Context.cs
- HybridObjectCache.cs
- BindingSource.cs
- TreeViewImageKeyConverter.cs
- Themes.cs
- TdsParserStateObject.cs
- Queue.cs
- DataGridItemEventArgs.cs
- ChameleonKey.cs
- PolygonHotSpot.cs
- GregorianCalendarHelper.cs
- NodeInfo.cs
- AttachedAnnotationChangedEventArgs.cs
- XmlWriterTraceListener.cs
- CacheHelper.cs
- NativeMethods.cs
- FilteredReadOnlyMetadataCollection.cs
- OptimisticConcurrencyException.cs
- PluralizationServiceUtil.cs
- DoubleCollection.cs
- LineProperties.cs
- FactoryRecord.cs
- ObjectListGeneralPage.cs
- IntranetCredentialPolicy.cs
- AccessControlEntry.cs
- CollectionChangedEventManager.cs
- UpdatePanelControlTrigger.cs
- TreeNodeMouseHoverEvent.cs
- Win32.cs
- FileLogRecordEnumerator.cs
- ClientConfigPaths.cs
- WizardPanel.cs
- PropertyPathWorker.cs
- PointLightBase.cs
- Pkcs7Signer.cs
- StringAnimationUsingKeyFrames.cs
- DrawItemEvent.cs
- BaseTemplateBuildProvider.cs
- EntityDesignerUtils.cs
- MarkupObject.cs
- MessagingDescriptionAttribute.cs
- RequestQueryProcessor.cs
- StorageAssociationTypeMapping.cs
- OdbcReferenceCollection.cs
- ToolStripRenderEventArgs.cs
- RoutedEventArgs.cs
- MimeParameterWriter.cs
- XamlDesignerSerializationManager.cs
- Calendar.cs
- Mapping.cs
- SiteMapNodeItem.cs
- EntityException.cs
- BridgeDataRecord.cs
- HttpClientCertificate.cs
- XmlQueryTypeFactory.cs
- GroupQuery.cs
- InputLanguageManager.cs
- OletxTransactionManager.cs
- HttpModulesSection.cs
- InputProcessorProfiles.cs
- EncryptedType.cs
- ValidationPropertyAttribute.cs
- GC.cs