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.
constructor(config: HSConfig) => Config
- Parameters
- config: HSConfig
- Returns a new instance of
Config
Note
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.
constructor(config: Config) => Enforcer
- 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.
enforce(event: APIGatewayRequestAuthorizerEvent) => Promise<null | APIGatewayAuthorizerWithContextResult<{pxResponseBody?: string;}>
- Parameters
- Returns a Promise resolving to null or an APIGatewayAuthorizerWithContextResult
postEnforce
Performs any post-enforcement processing actions required.
postEnforce(event: APIGatewayAuthorizerWithContextResult, response: APIGatewayAuthorizerWithContextResult) => Promise<void>
- Parameters
- event: APIGatewayRequestAuthorizerEvent
- response: APIGatewayAuthorizerWithContextResult
- Returns a Promise that resolves to void
Updated 12 days ago