Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AzureApp app;

            if (((AzureAppType)comboType.SelectedItem) == AzureAppType.Server)
            {
                app = new ServerAzureApp
                {
                    AppName     = textAppName.Text,
                    ClientId    = txtClientId.Text,
                    RedirectURL = txtRedirectURL.Text,
                    Secret      = txtSecret.Text
                };
            }
            else
            {
                app = new ClientAzureApp
                {
                    AppName     = textAppName.Text,
                    ClientId    = txtClientId.Text,
                    RedirectURL = txtRedirectURL.Text,
                };
            }

            TokenAssistantServiceClient dataServiceSlient = new TokenAssistantServiceClient();

            dataServiceSlient.AddApp(app);

            MessageBox.Show("Add successfully!");

            this.Close();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            TokenAssistantServiceClient azureAppDbHelperClient = new TokenAssistantServiceClient();

            foreach (var app in azureAppDbHelperClient.GetAllApps())
            {
                Console.WriteLine(String.Format("{0}:{1}", app.AppName, app.Type));
                Console.WriteLine(app.Type);
                if (app.tokenRequests.Length > 0)
                {
                    Console.WriteLine(String.Format("\t{0,-30}{1,-30}", "Resource", "SignInUserName"));
                }
                foreach (var tokenRequest in app.tokenRequests)
                {
                    Console.WriteLine(String.Format("\t{0,-30}{1,-30}", tokenRequest.Resource, tokenRequest.SignInUserName));
                }
            }

            Console.ReadLine();
        }
Ejemplo n.º 3
0
        private void RefreshTokenControlUI()
        {
            try
            {
                dataService = getDbContext();
                var appId = ((AzureApp)listApps.SelectedItem).ClientId;
                var app   = dataService.GetApp(appId);

                var tokenRequestIndex = app.tokenRequests.FindIndex(tokekRequest => (tokekRequest.Resource == lstResrouce.Text && tokekRequest.SignInUserName == lstUsers.Text));
                if (tokenRequestIndex != -1)
                {
                    txtAccessToken.Text  = app.tokenRequests[tokenRequestIndex].AccessToken;
                    txtRefreshToken.Text = app.tokenRequests[tokenRequestIndex].RefreshToken;
                }
                else
                {
                    txtAccessToken.Text  = "";
                    txtRefreshToken.Text = "";
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 4
0
 static Users()
 {
     //_userNames = ConfigurationManager.AppSettings["Users"].Split(new char[] { ';', ',' }).ToList<string>();
     TokenAssistantServiceClient dataService = new TokenAssistantServiceClient();
     //dataService.
 }
Ejemplo n.º 5
0
 private void RefreshListApps()
 {
     dataService = getDbContext();
     BindListApps();
 }