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;
     }
 }
Example #2
0
        public MastodonClient(string domain) : base($"https://{domain}", AuthMode.OAuth2, RequestMode.FormUrlEncoded)
        {
            Domain           = domain;
            BinaryParameters = new List <string> {
                "avatar", "header", "file"
            };

            Account        = new AccountsClient(this);
            Apps           = new AppsClient(this);
            Auth           = new AuthClient(this);
            Blocks         = new BlocksClient(this);
            CustomEmojis   = new CustomEmojisClient(this);
            DomainBlocks   = new DomainBlocksClient(this);
            Endorsements   = new EndorsementsClient(this);
            Favorites      = new FavoritesClient(this);
            Filters        = new FiltersClient(this);
            FollowRequests = new FollowRequestsClient(this);
            Follows        = new FollowsClient(this);
            Instance       = new InstanceClient(this);
            Lists          = new ListsClient(this);
            Media          = new MediaClient(this);
            Notifications  = new NotificationsClient(this);
            Push           = new PushClient(this);
            Reports        = new ReportsClient(this);
            SearchV1       = new SearchV1Client(this);
            SearchV2       = new SearchV2Client(this);
            Statuses       = new StatusesClient(this);
            Streaming      = new StreamingClient(this);
            Suggestions    = new SuggestionsClient(this);
            Timelines      = new TimelinesClient(this);
        }
        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
        }
Example #4
0
        public MastodonClient(Credential credential, HttpClientHandler innerHandler = null) : base(credential, new OAuth2HttpClientHandler(innerHandler), RequestMode.FormUrlEncoded)
        {
            BinaryParameters = new List <string> {
                "avatar", "header", "file"
            };

            Account           = new AccountsClient(this);
            Apps              = new AppsClient(this);
            Auth              = new AuthClient(this);
            Blocks            = new BlocksClient(this);
            Conversations     = new ConversationsClient(this);
            CustomEmojis      = new CustomEmojisClient(this);
            DomainBlocks      = new DomainBlocksClient(this);
            Endorsements      = new EndorsementsClient(this);
            Favorites         = new FavoritesClient(this);
            Filters           = new FiltersClient(this);
            FollowRequests    = new FollowRequestsClient(this);
            Follows           = new FollowsClient(this);
            Instance          = new InstanceClient(this);
            Lists             = new ListsClient(this);
            Media             = new MediaClient(this);
            Notifications     = new NotificationsClient(this);
            Push              = new PushClient(this);
            Reports           = new ReportsClient(this);
            ScheduledStatuses = new ScheduledStatusesClient(this);
            SearchV1          = new SearchV1Client(this);
            SearchV2          = new SearchV2Client(this);
            Statuses          = new StatusesClient(this);
            Streaming         = new StreamingClient(this);
            Suggestions       = new SuggestionsClient(this);
            Timelines         = new TimelinesClient(this);
        }
        private void Setup(string apiToken, Uri baseUri)
        {
            settings          = new OktaSettings();
            settings.ApiToken = apiToken;
            settings.BaseUri  = baseUri;

            client   = new OktaClient(settings);
            users    = client.GetUsersClient();
            groups   = client.GetGroupsClient();
            sessions = client.GetSessionsClient();
            apps     = client.GetAppsClient();
        }
 public void AddSwaApp()
 {
     try
     {
         App        app        = App.BuildSwaPlugin("http://localhost/login", "username", "password", "btnLogin", "Test SWA App 1");
         AppsClient appsClient = oktaClient.GetAppsClient();
         app = appsClient.Add(app);
     }
     catch (OktaException oe)
     {
         string strError = oe.ErrorSummary;
     }
 }
 public void AddWSFedApp()
 {
     try
     {
         App  app        = App.BuildWSFed("Test WS-Fed App", "urn:example:app", "SampleGroup", "samAccountName", "urn:example:apprealm", "https://apps.example.com/wsfed/app1/replyto", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname|${user.firstName}|,http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname|${user.lastName}|", "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", "urn:oasis:names:tc:SAML:2.0:ac:classes:Password", "https://example.com/app1", true, "app1.*", usernameAttribute: "upnAndUsername");
         Hide visibility = new Hide
         {
             Web = true,
             IOS = true
         };
         app.Visibility.Hide = visibility;
         AppsClient appsClient = oktaClient.GetAppsClient();
         app = appsClient.Add(app);
     }
     catch (OktaException oe)
     {
         string strError = oe.ErrorSummary;
     }
 }
Example #8
0
    public static async Task Upload(string path, AppVersion version, AppArch arch)
    {
        try
        {
            var t   = DateTime.Now;
            var api = new AppsClient {
                BaseUrl = "https://elyspio.fr/updater"
            };
            var bytes = File.ReadAllBytes(path);
            Console.WriteLine("Adding " + path);
            await api.AddAsync("Elytools", version.ToString(), arch, bytes);

            Console.WriteLine($"Added {path} in {(DateTime.Now - t).Seconds}s");
        }

        catch (Exception e)
        {
            Console.WriteLine($"Error in upload of {path}, retry in 1s");
            await Task.Delay(1000);
            await Upload(path, version, arch);
        }
    }
        protected static async Task<IGalleryContext> ConnectAsync(IExtendedWorkspacesClient extendedWorkspacesClient,
            Uri appsEndpoint, string authenticationToken, string account, string workspace, SandboxCollection sandboxes, 
            string serviceName, string[] excludePrefixes, CancellationToken cancellationToken)
        {
            workspace = workspace ?? DefaultWorkspace;
            excludePrefixes = excludePrefixes ?? EmptyStringArray;

            var workspacesContextConnector = new WorkspacesContextConnector(extendedWorkspacesClient, account, workspace,
                sandboxes, serviceName, excludePrefixes);

            var apps = await workspacesContextConnector.GetAppsAsync(cancellationToken).ConfigureAwait(false);

            var appsConnector = new AppsConnector(appsEndpoint, authenticationToken);
            var appsClient = new AppsClient(appsConnector);

            var sandboxesClient = new SandboxesClient(appsConnector);
            var appsContextConnector = new AppsContextConnector(appsClient, sandboxesClient, apps, sandboxes,
                serviceName, excludePrefixes);

            return new GalleryContext(account, workspace, sandboxes, workspacesContextConnector, appsContextConnector);
        }