mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-13 15:37:03 +00:00
Switched to internal base64
This commit is contained in:
parent
8de5a58a6b
commit
00d5d215cd
@ -4,7 +4,7 @@ extra_configs = platformio-user.ini
|
||||
|
||||
[common]
|
||||
framework = arduino
|
||||
lib_deps = HanReader@1.0.1, ArduinoJson@6.14.1, MQTT@2.4.7, DallasTemperature@3.8.1, EspSoftwareSerial@6.7.1, 582@1.0.0, RemoteDebug@3.0.5, Time@1.6
|
||||
lib_deps = HanReader@1.0.1, ArduinoJson@6.14.1, MQTT@2.4.7, DallasTemperature@3.8.1, EspSoftwareSerial@6.7.1, RemoteDebug@3.0.5, Time@1.6
|
||||
|
||||
[env:hw1esp12e]
|
||||
platform = espressif8266@2.5.1
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include "root/delete_html.h"
|
||||
#include "root/reset_html.h"
|
||||
|
||||
#include "Base64.h"
|
||||
#include "base64.h"
|
||||
|
||||
AmsWebServer::AmsWebServer(RemoteDebug* Debug, HwTools* hw) {
|
||||
this->debugger = Debug;
|
||||
@ -97,15 +97,9 @@ bool AmsWebServer::checkSecurity(byte level) {
|
||||
|
||||
String providedPwd = server.header("Authorization");
|
||||
providedPwd.replace("Basic ", "");
|
||||
char inputString[providedPwd.length()];
|
||||
providedPwd.toCharArray(inputString, providedPwd.length()+1);
|
||||
|
||||
int inputStringLength = sizeof(inputString);
|
||||
int decodedLength = Base64.decodedLength(inputString, inputStringLength);
|
||||
char decodedString[decodedLength];
|
||||
Base64.decode(decodedString, inputString, inputStringLength);
|
||||
printD("Received auth: %s", decodedString);
|
||||
access = String(decodedString).equals(expectedAuth);
|
||||
String expectedBase64 = base64::encode(expectedAuth, expectedAuth.length());
|
||||
access = providedPwd.equals(expectedBase64);
|
||||
}
|
||||
|
||||
if(!access) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user