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


C# ServiceEndpoint类代码示例

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


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

示例1: OnReceiving

 protected virtual void OnReceiving(ServiceEndpoint provider, IDictionary<string, string> fields)
 {
     var receiving = Receiving;
     if (receiving != null) {
         receiving(provider, fields);
     }
 }
开发者ID:tt,项目名称:dotnetopenid,代码行数:7,代码来源:DirectMessageSniffWrapper.cs

示例2: OnSending

 protected virtual void OnSending(ServiceEndpoint provider, IDictionary<string, string> fields)
 {
     var sending = Sending;
     if (sending != null) {
         sending(provider, fields);
     }
 }
开发者ID:tt,项目名称:dotnetopenid,代码行数:7,代码来源:DirectMessageSniffWrapper.cs

示例3: GetVssCredential

        public static VssCredentials GetVssCredential(ServiceEndpoint serviceEndpoint)
        {
            ArgUtil.NotNull(serviceEndpoint, nameof(serviceEndpoint));
            ArgUtil.NotNull(serviceEndpoint.Authorization, nameof(serviceEndpoint.Authorization));
            ArgUtil.NotNullOrEmpty(serviceEndpoint.Authorization.Scheme, nameof(serviceEndpoint.Authorization.Scheme));

            if (serviceEndpoint.Authorization.Parameters.Count == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(serviceEndpoint));
            }

            VssCredentials credentials = null;
            string accessToken;
            if (serviceEndpoint.Authorization.Scheme == EndpointAuthorizationSchemes.OAuth &&
                serviceEndpoint.Authorization.Parameters.TryGetValue(EndpointAuthorizationParameters.AccessToken, out accessToken))
            {
                //TODO: consume the new Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential
                //when it is available in the rest SDK
#pragma warning disable 618
                credentials = new VssOAuthCredential(accessToken);
#pragma warning restore 618
            }

            return credentials;
        }
开发者ID:codedebug,项目名称:vsts-agent,代码行数:25,代码来源:ApiUtil.cs

示例4: Create

        public static CheckAuthRequest Create(OpenIdRelyingParty relyingParty, ServiceEndpoint provider, IDictionary<string, string> query)
        {
            if (relyingParty == null) throw new ArgumentNullException("relyingParty");
            Protocol protocol = provider.Protocol;
            string signed = query[protocol.openid.signed];

            if (signed == null)
                // #XXX: oidutil.log('No signature present; checkAuth aborted')
                return null;

            // Arguments that are always passed to the server and not
            // included in the signature.
            string[] whitelist = new string[] { protocol.openidnp.assoc_handle, protocol.openidnp.sig, protocol.openidnp.signed, protocol.openidnp.invalidate_handle };
            string[] splitted = signed.Split(',');

            // combine the previous 2 arrays (whitelist + splitted) into a new array: signed_array
            string[] signed_array = new string[whitelist.Length + splitted.Length];
            Array.Copy(whitelist, signed_array, whitelist.Length);
            Array.Copy(splitted, 0, signed_array, whitelist.Length, splitted.Length);

            var check_args = new Dictionary<string, string>();

            foreach (string key in query.Keys) {
                if (key.StartsWith(protocol.openid.Prefix, StringComparison.OrdinalIgnoreCase)
                    && Array.IndexOf(signed_array, key.Substring(protocol.openid.Prefix.Length)) > -1)
                    check_args[key] = query[key];
            }
            check_args[protocol.openid.mode] = protocol.Args.Mode.check_authentication;

            return new CheckAuthRequest(relyingParty, provider, check_args);
        }
开发者ID:tt,项目名称:dotnetopenid,代码行数:31,代码来源:CheckAuthRequest.cs

