Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
833 B

  1. #ifndef AuthenticationService_H_
  2. #define AuthenticationService_H_
  3. #include <SecurityManager.h>
  4. #include <ESPAsyncWebServer.h>
  5. #include <AsyncJsonWebHandler.h>
  6. #include <AsyncArduinoJson6.h>
  7. #define VERIFY_AUTHORIZATION_PATH "/rest/verifyAuthorization"
  8. #define SIGN_IN_PATH "/rest/signIn"
  9. #define MAX_AUTHENTICATION_SIZE 256
  10. class AuthenticationService {
  11. public:
  12. AuthenticationService(AsyncWebServer* server, SecurityManager* securityManager) ;
  13. ~AuthenticationService();
  14. private:
  15. // server instance
  16. AsyncWebServer* _server;
  17. SecurityManager* _securityManager;
  18. AsyncJsonWebHandler _signInHandler;
  19. // endpoint functions
  20. void signIn(AsyncWebServerRequest *request, JsonDocument &jsonDocument);
  21. void verifyAuthorization(AsyncWebServerRequest *request);
  22. };
  23. #endif // end SecurityManager_h