2019-05-18 18:35:27 +00:00
|
|
|
#ifndef AuthenticationService_H_
|
|
|
|
#define AuthenticationService_H_
|
|
|
|
|
2019-11-30 09:58:28 +00:00
|
|
|
#include <AsyncJson.h>
|
2019-12-03 23:16:06 +00:00
|
|
|
#include <AsyncJsonWebHandler.h>
|
|
|
|
#include <ESPAsyncWebServer.h>
|
|
|
|
#include <SecurityManager.h>
|
2019-05-18 18:35:27 +00:00
|
|
|
|
|
|
|
#define VERIFY_AUTHORIZATION_PATH "/rest/verifyAuthorization"
|
|
|
|
#define SIGN_IN_PATH "/rest/signIn"
|
|
|
|
|
|
|
|
#define MAX_AUTHENTICATION_SIZE 256
|
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
class AuthenticationService {
|
|
|
|
public:
|
|
|
|
AuthenticationService(AsyncWebServer* server, SecurityManager* securityManager);
|
|
|
|
~AuthenticationService();
|
2019-05-18 18:35:27 +00:00
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
private:
|
|
|
|
SecurityManager* _securityManager;
|
|
|
|
AsyncJsonWebHandler _signInHandler;
|
2019-05-18 18:35:27 +00:00
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
// endpoint functions
|
|
|
|
void signIn(AsyncWebServerRequest* request, JsonDocument& jsonDocument);
|
|
|
|
void verifyAuthorization(AsyncWebServerRequest* request);
|
2019-05-18 18:35:27 +00:00
|
|
|
};
|
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
#endif // end SecurityManager_h
|