testInvokeAuthorizer method
Tests a custom authorization behavior by invoking a specified custom authorizer. Use this to test and debug the custom authorization behavior of devices that connect to the IoT device gateway.
Requires permission to access the TestInvokeAuthorizer action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw InvalidResponseException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
Parameter authorizerName :
The custom authorizer name.
Parameter httpContext :
Specifies a test HTTP authorization request.
Parameter mqttContext :
Specifies a test MQTT authorization request.
Parameter tlsContext :
Specifies a test TLS authorization request.
Parameter token :
The token returned by your custom authentication service.
Parameter tokenSignature :
The signature made with the token and your custom authentication service's
private key. This value must be Base-64-encoded.
Implementation
Future<TestInvokeAuthorizerResponse> testInvokeAuthorizer({
required String authorizerName,
HttpContext? httpContext,
MqttContext? mqttContext,
TlsContext? tlsContext,
String? token,
String? tokenSignature,
}) async {
final $payload = <String, dynamic>{
if (httpContext != null) 'httpContext': httpContext,
if (mqttContext != null) 'mqttContext': mqttContext,
if (tlsContext != null) 'tlsContext': tlsContext,
if (token != null) 'token': token,
if (tokenSignature != null) 'tokenSignature': tokenSignature,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/authorizer/${Uri.encodeComponent(authorizerName)}/test',
exceptionFnMap: _exceptionFns,
);
return TestInvokeAuthorizerResponse.fromJson(response);
}