Exemple #1
0
        private static async Task <int> DownsyncWithAuthentication(Config config, GoogleOAuthFlow.ApplicationOAuthConfiguration applicationOAuthConfiguration, string folder, string package)
        {
            if (((string)config.BlockStorageURI).StartsWith("gs://"))
            {
                await GoogleOAuthFlow.RefreshUserApplicationDefaultCredentials(applicationOAuthConfiguration);

                if (!await Longtail.DownsyncFromGSBucket(applicationOAuthConfiguration.ApplicationDefaultCredentialsFile, config.BlockStorageURI, folder, PackageNameToURI(config.VersionIndexStorageURI, package)))
                {
                    Console.WriteLine("Untar operation failed.");
                    return(1);
                }
            }
            else
            {
                if (!await Longtail.DownsyncFromLocalStore(config.BlockStorageURI, folder, PackageNameToURI(config.VersionIndexStorageURI, package)))
                {
                    Console.WriteLine("Untar operation failed.");
                    return(1);
                }
            }

            return(0);
        }
Exemple #2
0
        private static async Task CreateUserAuth()
        {
            Initialize(out _, out GoogleOAuthFlow.ApplicationOAuthConfiguration applicationOAuthConfiguration);

            await GoogleOAuthFlow.CreateUserApplicationDefaultCredentials(applicationOAuthConfiguration);
        }
Exemple #3
0
 private static void ClearAuth()
 {
     GoogleOAuthFlow.RemoveApplicationDefaultCredentials(ApplicationDefaultCredentialsFile);
 }