private Tuple <bool, string, string, string> TryDecodeToken(string Token) { string decodedHeader = ""; string decodedClaim = ""; string decodedSignature = ""; bool result = false; try { string[] tokenParts = Token.Split('.'); if (tokenParts.Length < 2) { return(new Tuple <bool, string, string, string>(false, "", "", "")); } decodedHeader = RequestForm.parseJsonResponse(Encoding.UTF8.GetString(ConvertFromBase64String(tokenParts[0]))); decodedClaim = RequestForm.parseJsonResponse(Encoding.UTF8.GetString(ConvertFromBase64String(tokenParts[1]))); decodedSignature = BitConverter.ToString(ConvertFromBase64String(tokenParts[2])); result = true; } catch (Exception) { result = false; } return(new Tuple <bool, string, string, string>(result, decodedHeader, decodedClaim, decodedSignature)); }
public MyApplicationContext() { string mode = ""; ModeSelectionForm modeSelectionForm = new ModeSelectionForm(); modeSelectionForm.ShowDialog(out mode); if (mode == "Editor") { RequestForm requestForm = new RequestForm(); requestForm.FormClosed += new FormClosedEventHandler(OnFormClosed); requestForm.Show(); } else if (mode == "MailboxViewer") { MailboxViewerForm mailboxViewerForm = new MailboxViewerForm(); mailboxViewerForm.FormClosed += new FormClosedEventHandler(OnFormClosed); mailboxViewerForm.Show(); } else { Environment.Exit(0); } }
private void newEditorToolStripMenuItem_Click(object sender, EventArgs e) { if (requestFormOpened) { MessageBox.Show("Editor window is already opened.", "Office365APIEditor"); } else { requestFormOpened = true; RequestForm requestForm = new RequestForm(); requestForm.Owner = this; requestForm.Show(); } }
private void DetailedTokenViewer_Load(object sender, EventArgs e) { string[] tokenParts = _token.Split('.'); // Decode headers. textBox_Header.Text = RequestForm.parseJsonResponse(Encoding.UTF8.GetString(ConvertFromBase64String(tokenParts[0]))); if (tokenParts.Length == 1) { MessageBox.Show("You are using Token ID.", "Office365APIEditor"); } else { // Decode claims. textBox_Claim.Text = RequestForm.parseJsonResponse(Encoding.UTF8.GetString(ConvertFromBase64String(tokenParts[1]))); // Decode signature. textBox_Signature.Text = BitConverter.ToString(ConvertFromBase64String(tokenParts[2])); } }
private void radioButton_Original_CheckedChanged(object sender, EventArgs e) { // If "Decoded JSON" is selected, parse the value as JSON string. textBox_PropertyValue.Text = (radioButton_Original.Checked) ? propertyValue : RequestForm.DecodeJsonResponse(RequestForm.parseJsonResponse(propertyValue)); }
private void newEditorToolStripMenuItem_Click(object sender, EventArgs e) { RequestForm requestForm = new RequestForm(); requestForm.Show(); }