示例5: DirectResponse

		protected DirectResponse(OpenIdRelyingParty relyingParty, ServiceEndpoint provider, IDictionary<string, string> args) {
			if (relyingParty == null) throw new ArgumentNullException("relyingParty");
			if (provider == null) throw new ArgumentNullException("provider");
			if (args == null) throw new ArgumentNullException("args");
			RelyingParty = relyingParty;
			Provider = provider;
			Args = args;

			// Make sure that the OP fulfills the required OpenID version.
			// We don't use Provider.Protocol here because that's just a cache of
			// what we _thought_ the OP would support, and our purpose is to double-check this.
			ProtocolVersion detectedProtocol = Protocol.DetectFromDirectResponse(args).ProtocolVersion;
			if (detectedProtocol < relyingParty.Settings.MinimumRequiredOpenIdVersion) {
				throw new OpenIdException(string.Format(CultureInfo.CurrentCulture,
					Strings.MinimumOPVersionRequirementNotMet,
					Protocol.Lookup(relyingParty.Settings.MinimumRequiredOpenIdVersion).Version,
					Protocol.Lookup(detectedProtocol).Version));
			}

			if (Logger.IsErrorEnabled) {
				if (provider.Protocol.QueryDeclaredNamespaceVersion != null) {
					if (!Args.ContainsKey(Protocol.openidnp.ns)) {
						Logger.ErrorFormat("Direct response from provider lacked the {0} key.", Protocol.openid.ns);
					} else if (Args[Protocol.openidnp.ns] != Protocol.QueryDeclaredNamespaceVersion) {
						Logger.ErrorFormat("Direct response from provider for key {0} was '{1}' rather than '{2}'.",
							Protocol.openid.ns, Args[Protocol.openidnp.ns], Protocol.QueryDeclaredNamespaceVersion);
					}
				}
			}
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:30,代码来源:DirectResponse.cs

示例6: GetLocalPath

        public override string GetLocalPath(IExecutionContext executionContext, ServiceEndpoint endpoint, string path)
        {
            Trace.Verbose("Entering SvnSourceProvider.GetLocalPath");

            ISvnCommandManager svn = HostContext.CreateService<ISvnCommandManager>();
            svn.Init(executionContext, endpoint, CancellationToken.None);

            // We assume that this is a server path first.
            string serverPath = svn.NormalizeRelativePath(path, '/', '\\').Trim();
            string localPath;

            if (serverPath.StartsWith("^/"))
            {
                //Convert the server path to the relative one using SVN work copy mappings
                string sourcesDirectory = executionContext.Variables.Build_SourcesDirectory;
                localPath = svn.ResolveServerPath(serverPath, sourcesDirectory);
            }
            else
            {
                // normalize the path back to the local file system one.
                localPath = svn.NormalizeRelativePath(serverPath, Path.DirectorySeparatorChar, '/');
            }

            Trace.Verbose("Leaving SvnSourceProvider.GetLocalPath");
            return localPath;
        }
开发者ID:codedebug,项目名称:vsts-agent,代码行数:26,代码来源:SvnSourceProvider.cs

示例7: ReturnsCorrectHashKey

        public void ReturnsCorrectHashKey()
        {
            using (TestHostContext tc = new TestHostContext(this))
            {
                // Arrange.
                var executionContext = new Mock<IExecutionContext>();
                List<string> warnings;
                executionContext
                    .Setup(x => x.Variables)
                    .Returns(new Variables(tc, copy: new Dictionary<string, string>(), maskHints: new List<MaskHint>(), warnings: out warnings));
                executionContext.Object.Variables.Set(Constants.Variables.System.CollectionId, "7aee6dde-6381-4098-93e7-50a8264cf066");
                executionContext.Object.Variables.Set(Constants.Variables.System.DefinitionId, "7");
                var endpoint = new ServiceEndpoint
                {
                    Url = new Uri("http://contoso:8080/tfs/DefaultCollection/gitTest/_git/gitTest"),
                };
                var sourceProvider = new ConcreteSourceProvider();
                sourceProvider.Initialize(tc);

                // Act.
                string hashKey = sourceProvider.GetBuildDirectoryHashKey(executionContext.Object, endpoint);

                // Assert.
                Assert.Equal("5c5c3d7ac33cca6604736eb3af977f23f1cf1146", hashKey);
            }
        }
开发者ID:codedebug,项目名称:vsts-agent,代码行数:26,代码来源:SourceProviderL0.cs

示例8: GetBuildDirectoryHashKey

        public string GetBuildDirectoryHashKey(IExecutionContext executionContext, ServiceEndpoint endpoint)
        {
            // Validate parameters.
            Trace.Entering();
            ArgUtil.NotNull(executionContext, nameof(executionContext));
            ArgUtil.NotNull(executionContext.Variables, nameof(executionContext.Variables));
            ArgUtil.NotNull(endpoint, nameof(endpoint));
            ArgUtil.NotNull(endpoint.Url, nameof(endpoint.Url));

            // Calculate the hash key.
            const string Format = "{{{{ \r\n    \"system\" : \"build\", \r\n    \"collectionId\" = \"{0}\", \r\n    \"definitionId\" = \"{1}\", \r\n    \"repositoryUrl\" = \"{2}\", \r\n    \"sourceFolder\" = \"{{0}}\",\r\n    \"hashKey\" = \"{{1}}\"\r\n}}}}";
            string hashInput = string.Format(
                CultureInfo.InvariantCulture,
                Format,
                executionContext.Variables.System_CollectionId,
                executionContext.Variables.System_DefinitionId,
                endpoint.Url.AbsoluteUri);
            using (SHA1 sha1Hash = SHA1.Create())
            {
                byte[] data = sha1Hash.ComputeHash(Encoding.UTF8.GetBytes(hashInput));
                StringBuilder hexString = new StringBuilder();
                for (int i = 0; i < data.Length; i++)
                {
                    hexString.Append(data[i].ToString("x2"));
                }

                return hexString.ToString();
            }
        }
开发者ID:codedebug,项目名称:vsts-agent,代码行数:29,代码来源:SourceProvider.cs

示例9: SendDirectMessageAndGetResponse

 public IDictionary<string, string> SendDirectMessageAndGetResponse(ServiceEndpoint provider, IDictionary<string, string> fields)
 {
     OnSending(provider, fields);
     var results = channel.SendDirectMessageAndGetResponse(provider, fields);
     OnReceiving(provider, results);
     return results;
 }
开发者ID:tt,项目名称:dotnetopenid,代码行数:7,代码来源:DirectMessageSniffWrapper.cs

示例10: GetSourceAsync

        public async Task GetSourceAsync(IExecutionContext executionContext, ServiceEndpoint endpoint, CancellationToken cancellationToken)
        {
            Trace.Verbose("Entering SvnSourceProvider.GetSourceAsync");

            // Validate args.
            ArgUtil.NotNull(executionContext, nameof(executionContext));
            ArgUtil.NotNull(endpoint, nameof(endpoint));

            ISvnCommandManager svn = HostContext.CreateService<ISvnCommandManager>();
            svn.Init(executionContext, endpoint, cancellationToken);

            // Determine the sources directory.
            string sourcesDirectory = executionContext.Variables.Build_SourcesDirectory;
            executionContext.Debug($"sourcesDirectory={sourcesDirectory}");
            ArgUtil.NotNullOrEmpty(sourcesDirectory, nameof(sourcesDirectory));

            string sourceBranch = executionContext.Variables.Build_SourceBranch;
            executionContext.Debug($"sourceBranch={sourceBranch}");

            string revision = executionContext.Variables.Build_SourceVersion;
            if (string.IsNullOrWhiteSpace(revision))
            {
                revision = "HEAD";
            }
            executionContext.Debug($"revision={revision}");

            bool clean = endpoint.Data.ContainsKey(WellKnownEndpointData.Clean) &&
                StringUtil.ConvertToBoolean(endpoint.Data[WellKnownEndpointData.Clean], defaultValue: false);
            executionContext.Debug($"clean={clean}");

            // Get the definition mappings.
            List<SvnMappingDetails> allMappings = JsonConvert.DeserializeObject<SvnWorkspace>(endpoint.Data[WellKnownEndpointData.SvnWorkspaceMapping]).Mappings;

            if (executionContext.Variables.System_Debug.HasValue && executionContext.Variables.System_Debug.Value)
            {
                allMappings.ForEach(m => executionContext.Debug($"ServerPath: {m.ServerPath}, LocalPath: {m.LocalPath}, Depth: {m.Depth}, Revision: {m.Revision}, IgnoreExternals: {m.IgnoreExternals}"));
            }

            Dictionary<string, SvnMappingDetails> normalizedMappings = svn.NormalizeMappings(allMappings);
            if (executionContext.Variables.System_Debug.HasValue && executionContext.Variables.System_Debug.Value)
            {
                executionContext.Debug($"Normalized mappings count: {normalizedMappings.Count}");
                normalizedMappings.ToList().ForEach(p => executionContext.Debug($"    [{p.Key}] ServerPath: {p.Value.ServerPath}, LocalPath: {p.Value.LocalPath}, Depth: {p.Value.Depth}, Revision: {p.Value.Revision}, IgnoreExternals: {p.Value.IgnoreExternals}"));
            }

            string normalizedBranch = svn.NormalizeRelativePath(sourceBranch, '/', '\\');

            executionContext.Output(StringUtil.Loc("SvnSyncingRepo", endpoint.Name));

            string effectiveRevision = await svn.UpdateWorkspace(
                sourcesDirectory,
                normalizedMappings,
                clean,
                normalizedBranch,
                revision);

            executionContext.Output(StringUtil.Loc("SvnBranchCheckedOut", normalizedBranch, endpoint.Name, effectiveRevision));
            Trace.Verbose("Leaving SvnSourceProvider.GetSourceAsync");
        }
开发者ID:codedebug,项目名称:vsts-agent,代码行数:59,代码来源:SvnSourceProvider.cs

示例11: SendDirectMessageAndGetResponse

		public IDictionary<string, string> SendDirectMessageAndGetResponse(ServiceEndpoint providerEndpoint, IDictionary<string, string> fields) {
			OpenIdProvider provider = new OpenIdProvider(providerStore, providerEndpoint.ProviderEndpoint,
				providerEndpoint.ProviderEndpoint, fields.ToNameValueCollection());
			Debug.Assert(provider.Request.IsResponseReady, "Direct messages should always have an immediately available response.");
			Response webResponse = (Response)provider.Request.Response;
			EncodableResponse opAuthResponse = (EncodableResponse)webResponse.EncodableMessage;
			return opAuthResponse.EncodedFields;
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:8,代码来源:DirectMessageTestRedirector.cs

示例12: WithPort_Valid

        public void WithPort_Valid()
        {
            var before = new ServiceEndpoint("host", 10);
            var after = before.WithPort(20);

            Assert.Equal(before.Host, after.Host);
            Assert.Equal(10, before.Port);
            Assert.Equal(20, after.Port);
        }
开发者ID:googleapis,项目名称:gax-dotnet,代码行数:9,代码来源:ServiceEndpointTest.cs

示例13: WithHost_Valid

        public void WithHost_Valid()
        {
            var before = new ServiceEndpoint("before", 10);
            var after = before.WithHost("after");

            Assert.Equal(before.Port, after.Port);
            Assert.Equal("before", before.Host);
            Assert.Equal("after", after.Host);
        }
开发者ID:googleapis,项目名称:gax-dotnet,代码行数:9,代码来源:ServiceEndpointTest.cs

示例14: Init

 public void Init()
 {
     fixture = new Fixture();
     spanCollectorBuilder = MockRepository.GenerateStub<ISpanCollectorBuilder>();
     zipkinEndpoint = MockRepository.GenerateStub<ServiceEndpoint>();
     traceProvider = MockRepository.GenerateStub<ITraceProvider>();
     logger = MockRepository.GenerateStub<IMDLogger>();
     requestName = fixture.Create<string>();
 }
开发者ID:theburningmonk,项目名称:Medidata.ZipkinTracerModule,代码行数:9,代码来源:ZipkinClientTests.cs

示例15: WriteChannelDescription

 internal ChannelEndpointElement WriteChannelDescription(ServiceEndpoint endpoint, string typeName)
 {
     ChannelEndpointElement element = null;
     BindingDictionaryValue value2 = this.CreateBindingConfig(endpoint.Binding);
     element = new ChannelEndpointElement(endpoint.Address, typeName);
     element.Name = NamingHelper.GetUniqueName(NamingHelper.CodeName(endpoint.Name), new NamingHelper.DoesNameExist(this.CheckIfChannelNameInUse), null);
     element.BindingConfiguration = value2.BindingName;
     element.Binding = value2.BindingSectionName;
     this.channels.Add(element);
     return element;
 }
开发者ID:gtri-iead,项目名称:LEXS-NET-Sample-Implementation-3.1.4,代码行数:11,代码来源:ConfigWriter.cs


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