2019-05-18 18:35:27 +00:00
|
|
|
#ifndef AuthenticationService_H_
|
|
|
|
#define AuthenticationService_H_
|
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#include <Features.h>
|
2019-11-30 09:58:28 +00:00
|
|
|
#include <AsyncJson.h>
|
2019-12-03 23:16:06 +00:00
|
|
|
#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
|
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#if FT_ENABLED(FT_SECURITY)
|
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
class AuthenticationService {
|
|
|
|
public:
|
|
|
|
AuthenticationService(AsyncWebServer* server, SecurityManager* securityManager);
|
2019-05-18 18:35:27 +00:00
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
private:
|
|
|
|
SecurityManager* _securityManager;
|
2020-05-14 22:23:45 +00:00
|
|
|
AsyncCallbackJsonWebHandler _signInHandler;
|
2019-05-18 18:35:27 +00:00
|
|
|
|
2019-12-03 23:16:06 +00:00
|
|
|
// endpoint functions
|
2020-05-14 22:23:45 +00:00
|
|
|
void signIn(AsyncWebServerRequest* request, JsonVariant& json);
|
2019-12-03 23:16:06 +00:00
|
|
|
void verifyAuthorization(AsyncWebServerRequest* request);
|
2019-05-18 18:35:27 +00:00
|
|
|
};
|
|
|
|
|
2020-06-09 20:57:44 +00:00
|
|
|
#endif // end FT_ENABLED(FT_SECURITY)
|
|
|
|
#endif // end SecurityManager_h
|