:doc:`IoT <../../iot>` / Client / test_invoke_authorizer

**********************
test_invoke_authorizer
**********************



.. py:method:: IoT.Client.test_invoke_authorizer(**kwargs)

  

  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 <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/TestInvokeAuthorizer>`_  


  **Request Syntax**
  ::

    response = client.test_invoke_authorizer(
        authorizerName='string',
        token='string',
        tokenSignature='string',
        httpContext={
            'headers': {
                'string': 'string'
            },
            'queryString': 'string'
        },
        mqttContext={
            'username': 'string',
            'password': b'bytes',
            'clientId': 'string'
        },
        tlsContext={
            'serverName': 'string'
        }
    )
    
  :type authorizerName: string
  :param authorizerName: **[REQUIRED]** 

    The custom authorizer name.

    

  
  :type token: string
  :param token: 

    The token returned by your custom authentication service.

    

  
  :type tokenSignature: string
  :param tokenSignature: 

    The signature made with the token and your custom authentication service's private key. This value must be Base-64-encoded.

    

  
  :type httpContext: dict
  :param httpContext: 

    Specifies a test HTTP authorization request.

    

  
    - **headers** *(dict) --* 

      The header keys and values in an HTTP authorization request.

      

    
      - *(string) --* 

      
        - *(string) --* 

        
  

    - **queryString** *(string) --* 

      The query string keys and values in an HTTP authorization request.

      

    
  
  :type mqttContext: dict
  :param mqttContext: 

    Specifies a test MQTT authorization request.

    

  
    - **username** *(string) --* 

      The value of the ``username`` key in an MQTT authorization request.

      

    
    - **password** *(bytes) --* 

      The value of the ``password`` key in an MQTT authorization request.

      

    
    - **clientId** *(string) --* 

      The value of the ``clientId`` key in an MQTT authorization request.

      

    
  
  :type tlsContext: dict
  :param tlsContext: 

    Specifies a test TLS authorization request.

    

  
    - **serverName** *(string) --* 

      The value of the ``serverName`` key in a TLS authorization request.

      

    
  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'isAuthenticated': True|False,
          'principalId': 'string',
          'policyDocuments': [
              'string',
          ],
          'refreshAfterInSeconds': 123,
          'disconnectAfterInSeconds': 123
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **isAuthenticated** *(boolean) --* 

        True if the token is authenticated, otherwise false.

        
      

      - **principalId** *(string) --* 

        The principal ID.

        
      

      - **policyDocuments** *(list) --* 

        IAM policy documents.

        
        

        - *(string) --* 
    
      

      - **refreshAfterInSeconds** *(integer) --* 

        The number of seconds after which the temporary credentials are refreshed.

        
      

      - **disconnectAfterInSeconds** *(integer) --* 

        The number of seconds after which the connection is terminated.

        
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoT.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`IoT.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

  
  *   :py:class:`IoT.Client.exceptions.InvalidResponseException`

  