2 Commits

Author SHA1 Message Date
Jonathan Jenne
f3eef04a09 Interfaces: Version 1.12.1.0 2024-01-22 11:33:45 +01:00
Jonathan Jenne
b55e045cca Interfaces/GraphQL: add logging, fix finding certificates 2024-01-22 11:33:21 +01:00
2 changed files with 25 additions and 4 deletions

View File

@@ -22,6 +22,15 @@ Public Class GraphQLInterface
Public Property Proxy As WebProxy Public Property Proxy As WebProxy
Public Property Credentials As NetworkCredential Public Property Credentials As NetworkCredential
Public Event LogRequested As EventHandler(Of String)
Public ReadOnly Property Certificate As X509Certificate2
Get
Return _certificate
End Get
End Property
Public Sub New(LogConfig As LogConfig, BaseUrl As String, Email As String, Password As String, CertificateFingerprint As String) Public Sub New(LogConfig As LogConfig, BaseUrl As String, Email As String, Password As String, CertificateFingerprint As String)
Try Try
_logConfig = LogConfig _logConfig = LogConfig
@@ -46,6 +55,10 @@ Public Class GraphQLInterface
Exit For Exit For
End If End If
Next Next
If oCertificate IsNot Nothing Then
Exit For
End If
Next Next
@@ -103,10 +116,18 @@ Public Class GraphQLInterface
Public Function Login() As HttpWebResponse Public Function Login() As HttpWebResponse
Try Try
RaiseEvent LogRequested(Me, $"Login started with user: [{_userEmail}]")
Dim oLoginData As New LoginData() With {.email = _userEmail, .token = _userPassword} Dim oLoginData As New LoginData() With {.email = _userEmail, .token = _userPassword}
Dim oBytes As Byte() = ToBytes(JsonConvert.SerializeObject(oLoginData)) Dim oBytes As Byte() = ToBytes(JsonConvert.SerializeObject(oLoginData))
Dim oRequest As HttpWebRequest = GetRequest("/login", oBytes) Dim oRequest As HttpWebRequest = GetRequest("/login", oBytes)
RaiseEvent LogRequested(Me, $"Sending HTTP request to GraphQL")
RaiseEvent LogRequested(Me, $"Request Host: [{oRequest.Host}]")
RaiseEvent LogRequested(Me, $"Request Address: [{oRequest.Address}]")
RaiseEvent LogRequested(Me, $"Request Method: [{oRequest.Method}]")
RaiseEvent LogRequested(Me, $"Request ContentType: [{oRequest.ContentType}]")
Using oStream = oRequest.GetRequestStream() Using oStream = oRequest.GetRequestStream()
oStream.Write(oBytes, 0, oBytes.Length) oStream.Write(oBytes, 0, oBytes.Length)
End Using End Using

View File

@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")> <Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("Modules.Interfaces")> <Assembly: AssemblyProduct("Modules.Interfaces")>
<Assembly: AssemblyCopyright("Copyright © 2023")> <Assembly: AssemblyCopyright("Copyright © 2024")>
<Assembly: AssemblyTrademark("1.12.0.0")> <Assembly: AssemblyTrademark("1.12.1.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.12.0.0")> <Assembly: AssemblyVersion("1.12.1.0")>
<Assembly: AssemblyFileVersion("1.12.0.0")> <Assembly: AssemblyFileVersion("1.12.1.0")>