~inc:header.inc~

Authentication

Many applications need to restrict access to authorized users. The HTTP server supports Basic HTTP Authentication to provide this functionality.

Two functions are involved with authentication, both of which store a return value in curHTTP.isAuthorized. The MSB of this value indicates whether or not access is allowed. The first callback, HTTPNeedsAuth, determines if the requested page requires valid credentials to proceed. Return a value of 0x80 or greater to allow access unconditionally. Return 0x79 or lower to require authorization.

The second, HTTPVerifyAuth determines if the supplied credentials are acceptable for the requested page. Your application should return a value greater than 0x80 to permit access, or a value less than 0x79 to reject the password supplied.

As an example, access this restricted page:

User Name: admin       Password: microchip
Access Restricted Page
~inc:footer.inc~