Skip to content

Commit 09a982e

Browse files
committed
Add documentatin for callback handler
1 parent df0c189 commit 09a982e

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

libraries/WebServer/src/WebServer.h

+22-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,28 @@ class WebServer
8585
const String AuthTypeDigest = F("Digest");
8686
const String AuthTypeBasic = F("Basic");
8787

88-
typedef std::function<String * (HTTPAuthMethod mode, String enteredUsername, String extraParams[])> THandlerFunctionAuthCheck;
88+
/* Callbackhandler for authentication. The extra parameters depend on the
89+
* HTTPAuthMethod mode:
90+
*
91+
* BASIC_AUTH enteredUsernameOrReq contains the username entered by the user
92+
* param[0] password entered (in the clear)
93+
* param[1] authentication realm.
94+
*
95+
* To return - the password the user entered password is compared to. Or Null on fail.
96+
*
97+
* DIGEST_AUTH enteredUsernameOrReq contains the username entered by the user
98+
* param[0] autenticaiton realm
99+
* param[1] authentication URI
100+
*
101+
* To return - the password of which the digest will be based on for comparison. Or NULL
102+
* to fail.
103+
*
104+
* OTHER_AUTH enteredUsernameOrReq rest of the auth line.
105+
* params empty array
106+
*
107+
* To return - NULL to fail; or any string.
108+
*/
109+
typedef std::function<String * (HTTPAuthMethod mode, String enteredUsernameOrReq, String extraParams[])> THandlerFunctionAuthCheck;
89110

90111
bool authenticate(THandlerFunctionAuthCheck fn);
91112
bool authenticate(const char * username, const char * password);

0 commit comments

Comments
 (0)