bokeh.server.auth_provider¶
Provide a hook for supplying authorization mechanisms to a Bokeh server.
- class AuthModule(module_path: PathLike)[source]¶
An AuthProvider configured from a Python module.
The following properties return the corresponding values from the module if they exist, or None otherwise:
get_login_url,get_userget_user_asynclogin_urllogout_url
The
login_handlerproperty will return aLoginHandlerclass from the module, or None otherwise.The
logout_handlerproperty will return aLogoutHandlerclass from the module, or None otherwise.Public Data Attributes:
A function to get the current authenticated user.
An async function to get the current authenticated user.
A URL to redirect unauthenticated users to for login.
A function that computes a URL to redirect unathenticated users to for login.
A request handler class for a login page.
A URL to redirect authenticated users to for logout.
A request handler class for a logout page.
Inherited from : py: class:AuthProvider
endpointsURL patterns for login/logout endpoints.
A function that computes a URL to redirect unathenticated users to for login.
A function to get the current authenticated user.
An async function to get the current authenticated user.
A request handler class for a login page.
A URL to redirect unauthenticated users to for login.
A request handler class for a logout page.
A URL to redirect authenticated users to for logout.
Public Methods:
__init__(module_path)Inherited from : py: class:AuthProvider
__init__(module_path)
- property get_login_url¶
A function that computes a URL to redirect unathenticated users to for login.
This property may return None, if a
login_urlis supplied instead.If a function is returned, it should accept a
RequestHandlerand return a login URL for unathenticated users.
- property get_user¶
A function to get the current authenticated user.
This property may return None, if a
get_user_asyncfunction is supplied instead.If a function is returned, it should accept a
RequestHandlerand return the current authenticated user.
- property get_user_async¶
An async function to get the current authenticated user.
This property may return None, if a
get_userfunction is supplied instead.If a function is returned, it should accept a
RequestHandlerand return the current authenticated user.
- property login_handler¶
A request handler class for a login page.
This property may return None, if
login_urlis supplied instead.If a class is returned, it must be a subclass of RequestHandler, which will used for the endpoint specified by
logout_url
- property login_url¶
A URL to redirect unauthenticated users to for login.
This proprty may return None, if a
get_login_urlfunction is supplied instead.
- property logout_handler¶
A request handler class for a logout page.
This property may return None.
If a class is returned, it must be a subclass of RequestHandler, which will used for the endpoint specified by
logout_url
- property logout_url¶
A URL to redirect authenticated users to for logout.
This proprty may return None.
- class AuthProvider[source]¶
Abstract base class for implementing authorization hooks.
Subclasses must supply one of:
get_userorget_user_async.Subclasses must also supply one of
login_urlorget_login_url.Optionally, if
login_urlprovides a relative URL, thenlogin_handlermay also be supplied.The properties
logout_urlandget_logout_handlerare analogous to the corresponding login properties, and are optional.Public Data Attributes:
URL patterns for login/logout endpoints.
A function that computes a URL to redirect unathenticated users to for login.
A function to get the current authenticated user.
An async function to get the current authenticated user.
A request handler class for a login page.
A URL to redirect unauthenticated users to for login.
A request handler class for a logout page.
A URL to redirect authenticated users to for logout.
Public Methods:
__init__()
- property endpoints: List[Tuple[str, Type[tornado.web.RequestHandler]]]¶
URL patterns for login/logout endpoints.
- property get_login_url: Optional[Callable[[tornado.httputil.HTTPServerRequest], str]]¶
A function that computes a URL to redirect unathenticated users to for login.
This property may return None, if a
login_urlis supplied instead.If a function is returned, it should accept a
RequestHandlerand return a login URL for unathenticated users.
- property get_user: Optional[Callable[[tornado.httputil.HTTPServerRequest], bokeh.server.auth_provider.User]]¶
A function to get the current authenticated user.
This property may return None, if a
get_user_asyncfunction is supplied instead.If a function is returned, it should accept a
RequestHandlerand return the current authenticated user.
- property get_user_async: Optional[Callable[[tornado.httputil.HTTPServerRequest], Awaitable[bokeh.server.auth_provider.User]]]¶
An async function to get the current authenticated user.
This property may return None, if a
get_userfunction is supplied instead.If a function is returned, it should accept a
RequestHandlerand return the current authenticated user.
- property login_handler: Optional[Type[tornado.web.RequestHandler]]¶
A request handler class for a login page.
This property may return None, if
login_urlis supplied instead.If a class is returned, it must be a subclass of RequestHandler, which will used for the endpoint specified by
logout_url
- property login_url: str | None¶
A URL to redirect unauthenticated users to for login.
This proprty may return None, if a
get_login_urlfunction is supplied instead.
- property logout_handler: Optional[Type[tornado.web.RequestHandler]]¶
A request handler class for a logout page.
This property may return None.
If a class is returned, it must be a subclass of RequestHandler, which will used for the endpoint specified by
logout_url
- class NullAuth[source]¶
A default no-auth AuthProvider.
All of the properties of this provider return None.
Public Data Attributes:
A function to get the current authenticated user.
An async function to get the current authenticated user.
A URL to redirect unauthenticated users to for login.
A function that computes a URL to redirect unathenticated users to for login.
A request handler class for a login page.
A URL to redirect authenticated users to for logout.
A request handler class for a logout page.
Inherited from : py: class:AuthProvider
endpointsURL patterns for login/logout endpoints.
A function that computes a URL to redirect unathenticated users to for login.
A function to get the current authenticated user.
An async function to get the current authenticated user.
A request handler class for a login page.
A URL to redirect unauthenticated users to for login.
A request handler class for a logout page.
A URL to redirect authenticated users to for logout.
Public Methods:
Inherited from : py: class:AuthProvider
__init__()
- property get_login_url¶
A function that computes a URL to redirect unathenticated users to for login.
This property may return None, if a
login_urlis supplied instead.If a function is returned, it should accept a
RequestHandlerand return a login URL for unathenticated users.
- property get_user¶
A function to get the current authenticated user.
This property may return None, if a
get_user_asyncfunction is supplied instead.If a function is returned, it should accept a
RequestHandlerand return the current authenticated user.
- property get_user_async¶
An async function to get the current authenticated user.
This property may return None, if a
get_userfunction is supplied instead.If a function is returned, it should accept a
RequestHandlerand return the current authenticated user.
- property login_handler¶
A request handler class for a login page.
This property may return None, if
login_urlis supplied instead.If a class is returned, it must be a subclass of RequestHandler, which will used for the endpoint specified by
logout_url
- property login_url¶
A URL to redirect unauthenticated users to for login.
This proprty may return None, if a
get_login_urlfunction is supplied instead.
- property logout_handler¶
A request handler class for a logout page.
This property may return None.
If a class is returned, it must be a subclass of RequestHandler, which will used for the endpoint specified by
logout_url
- property logout_url¶
A URL to redirect authenticated users to for logout.
This proprty may return None.