当前位置: 首页>>代码示例>>C#>>正文


C# SecurityBindingElement类代码示例

本文整理汇总了C#中SecurityBindingElement的典型用法代码示例。如果您正苦于以下问题:C# SecurityBindingElement类的具体用法?C# SecurityBindingElement怎么用?C# SecurityBindingElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SecurityBindingElement类属于命名空间,在下文中一共展示了SecurityBindingElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyMessageSecurity

 protected virtual SecurityBindingElement ApplyMessageSecurity(SecurityBindingElement securityBindingElement)
 {
     if (securityBindingElement == null)
     {
         throw new ArgumentNullException("securityBindingElement");
     }
     
     if (TrustVersion.WSTrustFeb2005 == _trustVersion)
     {
         securityBindingElement.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10;
     }
     else
     {
         securityBindingElement.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10;
     }
     
     if (_enableRsaProofKeys)
     {
         RsaSecurityTokenParameters item = new RsaSecurityTokenParameters
         {
             InclusionMode = SecurityTokenInclusionMode.Never,
             RequireDerivedKeys = false
         };
         securityBindingElement.OptionalEndpointSupportingTokenParameters.Endorsing.Add(item);
     }
     
     return securityBindingElement;
 }
开发者ID:LiyeXu,项目名称:PnP-Sites-Core,代码行数:28,代码来源:WSTrustBindingBase.cs

