GraphQL: Use cert from store

This commit is contained in:
Jonathan Jenne
2020-05-13 11:42:28 +02:00
parent 874cf74796
commit 3ece4e6222
4 changed files with 77 additions and 38 deletions

View File

@@ -2,6 +2,7 @@
Public Property ConnectionString As String = "Server=SERVER;Database=DATABASE;User Id=sa;Password=dd"
Public Property CertificateFile As String = "C:\Path\To\Cert.pfx"
Public Property CertificatePass As String = "CertificatePassword"
Public Property CertificateFingerprint As String = ""
Public Property Email As String = "foo.bar@wisag.de"
Public Property Password As String = "Password"
Public Property BaseUrl As String = "https://data.api.wisag.de:8443"

View File

@@ -40,6 +40,9 @@ Partial Class frmMain
Me.Label7 = New System.Windows.Forms.Label()
Me.TabControl1 = New System.Windows.Forms.TabControl()
Me.pageRaw = New System.Windows.Forms.TabPage()
Me.pageQuery = New System.Windows.Forms.TabPage()
Me.txtQuery = New System.Windows.Forms.TextBox()
Me.txtOperation = New System.Windows.Forms.TextBox()
Me.btnLogin = New System.Windows.Forms.Button()
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
Me.txtProxyHost = New System.Windows.Forms.TextBox()
@@ -50,9 +53,8 @@ Partial Class frmMain
Me.Label10 = New System.Windows.Forms.Label()
Me.txtProxyPort = New System.Windows.Forms.TextBox()
Me.Label11 = New System.Windows.Forms.Label()
Me.pageQuery = New System.Windows.Forms.TabPage()
Me.txtQuery = New System.Windows.Forms.TextBox()
Me.txtOperation = New System.Windows.Forms.TextBox()
Me.txtCertFingerprint = New System.Windows.Forms.TextBox()
Me.Label12 = New System.Windows.Forms.Label()
Me.TabControl1.SuspendLayout()
Me.pageRaw.SuspendLayout()
Me.pageQuery.SuspendLayout()
@@ -165,16 +167,16 @@ Partial Class frmMain
'
'txtConnectionString
'
Me.txtConnectionString.Location = New System.Drawing.Point(106, 136)
Me.txtConnectionString.Location = New System.Drawing.Point(106, 167)
Me.txtConnectionString.Multiline = True
Me.txtConnectionString.Name = "txtConnectionString"
Me.txtConnectionString.Size = New System.Drawing.Size(338, 98)
Me.txtConnectionString.Size = New System.Drawing.Size(338, 67)
Me.txtConnectionString.TabIndex = 1
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(12, 139)
Me.Label6.Location = New System.Drawing.Point(12, 167)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(88, 13)
Me.Label6.TabIndex = 2
@@ -219,6 +221,36 @@ Partial Class frmMain
Me.pageRaw.Text = "Raw GraphQL Result"
Me.pageRaw.UseVisualStyleBackColor = True
'
'pageQuery
'
Me.pageQuery.Controls.Add(Me.txtQuery)
Me.pageQuery.Controls.Add(Me.txtOperation)
Me.pageQuery.Location = New System.Drawing.Point(4, 22)
Me.pageQuery.Name = "pageQuery"
Me.pageQuery.Padding = New System.Windows.Forms.Padding(3)
Me.pageQuery.Size = New System.Drawing.Size(464, 348)
Me.pageQuery.TabIndex = 1
Me.pageQuery.Text = "Custom Query"
Me.pageQuery.UseVisualStyleBackColor = True
'
'txtQuery
'
Me.txtQuery.Dock = System.Windows.Forms.DockStyle.Fill
Me.txtQuery.Font = New System.Drawing.Font("Consolas", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtQuery.Location = New System.Drawing.Point(3, 23)
Me.txtQuery.Multiline = True
Me.txtQuery.Name = "txtQuery"
Me.txtQuery.Size = New System.Drawing.Size(458, 322)
Me.txtQuery.TabIndex = 0
'
'txtOperation
'
Me.txtOperation.Dock = System.Windows.Forms.DockStyle.Top
Me.txtOperation.Location = New System.Drawing.Point(3, 3)
Me.txtOperation.Name = "txtOperation"
Me.txtOperation.Size = New System.Drawing.Size(458, 20)
Me.txtOperation.TabIndex = 1
'
'btnLogin
'
Me.btnLogin.Location = New System.Drawing.Point(724, 386)
@@ -299,35 +331,21 @@ Partial Class frmMain
Me.Label11.TabIndex = 2
Me.Label11.Text = "Proxy Port"
'
'pageQuery
'txtCertFingerprint
'
Me.pageQuery.Controls.Add(Me.txtQuery)
Me.pageQuery.Controls.Add(Me.txtOperation)
Me.pageQuery.Location = New System.Drawing.Point(4, 22)
Me.pageQuery.Name = "pageQuery"
Me.pageQuery.Padding = New System.Windows.Forms.Padding(3)
Me.pageQuery.Size = New System.Drawing.Size(464, 348)
Me.pageQuery.TabIndex = 1
Me.pageQuery.Text = "Custom Query"
Me.pageQuery.UseVisualStyleBackColor = True
Me.txtCertFingerprint.Location = New System.Drawing.Point(106, 136)
Me.txtCertFingerprint.Name = "txtCertFingerprint"
Me.txtCertFingerprint.Size = New System.Drawing.Size(338, 20)
Me.txtCertFingerprint.TabIndex = 1
'
'txtQuery
'Label12
'
Me.txtQuery.Dock = System.Windows.Forms.DockStyle.Fill
Me.txtQuery.Font = New System.Drawing.Font("Consolas", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtQuery.Location = New System.Drawing.Point(3, 23)
Me.txtQuery.Multiline = True
Me.txtQuery.Name = "txtQuery"
Me.txtQuery.Size = New System.Drawing.Size(458, 322)
Me.txtQuery.TabIndex = 0
'
'txtOperation
'
Me.txtOperation.Dock = System.Windows.Forms.DockStyle.Top
Me.txtOperation.Location = New System.Drawing.Point(3, 3)
Me.txtOperation.Name = "txtOperation"
Me.txtOperation.Size = New System.Drawing.Size(458, 20)
Me.txtOperation.TabIndex = 1
Me.Label12.AutoSize = True
Me.Label12.Location = New System.Drawing.Point(12, 139)
Me.Label12.Name = "Label12"
Me.Label12.Size = New System.Drawing.Size(78, 13)
Me.Label12.TabIndex = 2
Me.Label12.Text = "Cert Fingerprint"
'
'frmMain
'
@@ -339,6 +357,7 @@ Partial Class frmMain
Me.Controls.Add(Me.cmbQuery)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label12)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label10)
@@ -349,6 +368,7 @@ Partial Class frmMain
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtConnectionString)
Me.Controls.Add(Me.txtCertFingerprint)
Me.Controls.Add(Me.txtCertPass)
Me.Controls.Add(Me.txtCertFile)
Me.Controls.Add(Me.txtProxyPass)
@@ -403,4 +423,6 @@ Partial Class frmMain
Friend WithEvents pageQuery As TabPage
Friend WithEvents txtQuery As TextBox
Friend WithEvents txtOperation As TextBox
Friend WithEvents txtCertFingerprint As TextBox
Friend WithEvents Label12 As Label
End Class

