23 #ifndef _AUTHENTICATION_SERVICE_H
24 #define _AUTHENTICATION_SERVICE_H
34 #include "../../include/esp3d_config.h"
35 #if defined (AUTHENTICATION_FEATURE)
36 #if defined (HTTP_FEATURE)
37 #include <IPAddress.h>
46 #if defined (ARDUINO_ARCH_ESP32)
48 typedef WebServer Authwebserver;
49 #endif //ARDUINO_ARCH_ESP32
50 #if defined (ARDUINO_ARCH_ESP8266)
51 #include <ESP8266WebServer.h>
52 typedef ESP8266WebServer Authwebserver;
53 #endif //ARDUINO_ARCH_ESP8266
55 typedef void Authwebserver;
56 #endif // HTTP_FEATURE
57 #endif //AUTHENTICATION_FEATURE
64 #ifdef AUTHENTICATION_FEATURE
65 static bool begin(Authwebserver * webserver);
68 static bool isadmin (
const char *pwd);
70 static bool isuser (
const char *pwd);
71 #if defined (HTTP_FEATURE)
72 static uint32_t setSessionTimeout(uint32_t timeout);
73 static uint32_t getSessionTimeout();
74 static char * create_session_ID();
75 static bool ClearCurrentSession ();
76 static bool ClearAllSessions ();
80 static String _adminpwd;
81 static String _userpwd;
82 #if defined (HTTP_FEATURE)
83 static bool AddAuthIP (auth_ip * item);
84 static bool ClearAuthIP (IPAddress ip,
const char * sessionID);
85 static auth_ip * GetAuth (IPAddress ip,
const char * sessionID);
87 static Authwebserver * _webserver;
88 static uint32_t _sessionTimeout;
89 static auth_ip * _head;
90 static uint8_t _current_nb_ip;
92 #endif //AUTHENTICATION_FEATURE
95 #endif //_ESP3DSECURITY_H