Ejemplo n.º 1
0
 public void RemoveApp()
 {
     try
     {
         AppsClient         appsClient = oktaClient.GetAppsClient();
         FilterBuilder      filter     = new FilterBuilder("status eq \"ACTIVE\"");
         PagedResults <App> apps       = appsClient.GetList(nextPage: null, pageSize: 200, filter: filter);
         App selectedApp = null;
         foreach (App app in apps.Results)
         {
             if (app.Label == "Test SWA App 1" || app.Label == "Test WS-Fed App")
             {
                 selectedApp = app;
                 break;
             }
         }
         try
         {
             if (selectedApp != null)
             {
                 appsClient.Deactivate(selectedApp);
                 appsClient.Remove(selectedApp);
             }
         }
         catch (OktaException oe)
         {
             string strError = oe.ErrorSummary;
         }
     }
     catch (OktaException oe)
     {
         string strError = oe.ErrorSummary;
     }
 }
        public string FindAppByName()
        {
            ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            NameValueCollection appSettings = ConfigurationManager.AppSettings;

            logger.Debug("FindAppByName  ");

            string appName = appSettings["custom.StorageAppName"];

            //check App profile where help desk credentials are stored

            try
            {
                App myApp = new App();
                //myApp.Id = appId;
                OktaClient oktaClient = new OktaClient(_orgSettings);
                AppsClient appsClient = oktaClient.GetAppsClient();

                PagedResults <App> integratedApps = appsClient.GetList(query: appName);
                myApp.Id = integratedApps.LastId;

                return(myApp.Id);
            }
            catch (OktaException ex)
            {
                logger.Error(" ErrorCode: " + ex.ErrorCode + " " + ex.ErrorSummary);
                return(null);
            }//end catch
        }