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


C# ProtocolVersion类代码示例

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


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

示例1: CreateIssuedToken

        public static void CreateIssuedToken(Guid transactionId, string coordinationContextId, ProtocolVersion protocolVersion, out RequestSecurityTokenResponse issuedToken, out string sctId)
        {
            sctId = CoordinationContext.CreateNativeIdentifier(Guid.NewGuid());
            byte[] key = DeriveIssuedTokenKey(transactionId, sctId);
            DateTime utcNow = DateTime.UtcNow;
            SecurityContextSecurityToken token = new SecurityContextSecurityToken(new UniqueId(sctId), key, utcNow, utcNow + TimeSpan.FromDays(36500.0));
            BinarySecretSecurityToken token2 = new BinarySecretSecurityToken(key);
            SecurityStandardsManager standardsManager = CreateStandardsManager(protocolVersion);
            RequestSecurityTokenResponse response = new RequestSecurityTokenResponse(standardsManager) {
                TokenType = standardsManager.SecureConversationDriver.TokenTypeUri,
                RequestedUnattachedReference = SecurityContextSecurityTokenParameters.CreateKeyIdentifierClause(token, SecurityTokenReferenceStyle.External),
                RequestedAttachedReference = SecurityContextSecurityTokenParameters.CreateKeyIdentifierClause(token, SecurityTokenReferenceStyle.Internal),
                RequestedSecurityToken = token,
                RequestedProofToken = token2
            };
            DataContractSerializer serializer = IdentifierElementSerializer(protocolVersion);
            ProtocolVersionHelper.AssertProtocolVersion(protocolVersion, typeof(CoordinationServiceSecurity), "CreateIssuedToken");
            switch (protocolVersion)
            {
                case ProtocolVersion.Version10:
                    response.SetAppliesTo<IdentifierElement10>(new IdentifierElement10(coordinationContextId), serializer);
                    break;

                case ProtocolVersion.Version11:
                    response.SetAppliesTo<IdentifierElement11>(new IdentifierElement11(coordinationContextId), serializer);
                    break;
            }
            response.MakeReadOnly();
            if (DebugTrace.Verbose)
            {
                DebugTrace.Trace(TraceLevel.Verbose, "Created issued token with id {0} for transaction {1}", sctId, transactionId);
            }
            issuedToken = response;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:CoordinationServiceSecurity.cs

示例2: AssertProtocolVersion

 public static void AssertProtocolVersion(ProtocolVersion protocolVersion, Type type, string method)
 {
     if (!Enum.IsDefined(typeof(ProtocolVersion), protocolVersion))
     {
         DiagnosticUtility.FailFast(string.Concat(new object[] { "An invalid protocol version value was used in ", type, '.', method }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ProtocolVersionHelper.cs

示例3: NpgsqlAsciiRow

 public NpgsqlAsciiRow(NpgsqlRowDescription rowDesc, ProtocolVersion protocolVersion, byte[] inputBuffer, char[] chars)
         : base(rowDesc, protocolVersion)
 {
     NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME);
     _inputBuffer = inputBuffer;
     _chars = chars;
 }
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:NpgsqlAsciiRow.cs

示例4: NpgsqlStartupPacket

        public NpgsqlStartupPacket(Int32 packet_size,
                                   ProtocolVersion protocol_version,
                                   String database_name,
                                   String user_name,
                                   String arguments,
                                   String unused,
                                   String optional_tty)
        {

            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME);
            // Just copy the values.

            // [FIXME] Validate params? We are the only clients, so, hopefully, we
            // know what to send.

            this.packet_size = packet_size;
            this.protocol_version = protocol_version;

            this.database_name = database_name;
            this.user_name = user_name;
            this.arguments = arguments;
            this.unused = unused;
            this.optional_tty = optional_tty;

        }
开发者ID:nlhepler,项目名称:mono,代码行数:25,代码来源:NpgsqlStartupPacket.cs

示例5: GetBuilderFor

        public static IFrameBuilder GetBuilderFor(ProtocolVersion protocolVersion)
        {
            if(protocolVersion == ProtocolVersion.Hybi10)
                return new Hybi10ControlFrameBuilder();

            return null;
        }
开发者ID:roffster,项目名称:WuSS,代码行数:7,代码来源:FrameBuilders.cs

示例6: GetCoordinationContext

        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.
        /*
        // We demand full trust because we call into CoordinationContext and CoordinationStrings, which are defined in a non-APTCA assembly. Also, CoordinationStrings.Version(..) 
        // does an Environment.FailFast if the argument is invalid. It's recommended to not let partially trusted callers to bring down the process.
        // WSATs are not supported in partial trust, so customers should not be broken by this demand.
        [PermissionSet(SecurityAction.Demand, Unrestricted = true)]
        */
        public static CoordinationContext GetCoordinationContext(Message message, ProtocolVersion protocolVersion)
        {
            CoordinationStrings coordinationStrings = CoordinationStrings.Version(protocolVersion);
            string locWsatHeaderElement = coordinationStrings.CoordinationContext;
            string locWsatNamespace = coordinationStrings.Namespace;
            
            int index;
            try
            {
                index = message.Headers.FindHeader(locWsatHeaderElement, locWsatNamespace);
            }
            catch (MessageHeaderException e)
            {
                DiagnosticUtility.TraceHandledException(e, TraceEventType.Warning);
                return null;
            }
            if (index < 0)
                return null;

            CoordinationContext context;
            XmlDictionaryReader reader = message.Headers.GetReaderAtHeader(index);
            using (reader)
            {
                context = GetCoordinationContext(reader, protocolVersion);
            }

            MessageHeaderInfo header = message.Headers[index];
            if (!message.Headers.UnderstoodHeaders.Contains(header))
            {
                message.Headers.UnderstoodHeaders.Add(header);
            }

            return context;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:41,代码来源:WsatTransactionHeader.cs

示例7: AssertProtocolVersion11

 public static void AssertProtocolVersion11(ProtocolVersion protocolVersion, Type type, string method)
 {
     if (protocolVersion != ProtocolVersion.Version11)
     {
         DiagnosticUtility.FailFast(string.Concat(new object[] { "Must use the protocol version 1.1 to execute ", type, '.', method }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ProtocolVersionHelper.cs

示例8: GetCoordinationContext

 public static CoordinationContext GetCoordinationContext(Message message, ProtocolVersion protocolVersion)
 {
     int num;
     CoordinationContext context;
     CoordinationStrings strings = CoordinationStrings.Version(protocolVersion);
     string coordinationContext = strings.CoordinationContext;
     string ns = strings.Namespace;
     try
     {
         num = message.Headers.FindHeader(coordinationContext, ns);
     }
     catch (MessageHeaderException exception)
     {
         DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning);
         return null;
     }
     if (num < 0)
     {
         return null;
     }
     XmlDictionaryReader readerAtHeader = message.Headers.GetReaderAtHeader(num);
     using (readerAtHeader)
     {
         context = GetCoordinationContext(readerAtHeader, protocolVersion);
     }
     MessageHeaderInfo headerInfo = message.Headers[num];
     if (!message.Headers.UnderstoodHeaders.Contains(headerInfo))
     {
         message.Headers.UnderstoodHeaders.Add(headerInfo);
     }
     return context;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:WsatTransactionHeader.cs

示例9: WsatTransactionHeader

 // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.
 /*
 // We demand full trust because we call into CoordinationStrings.Version(..), which is defined in a non-APTCA assembly and does an Environment.FailFast 
 // if the argument is invalid. It's recommended to not let partially trusted callers to bring down the process.
 // WSATs are not supported in partial trust, so customers should not be broken by this demand.
 [PermissionSet(SecurityAction.Demand, Unrestricted = true)]
 */
 public WsatTransactionHeader(CoordinationContext context, ProtocolVersion protocolVersion)
 {
     this.context = context;
     CoordinationStrings coordinationStrings = CoordinationStrings.Version(protocolVersion);                        
     this.wsatHeaderElement = coordinationStrings.CoordinationContext;
     this.wsatNamespace = coordinationStrings.Namespace;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:WsatTransactionHeader.cs

示例10: InteropRegistrationBinding

 public InteropRegistrationBinding(Uri clientBaseAddress, bool acceptSupportingTokens, ProtocolVersion protocolVersion) : base(clientBaseAddress, protocolVersion)
 {
     if (acceptSupportingTokens)
     {
         this.supportingTokenBE = new Microsoft.Transactions.Wsat.Messaging.SupportingTokenBindingElement(protocolVersion);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:InteropRegistrationBinding.cs

示例11: BuildStartupPacket

        public static NpgsqlStartupPacket BuildStartupPacket(ProtocolVersion protocol_version, String database_name, String user_name,
                                                             NpgsqlConnectionStringBuilder  settings)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "BuildStartupPacket");

            if (protocol_version == ProtocolVersion.Version2)
            {
                return new NpgsqlStartupPacketV2(database_name,user_name, "", "", "");
            }
            else
            {
                Dictionary<String, String> parameters = new Dictionary<String, String>();

                parameters.Add("DateStyle", "ISO");
                parameters.Add("client_encoding", "UTF8");
                parameters.Add("extra_float_digits", "2");
                parameters.Add("lc_monetary", "C");

                if (!string.IsNullOrEmpty(settings.ApplicationName))
                {
                    parameters.Add("application_name", settings.ApplicationName);
                }

                if (!string.IsNullOrEmpty(settings.SearchPath))
                {
                    parameters.Add("search_path", settings.SearchPath);
                }

                return new NpgsqlStartupPacketV3(database_name,user_name,parameters);
            }
        }
开发者ID:udoliess,项目名称:npgsql,代码行数:31,代码来源:NpgsqlStartupPacket.cs

示例12: GetClientKeys

		public override byte[] GetClientKeys(ProtocolVersion version, ProtocolVersion clientVersion, CertificatePublicKey publicKey)
		{
			if (!(publicKey.Algorithm is RSACryptoServiceProvider)) {
				throw new CryptographicException("RSA key exchange requires RSA public key");
			}
			return GetClientKeys(version, clientVersion, (RSACryptoServiceProvider)publicKey.Algorithm);
		}
开发者ID:cwschroeder,项目名称:MeterTestComService,代码行数:7,代码来源:KeyExchangeAlgorithmRSA.cs

示例13: parameterizedProgrammaticOPIdentifierTest

		void parameterizedProgrammaticOPIdentifierTest(Identifier opIdentifier, ProtocolVersion version,
			Identifier claimedUrl, AuthenticationRequestMode requestMode,
			AuthenticationStatus expectedResult, bool provideStore) {

			var rp = TestSupport.CreateRelyingParty(provideStore ? TestSupport.RelyingPartyStore : null, null, null);

			var returnTo = TestSupport.GetFullUrl(TestSupport.ConsumerPage);
			var realm = new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri);
			var request = rp.CreateRequest(opIdentifier, realm, returnTo);
			request.Mode = requestMode;

			var rpResponse = TestSupport.CreateRelyingPartyResponseThroughProvider(request,
				opReq => {
					opReq.IsAuthenticated = expectedResult == AuthenticationStatus.Authenticated;
					if (opReq.IsAuthenticated.Value) {
						opReq.ClaimedIdentifier = claimedUrl;
					}
				});
			Assert.AreEqual(expectedResult, rpResponse.Status);
			if (rpResponse.Status == AuthenticationStatus.Authenticated) {
				Assert.AreEqual(claimedUrl, rpResponse.ClaimedIdentifier);
			} else if (rpResponse.Status == AuthenticationStatus.SetupRequired) {
				Assert.IsNull(rpResponse.ClaimedIdentifier);
				Assert.IsNull(rpResponse.FriendlyIdentifierForDisplay);
				Assert.IsNull(rpResponse.Exception);
				Assert.IsInstanceOfType(typeof(ISetupRequiredAuthenticationResponse), rpResponse);
				Assert.AreEqual(opIdentifier.ToString(), ((ISetupRequiredAuthenticationResponse)rpResponse).ClaimedOrProviderIdentifier.ToString());
			}
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:29,代码来源:EndToEndTesting.cs

示例14: SupportsProtocolVersion

		public override bool SupportsProtocolVersion(ProtocolVersion version)
		{
			if (version.IsUsingDatagrams) {
				return false;
			}
			return true;
		}
开发者ID:cwschroeder,项目名称:MeterTestComService,代码行数:7,代码来源:BulkCipherAlgorithmARCFour.cs

示例15: InfoSource

 public InfoSource(GuidPrefix guidPrefix)
     : base(SubMessageKind.INFO_SRC)
 {
     this.protocolVersion = ProtocolVersion.PROTOCOLVERSION_2_1;
     this.vendorId = VendorId.VENDORID_UNKNOWN;
     this.guidPrefix = guidPrefix;
 }
开发者ID:Egipto87,项目名称:DOOP.ec,代码行数:7,代码来源:InfoSource.cs


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