API
Config
An object representing the HUMAN configuration that will be provided to the enforcer. A new instance of this class must be constructed and provided to the Enforcer.
constructor
Creates a new instance of the Config class from an HSConfig object. The Config constructor validates the provided HSConfig object. It is unnecessary to validate this configuration object for every Lambda invocation, so recommended usage is to initialize the Config instance outside of the Lambda request handler and provide it to the Enforcer within the handler.
- Parameters
- config: HSConfig
- Returns a new instance of
Config
For more information on possible enforcer configurations, see the configuration documentation.
Enforcer
The entity responsible for performing HUMAN enforcement.
constructor
Creates a new instance of the Enforcer class.
- Parameters
- config: Config
- 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 APIGatewayAuthorizerWithContextResult<{pxResponseBody?: string;}> in the case of a block response.
- Parameters
- Returns a Promise resolving to null or an APIGatewayAuthorizerWithContextResult
postEnforce
Performs any post-enforcement processing actions required.
- Parameters
- event: APIGatewayRequestAuthorizerEvent
- response: APIGatewayAuthorizerWithContextResult
- Returns a Promise that resolves to void