This commit is contained in:
2024-11-05 08:28:42 +01:00
parent 4ecf802db3
commit 8ab7ab8c38
24 changed files with 1240 additions and 1992 deletions

View File

@@ -3,12 +3,8 @@ Imports System.Net.Http
Imports System.Security.Principal
Imports System.Threading
Imports System.Web.Http.Controllers
Imports System.Web.Http.Description
Imports System.Web.Http.Filters
Imports Microsoft.AspNetCore.Authorization
Imports Swashbuckle.Swagger
Imports VERAG_PROG_ALLGEMEIN
Imports VERAG_PROG_ALLGEMEIN.TESTJSON
@@ -25,6 +21,7 @@ Public Class BasicAuthenticationAttribute
Dim usernamePasswordArray = decodedAuthenticationToken.Split(":"c)
Dim userName = usernamePasswordArray(0)
Dim password = usernamePasswordArray(1)
'Dim hashedPW = BCrypt.Net.BCrypt.HashPassword(password)
@@ -51,9 +48,9 @@ Public Class BasicAuthenticationAttribute
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim authenticated As Boolean = False
Dim Response = SQL.DLookup("username", "tblAuthentication", "username='" & user & "' and password='" & password & "'", "FMZOLL", "")
If Response <> "" Then
authenticated = True
Dim hashedPassword = SQL.DLookup("hashedPassword", "tblRESTAuthentication", "username='" & user & "' AND type = 'REST'", "ADMIN", "")
If hashedPassword <> "" Then
authenticated = BCrypt.Net.BCrypt.Verify(password, hashedPassword)
End If
Return authenticated