class_docstr: Abstract base class for implementing authorization hooks.
  
  Subclasses must supply one of: ``get_user`` or ``get_user_async``.
  
  Subclasses must also supply one of ``login_url`` or ``get_login_url``.
  
  Optionally, if ``login_url`` provides a relative URL, then ``login_handler``
  may also be supplied.
  
  The properties ``logout_url`` and ``get_logout_handler`` are analogous to
  the corresponding login properties, and are optional.
class_docstr_tok: ["Abstract","base","class","for","implementing","authorization","hooks",".","Subclasses","must","supply","one","of",":","``","get_user","``","or","``","get_user_async","``",".","Subclasses","must","also","supply","one","of","``","login_url","``","or","``","get_login_url","``",".","Optionally",",","if","``","login_url","``","provides","a","relative","URL",",","then","``","login_handler","``","may","also","be","supplied",".","The","properties","``","logout_url","``","and","``","get_logout_handler","``","are","analogous","to","the","corresponding","login","properties",",","and","are","optional","."]
code: def _validate(self) -> None:
      if self.get_user and self.get_user_async:
          raise ValueError(
              "Only one of get_user or get_user_async should be supplied"
          )
  
      if (self.get_user or self.get_user_async) and not (
          self.login_url or self.get_login_url
      ):
          raise ValueError(
              "When user authentication is enabled, one of login_url or get_login_url must be supplied"
          )
  
      if self.login_url and self.get_login_url:
          raise ValueError(
              "At most one of login_url or get_login_url should be supplied"
          )
      if self.login_handler and self.get_login_url:
          raise ValueError(
              "LoginHandler cannot be used with a get_login_url() function"
          )
      if self.login_handler and not issubclass(
          self.login_handler, RequestHandler
      ):
          raise ValueError(
              "LoginHandler must be a Tornado RequestHandler"
          )
      if self.login_url and not probably_relative_url(self.login_url):
          raise ValueError(
              "LoginHandler can only be used with a relative login_url"
          )
  
      if self.logout_handler and not issubclass(
          self.logout_handler, RequestHandler
      ):
          raise ValueError(
              "LogoutHandler must be a Tornado RequestHandler"
          )
      if self.logout_url and not probably_relative_url(self.logout_url):
          raise ValueError(
              "LogoutHandler can only be used with a relative logout_url"
          )
  
imports: from __future__ import annotations
  import logging
  import importlib.util
  from os.path import isfile
  from types import ModuleType
  from typing import TYPE_CHECKING, Awaitable, Callable, NewType
  from tornado.httputil import HTTPServerRequest
  from tornado.web import RequestHandler
  from ..util.serialization import make_globally_unique_id
label_desc: Use image node_id 10 for calling the AuthProvider obj's underlying member method code with example usage: obj._validate() without return types