示例#1
0
文件: Main.cs 项目: VitorX/TokenTool
        //private void btnModifyApp_Click(object sender, EventArgs e)
        //{
        //    string clientId = ((AzureApp)listApps.SelectedItem).ClientId;
        //    AppsEdit formEdit = new AppsEdit(clientId);
        //    ShowFormBeside(this, formEdit);

        //}

        private void btnDelegateToken_Click(object sender, EventArgs e)
        {
            string           clientId         = ((AzureApp)listApps.SelectedItem).ClientId;
            AzureApp         app              = dataService.GetApp(clientId);
            TokenRequest     tokenRequest     = new TokenRequest(app, lstResrouce.Text, lstUsers.Text);
            TokenRequestHelp tokenRequestHelp = new TokenRequestHelp(tokenRequest);

            tokenRequestHelp.Send("https://login.microsoftonline.com");
            dataService.SaveApp(app);

            RefreshTokenControlUI();
            MessageBox.Show(tokenRequest.AccessToken);
        }
示例#2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            AzureApp app;

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

            MessageBox.Show("Modify Successfuly!");

            this.Close();
        }