1 //---------------------------------------------------------------------------- 2 // Copyright (c) Microsoft Corporation. All rights reserved. 3 //---------------------------------------------------------------------------- 4 namespace System.ServiceModel.MsmqIntegration 5 { 6 using System.ComponentModel; 7 using System.Net.Security; 8 using System.ServiceModel.Channels; 9 10 public sealed class MsmqIntegrationSecurity 11 { 12 internal const MsmqIntegrationSecurityMode DefaultMode = MsmqIntegrationSecurityMode.Transport; 13 14 MsmqIntegrationSecurityMode mode; 15 MsmqTransportSecurity transportSecurity; 16 MsmqIntegrationSecurity()17 public MsmqIntegrationSecurity() 18 { 19 this.mode = DefaultMode; 20 this.transportSecurity = new MsmqTransportSecurity(); 21 } 22 23 [DefaultValue(MsmqIntegrationSecurity.DefaultMode)] 24 public MsmqIntegrationSecurityMode Mode 25 { 26 get { return this.mode; } 27 set 28 { 29 if (!MsmqIntegrationSecurityModeHelper.IsDefined(value)) 30 { 31 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value")); 32 } 33 this.mode = value; 34 } 35 } 36 37 public MsmqTransportSecurity Transport 38 { 39 get { return this.transportSecurity; } 40 set { this.transportSecurity = value; } 41 } 42 ConfigureTransportSecurity(MsmqBindingElementBase msmq)43 internal void ConfigureTransportSecurity(MsmqBindingElementBase msmq) 44 { 45 if (this.mode == MsmqIntegrationSecurityMode.Transport) 46 msmq.MsmqTransportSecurity = this.Transport; 47 else 48 msmq.MsmqTransportSecurity.Disable(); 49 } 50 } 51 } 52 53 54