API
createDefaultHttpTrigger
Uses the provided configuration and secret key to produce the default HTTP trigger Azure Function required for a Front Door + Function App integration.
- Parameters
- params: ConfigurationParams
 - secretKey: string
 
 - Returns an AzureFunction
 
The secretKey is the value that should be present on the x-enforcer-auth header, which indicates to the Front Door service that the enforcer has already processed the request. See installing the Front Door for more information.
In the event that the request should be passed to the origin, the default HTTP trigger proxies the request to the value present in the x-forwarded-host request header, which is the domain associated with the Front Door service.
Sample Usage:
Enforcer
The entity responsible for performing HUMAN enforcement.
Sample Usage:
constructor
Creates a new instance of the Enforcer class from a ConfigurationParams object.
- Parameters
- params: ConfigurationParams
 
 - Returns a new instance of the Enforcer class
 
enforce
Executes the enforcement functionality, returning either null when the request should be passed to the origin, or an HttpResponse in the case of blocked or first-party requests.
- Parameters
- context: Context
 - request: HttpRequest
 
 - Returns a Promise resolving to null or an HttpResponse
 
proxyRequestToOrigin
Sends the provided HttpRequest to the given origin and returns the response. The function automatically switches the Host header for the provided originHost value, and adds the other provided headers onto the request.
- Parameters
- request: HttpRequest
 - originHost: string
 - headers?: Record<string, string>
 
 - Returns a Promise resolving to an HttpResponse
 
In the default HTTP trigger, the originHost is taken from the x-forwarded-host header since the request is sent back to the Front Door domain. The x-enforcer-auth header, signifying that the enforcer has validated the request, is added here as well.
postEnforce
Performs any post-enforcement processing actions and final modifications to (i.e., setting cookies or headers on) the response if needed.
- Parameters
- context: Context
 - response: HttpResponse
 
 - Returns a Promise that resolves to void
 
Azure API
See the following links for more specific information about the Azure JavaScript Functions API.