Esempio n. 1
0
        public void RunImport(string zipName, string idpClientSecret)
        {
            BaseRequest.LogInfo("Importing data...", ConsoleColor.Magenta);
            bool flag = false;

            try
            {
                this.UnzipFiles(zipName);
                flag = this.SendIdentityProviderToApi(this.CreateIdentityProviderJson(this.ValidateOrCreateClientSecret(idpClientSecret)));
            }
            catch (DirectoryNotFoundException ex)
            {
                BaseRequest.LogError(ex.Message, ConsoleColor.Red);
            }
            catch (Exception ex)
            {
                BaseRequest.LogError(ex.ToString(), ConsoleColor.Red);
            }
            FederationLibrary.DeleteContentDirectory();
            if (flag)
            {
                BaseRequest.LogInfo("Import complete.", ConsoleColor.Magenta);
            }
            else
            {
                BaseRequest.LogError("Import failed.", ConsoleColor.Red);
            }
        }
Esempio n. 2
0
 public void RunExport(string zipName)
 {
     BaseRequest.LogInfo("Exporting data...", ConsoleColor.Magenta);
     Exporter.MakeContentDirectory();
     try
     {
         if (this.RetrieveAndStoreMetadata() && this.RetrieveAndStoreJwks() && this.RetrieveAndStoreSamlMetadata() && this.RetreiveAndStoreIdentityProviderInformation())
         //if (this.RetrieveAndStoreMetadata() && this.RetrieveAndStoreJwks() && this.RetrieveAndStoreSamlMetadata()) && this.RetreiveAndStoreIdentityProviderInformation())
         {
             Exporter.ZipContentDirectory(zipName);
             FederationLibrary.DeleteContentDirectory();
             BaseRequest.LogInfo("Export complete.", ConsoleColor.Magenta);
             return;
         }
     }
     catch (Exception ex)
     {
         BaseRequest.LogError(ex.ToString(), ConsoleColor.Red);
     }
     FederationLibrary.DeleteContentDirectory();
     BaseRequest.LogError("Export failed.", ConsoleColor.Red);
 }