TCPIP_HTTP_UserAuthenticate Function

C

uint8_t TCPIP_HTTP_UserAuthenticate(
    HTTP_CONN_HANDLE connHandle, 
    uint8_t* cUser, 
    uint8_t* cPass
);

Description

This function is implemented by the application developer. Its function is to determine if the user name and password supplied by the client are acceptable for this resource. This callback function can thus be used 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 - 0x79 indicate that authorization failed. While most applications will only use a single value to gran access, flexibility is provided to store multiple values in order to indicate which user (or user's group) logged in. The value returned by this function is stored in the corresponding connection data and will be available with TCPIP_HTTP_CurrentConnectionIsAuthorizedGet in any of the TCPIP_HTTP_GetExecute, TCPIP_HTTP_PostExecute, or TCPIP_HTTP_Print_varname callbacks.

Preconditions

None.

Parameters

ParametersDescription
connHandleHTTP connection handle.
cUserThe user name supplied by the client.
cPassThe password supplied by the client.

Returns

  • <= 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.