Kudu.Services.ServiceHookHandlers.GitHubHandler.DetermineSecurityProtocol C# (CSharp) Method

DetermineSecurityProtocol() protected method

protected DetermineSecurityProtocol ( Newtonsoft.Json.Linq.JObject payload ) : string
payload Newtonsoft.Json.Linq.JObject
return string
        protected override string DetermineSecurityProtocol(JObject payload)
        {
            JObject repository = payload.Value<JObject>("repository");
            string repositoryUrl = repository.Value<string>("url");
            bool isPrivate = repository.Value<bool>("private");
            if (isPrivate)
            {
                repositoryUrl = repository.Value<string>("ssh_url");
            }
            else if (!String.Equals(new Uri(repositoryUrl).Host, "github.com", StringComparison.OrdinalIgnoreCase))
            {
                
                if (_environment != null && FileSystemHelpers.FileExists(Path.Combine(_environment.SSHKeyPath, PrivateKeyFile)))
                {
                    // if we determine that a github request does not come from "github.com"
                    // and it is not a private repository, but we still find a ssh key, we assume 
                    // the request is from a private GHE 
                    repositoryUrl = repository.Value<string>("ssh_url");
                }
            }
            return repositoryUrl;
        }