NextGen Knowledge Center

JavaScript HTTP Authentication

Allows you to authenticate users with a custom JavaScript script. With this script you have access to source map variables, and can choose whether to send a challenged or failure response back to the client.

The default script simply allows all requests to pass.

  • The Script field will show <Default Script Set> if the default script is currently being used.
  • If you have made any modification to the script, the Script field will show <Custom Script Set>.

Select the Script field to edit the JavaScript:

This script expects either a boolean ( true to accept the request, false to send back a failure response) or an AuthenticationResult object to be returned (for additional information, see User API) . There are three types of results you can return:

  • AuthenticationResult.Success(): The request will be accepted and processed through the channel.
  • AuthenticationResult.Challenged(authenticateHeader): The request will not be processed through the channel. A 401 response will be sent back to the client, with a given WWW-Authenticate header value.
  • AuthenticationResult.Failure(): The request will not be processed through the channel. A 401 response will be sent back to the client, without any WWW-Authenticate header or any additional information.

If a Challenged/Failure result is returned, the AuthenticationResult object also allows you to add custom headers to include on the HTTP response sent back to the client.

For more information on using JavaScript within Mirth® Connect by NextGen Healthcare, see Mirth Connect and JavaScript.