View File

@@ -56,8 +56,11 @@ Public Class frmMain
txtBaseUrl.Text = _Config.Config.BaseUrl
txtUsername.Text = _Config.Config.Email
txtPassword.Text = _Config.Config.Password
txtCertFile.Text = _Config.Config.CertificateFile
txtCertPass.Text = _Config.Config.CertificatePass
txtCertFingerprint.Text = _Config.Config.CertificateFingerprint
txtConnectionString.Text = _Config.Config.ConnectionString
txtProxyHost.Text = _Config.Config.ProxyHost
txtProxyPort.Text = _Config.Config.ProxyPort
@@ -81,8 +84,7 @@ Public Class frmMain
txtBaseUrl.Text,
txtUsername.Text,
txtPassword.Text,
txtCertFile.Text,
txtCertPass.Text)
txtCertFingerprint.Text)
If _Config.Config.HasProxySet() And _Config.Config.HasProxyCredentialsSet() Then
Dim oURI As New Uri($"http://{_Config.Config.ProxyHost}:{_Config.Config.ProxyPort}")
@@ -210,8 +212,11 @@ Public Class frmMain
Try
_Config.Config.ConnectionString = txtConnectionString.Text
_Config.Config.BaseUrl = txtBaseUrl.Text
_Config.Config.CertificateFile = txtCertFile.Text
_Config.Config.CertificatePass = txtCertPass.Text
_Config.Config.CertificateFingerprint = txtCertFingerprint.Text
_Config.Config.Email = txtUsername.Text
_Config.Config.Password = txtPassword.Text
_Config.Config.ProxyHost = txtProxyHost.Text