SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::HTTPDigestAuthenticator Class Reference

HTTP Digest Authenticator class. More...

#include <sensesp/net/http_authenticator.h>

Inheritance diagram for sensesp::HTTPDigestAuthenticator:
[legend]

Public Member Functions

 HTTPDigestAuthenticator (String username, String password, String realm, unsigned long nonce_max_age=900000)
 
virtual bool authenticate_request (httpd_req_t *req) override
 Authenticate an incoming request.
 
int authenticate_digest (httpd_req_t *req)
 
- Public Member Functions inherited from sensesp::HTTPAuthenticator
 HTTPAuthenticator ()
 

Protected Member Functions

esp_err_t request_authentication (httpd_req_t *req, bool stale=false)
 
String create_nonce ()
 
int find_nonce (String nonce, int count)
 Find a nonce in the list of nonces.
 
String extract_param (String param, String auth_str, bool quoted=true)
 

Protected Attributes

String username_
 
String password_
 
String realm_
 
unsigned long nonce_max_age_
 
String secret_
 
std::list< NonceDatanonces_
 

Detailed Description

HTTP Digest Authenticator class.

Definition at line 45 of file http_authenticator.h.

Constructor & Destructor Documentation

◆ HTTPDigestAuthenticator()

sensesp::HTTPDigestAuthenticator::HTTPDigestAuthenticator ( String username,
String password,
String realm,
unsigned long nonce_max_age = 900000 )
inline

Definition at line 47 of file http_authenticator.h.

Here is the call graph for this function:

Member Function Documentation

◆ authenticate_digest()

int sensesp::HTTPDigestAuthenticator::authenticate_digest ( httpd_req_t * req)

Definition at line 28 of file http_authenticator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ authenticate_request()

bool sensesp::HTTPDigestAuthenticator::authenticate_request ( httpd_req_t * req)
overridevirtual

Authenticate an incoming request.

This method should be called at the beginning of each request handler to ensure that the request is authenticated.

Parameters
req
Returns
true Authentication successful.
false Authentication failed.

Implements sensesp::HTTPAuthenticator.

Definition at line 14 of file http_authenticator.cpp.

Here is the call graph for this function:

◆ create_nonce()

String sensesp::HTTPDigestAuthenticator::create_nonce ( )
protected

Definition at line 144 of file http_authenticator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_param()

String sensesp::HTTPDigestAuthenticator::extract_param ( String param,
String auth_str,
bool quoted = true )
protected

Definition at line 204 of file http_authenticator.cpp.

Here is the caller graph for this function:

◆ find_nonce()

int sensesp::HTTPDigestAuthenticator::find_nonce ( String nonce,
int count )
protected

Find a nonce in the list of nonces.

Parameters
nonceNonce to find
countCount of the nonce
max_ageMaximum age of the nonce in milliseconds
Returns
1 Nonce found
0 Nonce not found
-1 Nonce found but stale

Definition at line 166 of file http_authenticator.cpp.

Here is the caller graph for this function:

◆ request_authentication()

esp_err_t sensesp::HTTPDigestAuthenticator::request_authentication ( httpd_req_t * req,
bool stale = false )
protected

Definition at line 122 of file http_authenticator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ nonce_max_age_

unsigned long sensesp::HTTPDigestAuthenticator::nonce_max_age_
protected

Definition at line 67 of file http_authenticator.h.

◆ nonces_

std::list<NonceData> sensesp::HTTPDigestAuthenticator::nonces_
protected

Definition at line 70 of file http_authenticator.h.

◆ password_

String sensesp::HTTPDigestAuthenticator::password_
protected

Definition at line 65 of file http_authenticator.h.

◆ realm_

String sensesp::HTTPDigestAuthenticator::realm_
protected

Definition at line 66 of file http_authenticator.h.

◆ secret_

String sensesp::HTTPDigestAuthenticator::secret_
protected

Secret used to generate the nonce. Gets reset every restart.

Definition at line 68 of file http_authenticator.h.

◆ username_

String sensesp::HTTPDigestAuthenticator::username_
protected

Definition at line 64 of file http_authenticator.h.


The documentation for this class was generated from the following files: