HTTPCheckAuth Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
HTTPCheckAuth Function
C
BYTE HTTPCheckAuth(
    BYTE* cUser, 
    BYTE* cPass
);
Description

This function is implemented by the application developer in CustomHTTPApp.c. Its function is to determine if the user name and password supplied by the client are acceptable for this resource. 

The value of curHTTP.isAuthorized will be set to the previous return value of HTTPRequiresAuthorization. This callback function can check this value to determine if only specific user names or passwords will be accepted for this resource. 

Return values 0x80 - 0xff indicate that the credentials were accepted, while values from 0x00 to 0x79 indicate that authorization failed. While most applications will only use a single value to grant access, flexibility is provided to store multiple values in order to indicate which user (or user's group) logged in. 

The return value of this function is saved as curHTTP.isAuthorized, and will be available to future callbacks, including any of the HTTPExecuteGet, HTTPExecutePost, or HTTPPrint_varname callbacks.

Preconditions

None

Parameters
Parameters 
Description 
cUser 
the user name supplied by the client 
cPass 
the password supplied by the client 
Return Values
Return Values 
Description 
<= 0x79 
the credentials were rejected 
>= 0x80 
access is granted for this connection 
Remarks

This function is only called when an Authorization header is encountered. 

This function may NOT write to the TCP buffer. 

 

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.