code: def create_authorizer(self, restapi, uri, authorizer):
          
          authorizer_type = authorizer.get("type", "TOKEN").upper()
          identity_validation_expression = authorizer.get('validation_expression', None)
  
          authorizer_resource = troposphere.apigateway.Authorizer("Authorizer")
          authorizer_resource.RestApiId = troposphere.Ref(restapi)
          authorizer_resource.Name = authorizer.get("name", "ZappaAuthorizer")
          authorizer_resource.Type = authorizer_type
          authorizer_resource.AuthorizerUri = uri
          authorizer_resource.IdentitySource = "method.request.header.%s" % authorizer.get('token_header', 'Authorization')
          if identity_validation_expression:
              authorizer_resource.IdentityValidationExpression = identity_validation_expression
  
          if authorizer_type == 'TOKEN':
              if not self.credentials_arn:
                  self.get_credentials_arn()
              authorizer_resource.AuthorizerResultTtlInSeconds = authorizer.get('result_ttl', 300)
              authorizer_resource.AuthorizerCredentials = self.credentials_arn
          if authorizer_type == 'COGNITO_USER_POOLS':
              authorizer_resource.ProviderARNs = authorizer.get('provider_arns')
  
          self.cf_api_resources.append(authorizer_resource.title)
          self.cf_template.add_resource(authorizer_resource)
  
          return authorizer_resource
docs: Create Authorizer for API gateway