restRespBasicAuthSet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

ALL

Firmware version:

2.10.00


This function will enable the use of basic authentication for a response, when returning status 401 (Unauthorized).

This is done by setting the WWW-Authenticate header in the response to use basic authentication.

This must be done to inform the client that it must provide username and password which can then be read with restReqBasicAuthGet.

 

Input:

resp : SYSHANDLE

A handle to the response.

 

realm : STRING

A string describing which login is needed, allowing for different usernames/passwords for different pages. If not specified, a default value will be used.

 

enable : BOOL (Default TRUE)

Set to false to disable basic authentication.

 

 

Returns: INT

1


- Success

0


- Not supported

-1


- Invalid request

-3


- Failed to set authentication

-5


- Response is read only.

 

Declaration:

FUNCTION restRespBasicAuthSet: INT;
VAR_INPUT
  resp           : SYSHANDLE;
  realm          : STRING;
  enable         : BOOL := TRUE;
END_VAR;

 

 

Example:

Please see the "Examples - REST Basic Authentication Example"