示例2: TryCreate

 internal static bool TryCreate(SecurityBindingElement sbe, out MessageSecurityOverMsmq messageSecurity)
 {
     MessageCredentialType none;
     messageSecurity = null;
     if (sbe == null)
     {
         return false;
     }
     SymmetricSecurityBindingElement element = sbe as SymmetricSecurityBindingElement;
     if (element == null)
     {
         return false;
     }
     if ((sbe.MessageSecurityVersion != MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10) && (sbe.MessageSecurityVersion != MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11))
     {
         return false;
     }
     if (element.IncludeTimestamp)
     {
         return false;
     }
     bool flag = false;
     if (SecurityBindingElement.IsAnonymousForCertificateBinding(sbe))
     {
         none = MessageCredentialType.None;
     }
     else if (SecurityBindingElement.IsUserNameForCertificateBinding(sbe))
     {
         none = MessageCredentialType.UserName;
     }
     else if (SecurityBindingElement.IsMutualCertificateBinding(sbe))
     {
         none = MessageCredentialType.Certificate;
     }
     else if (SecurityBindingElement.IsKerberosBinding(sbe))
     {
         none = MessageCredentialType.Windows;
         flag = true;
     }
     else
     {
         IssuedSecurityTokenParameters parameters;
         if (!SecurityBindingElement.IsIssuedTokenForCertificateBinding(sbe, out parameters))
         {
             return false;
         }
         if (!IssuedSecurityTokenParameters.IsInfoCardParameters(parameters, new SecurityStandardsManager(sbe.MessageSecurityVersion, new WSSecurityTokenSerializer(sbe.MessageSecurityVersion.SecurityVersion, sbe.MessageSecurityVersion.TrustVersion, sbe.MessageSecurityVersion.SecureConversationVersion, true, null, null, null))))
         {
             return false;
         }
         none = MessageCredentialType.IssuedToken;
     }
     messageSecurity = new MessageSecurityOverMsmq();
     messageSecurity.ClientCredentialType = none;
     if ((none != MessageCredentialType.IssuedToken) && !flag)
     {
         messageSecurity.AlgorithmSuite = element.DefaultAlgorithmSuite;
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:MessageSecurityOverMsmq.cs

示例3: TryCreate

 internal static bool TryCreate(SecurityBindingElement sbe, TransportBindingElement transport, PrivacyNoticeBindingElement privacy, ReliableSessionBindingElement rsbe, TransactionFlowBindingElement tfbe, out Binding binding)
 {
     WSFederationHttpSecurityMode mode;
     WSFederationHttpSecurity security2;
     bool isReliableSession = rsbe != null;
     binding = null;
     HttpTransportSecurity transportSecurity = new HttpTransportSecurity();
     if (!WSFederationHttpBinding.GetSecurityModeFromTransport(transport, transportSecurity, out mode))
     {
         return false;
     }
     HttpsTransportBindingElement element = transport as HttpsTransportBindingElement;
     if (((element != null) && (element.MessageSecurityVersion != null)) && (element.MessageSecurityVersion.SecurityPolicyVersion != WS2007MessageSecurityVersion.SecurityPolicyVersion))
     {
         return false;
     }
     if (TryCreateSecurity(sbe, mode, transportSecurity, isReliableSession, out security2))
     {
         binding = new WS2007FederationHttpBinding(security2, privacy, isReliableSession);
     }
     if ((rsbe != null) && (rsbe.ReliableMessagingVersion != ReliableMessagingVersion.WSReliableMessaging11))
     {
         return false;
     }
     if ((tfbe != null) && (tfbe.TransactionProtocol != TransactionProtocol.WSAtomicTransaction11))
     {
         return false;
     }
     return (binding != null);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:WS2007FederationHttpBinding.cs

示例4: SpnegoTokenProvider

 public SpnegoTokenProvider(System.IdentityModel.SafeFreeCredentials credentialsHandle, SecurityBindingElement securityBindingElement) : base(securityBindingElement)
 {
     this.allowedImpersonationLevel = TokenImpersonationLevel.Identification;
     this.identityVerifier = System.ServiceModel.Security.IdentityVerifier.CreateDefault();
     this.allowNtlm = true;
     this.authenticateServer = true;
     this.interactiveNegoExLogonEnabled = true;
     this.credentialsHandle = credentialsHandle;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:SpnegoTokenProvider.cs

示例5: Initialize

        private void Initialize()
        {
            _securityBindingElement = CreateSecurityBindingElement();

            _textEncodingBindingElement = CreateTextEncodingBindingElement();

            //_httpsTransportBindingElement = CreateHttpsTransportBindingElement();
            _httpTransportBindingElement = CreateHttpTransportBindingElement();
        }
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:9,代码来源:IdpStsCustomSecuredBinding.cs

示例6: Initialize

        private void Initialize()
        {
            _securityBindingElement = CreateSecurityBindingElement();

            _reliableSessionBindingElement = CreateReliableSessionBindingElement();

            _mtomEncodingBindingElement = CreateMtomEncodingBindingElement();

            _httpsTransportBindingElement = CreateHttpsTransportBindingElement() as HttpsTransportBindingElement;
        }
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:10,代码来源:WspCustomSecuredBinding.cs

示例7: SecureConversationSecurityTokenParameters

        protected SecureConversationSecurityTokenParameters(SecureConversationSecurityTokenParameters other)
            : base(other)
        {
            _requireCancellation = other._requireCancellation;
            _canRenewSession = other._canRenewSession;
            if (other._bootstrapSecurityBindingElement != null)
                _bootstrapSecurityBindingElement = (SecurityBindingElement)other._bootstrapSecurityBindingElement.Clone();

            if (other._issuerBindingContext != null)
                _issuerBindingContext = other._issuerBindingContext.Clone();
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:11,代码来源:SecureConversationSecurityTokenParameters.cs

示例8: SecureConversationSecurityTokenParameters

 protected SecureConversationSecurityTokenParameters(SecureConversationSecurityTokenParameters other)
     : base(other)
 {
     this.requireCancellation = other.requireCancellation;
     this.canRenewSession = other.canRenewSession;
     if (other.bootstrapSecurityBindingElement != null)
         this.bootstrapSecurityBindingElement = (SecurityBindingElement)other.bootstrapSecurityBindingElement.Clone();
     if (other.bootstrapProtectionRequirements != null)
         this.bootstrapProtectionRequirements = new ChannelProtectionRequirements(other.bootstrapProtectionRequirements);
     if (other.issuerBindingContext != null)
         this.issuerBindingContext = other.issuerBindingContext.Clone();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:SecureConversationSecurityTokenParameters.cs

示例9: SecureConversationSecurityTokenParameters

		public SecureConversationSecurityTokenParameters (
			SecurityBindingElement element,
			bool requireCancellation,
			ChannelProtectionRequirements requirements)
		{
			this.element = element;
			this.cancellable = requireCancellation;
			if (requirements == null)
				this.requirements = new ChannelProtectionRequirements (default_channel_protection_requirements);
			else
				this.requirements = new ChannelProtectionRequirements (requirements);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:12,代码来源:SecureConversationSecurityTokenParameters.cs

示例10: EnumerateNestedTokenParameters

 static IEnumerable<SecurityTokenParameters> EnumerateNestedTokenParameters(SecurityBindingElement element)
 {
     foreach (SecurityTokenParameters parameters in EnumerateTokenParameters(element))
     {
         if (parameters is SecureConversationSecurityTokenParameters)
         {
             SecurityBindingElement nestedElement = ((SecureConversationSecurityTokenParameters)parameters).BootstrapSecurityBindingElement;
             foreach (SecurityTokenParameters nestedParameters in EnumerateTokenParameters(nestedElement))
             {
                 yield return nestedParameters;
             }
         }
     }
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:14,代码来源:InternetClientValidatorBehavior.cs

示例11: TryCreate

        // This is effectively just a copy of WSHttpBinding.TryCreate(), only it news up the 2007 version
        internal new static bool TryCreate(SecurityBindingElement sbe, TransportBindingElement transport, ReliableSessionBindingElement rsbe, TransactionFlowBindingElement tfbe, out Binding binding)
        {
            bool isReliableSession = (rsbe != null);
            binding = null;

            // reverse GetTransport
            HttpTransportSecurity transportSecurity = WSHttpSecurity.GetDefaultHttpTransportSecurity();
            UnifiedSecurityMode mode;
            if (!WSHttpBinding.GetSecurityModeFromTransport(transport, transportSecurity, out mode))
            {
                return false;
            }

            HttpsTransportBindingElement httpsBinding = transport as HttpsTransportBindingElement;
            if (httpsBinding != null && httpsBinding.MessageSecurityVersion != null)
            {
                if (httpsBinding.MessageSecurityVersion.SecurityPolicyVersion != WS2007MessageSecurityVersion.SecurityPolicyVersion)
                {
                    return false;
                }
            }

            WSHttpSecurity security;
            if (WS2007HttpBinding.TryCreateSecurity(sbe, mode, transportSecurity, isReliableSession, out security))
            {
                WS2007HttpBinding ws2007HttpBinding = new WS2007HttpBinding(security, isReliableSession);

                bool allowCookies;
                if (!WSHttpBinding.TryGetAllowCookiesFromTransport(transport, out allowCookies))
                {
                    return false;
                }

                ws2007HttpBinding.AllowCookies = allowCookies;
                binding = ws2007HttpBinding;
            }

            if (rsbe != null && rsbe.ReliableMessagingVersion != ReliableMessagingVersion.WSReliableMessaging11)
            {
                return false;
            }

            if (tfbe != null && tfbe.TransactionProtocol != TransactionProtocol.WSAtomicTransaction11)
            {
                return false;
            }

            return binding != null;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:50,代码来源:WS2007HttpBinding.cs

示例12: TryCreate

 internal static bool TryCreate(SecurityBindingElement sbe, NetMsmqSecurityMode mode, out NetMsmqSecurity security)
 {
     MessageSecurityOverMsmq msmq;
     security = null;
     if (!MessageSecurityOverMsmq.TryCreate(sbe, out msmq))
     {
         msmq = null;
     }
     security = new NetMsmqSecurity(mode, null, msmq);
     if (sbe != null)
     {
         return SecurityElementBase.AreBindingsMatching(security.CreateMessageSecurity(), sbe, false);
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:NetMsmqSecurity.cs

示例13: HasSupportingTokens

 private static bool HasSupportingTokens(SecurityBindingElement binding)
 {
     if (((binding.EndpointSupportingTokenParameters.Endorsing.Count > 0) || (binding.EndpointSupportingTokenParameters.SignedEndorsing.Count > 0)) || ((binding.EndpointSupportingTokenParameters.SignedEncrypted.Count > 0) || (binding.EndpointSupportingTokenParameters.Signed.Count > 0)))
     {
         return true;
     }
     foreach (SupportingTokenParameters parameters in binding.OperationSupportingTokenParameters.Values)
     {
         if (((parameters.Endorsing.Count > 0) || (parameters.SignedEndorsing.Count > 0)) || ((parameters.SignedEncrypted.Count > 0) || (parameters.Signed.Count > 0)))
         {
             return true;
         }
     }
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:SecurityBindingElementImporter.cs

示例14: TryCreate

 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);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:WSDualHttpSecurity.cs

示例15: ImportOperationScopeSupportingTokensPolicy

        void ImportOperationScopeSupportingTokensPolicy(MetadataImporter importer, PolicyConversionContext policyContext, SecurityBindingElement binding)
        {
            foreach (OperationDescription operation in policyContext.Contract.Operations)
            {
                string requestAction = null;
                foreach (MessageDescription message in operation.Messages)
                {
                    if (message.Direction == MessageDirection.Input)
                    {
                        requestAction = message.Action;
                        break;
                    }
                }

                SupportingTokenParameters requirements = new SupportingTokenParameters();
                SupportingTokenParameters optionalRequirements = new SupportingTokenParameters();
                ICollection<XmlElement> operationBindingAssertions = policyContext.GetOperationBindingAssertions(operation);
                this.ImportSupportingTokenAssertions(importer, policyContext, operationBindingAssertions, requirements, optionalRequirements);
                if (requirements.Endorsing.Count > 0
                    || requirements.Signed.Count > 0
                    || requirements.SignedEncrypted.Count > 0
                    || requirements.SignedEndorsing.Count > 0)
                {
                    if (requestAction != null)
                    {
                        binding.OperationSupportingTokenParameters[requestAction] = requirements;
                    }
                    else
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CannotImportSupportingTokensForOperationWithoutRequestAction)));
                    }
                }
                if (optionalRequirements.Endorsing.Count > 0
                    || optionalRequirements.Signed.Count > 0
                    || optionalRequirements.SignedEncrypted.Count > 0
                    || optionalRequirements.SignedEndorsing.Count > 0)
                {
                    if (requestAction != null)
                    {
                        binding.OptionalOperationSupportingTokenParameters[requestAction] = optionalRequirements;
                    }
                    else
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CannotImportSupportingTokensForOperationWithoutRequestAction)));
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:48,代码来源:SecurityBindingElementImporter.cs


注:本文中的SecurityBindingElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。