Authentication in C001

This commit is contained in:
mvdbro
2017-08-09 21:49:19 +02:00
parent 20250451d2
commit bf6da2fa21
2 changed files with 8 additions and 5 deletions

View File

@@ -170,6 +170,7 @@
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <base64.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#if FEATURE_MQTT

View File

@@ -33,11 +33,13 @@ boolean CPlugin_001(byte function, struct EventStruct *event, String& string)
String authHeader = "";
if ((SecuritySettings.ControllerUser[0] != 0) && (SecuritySettings.ControllerPassword[0] != 0))
{
// todo base64 encoder;
// String auth = SecuritySettings.ControllerUser;
// auth += ":";
// auth += SecuritySettings.ControllerPassword;
// authHeader = "Authorization: Basic " + encoder.encode(auth) + " \r\n";
base64 encoder;
String auth = SecuritySettings.ControllerUser;
auth += ":";
auth += SecuritySettings.ControllerPassword;
authHeader = F("Authorization: Basic ");
authHeader += encoder.encode(auth);
authHeader += F(" \r\n");
}
char log[80];