Website Module¶
The website module uses Tornado, a fast and scalable python web server.
Main website¶
This is the external website users will see when interacting with IceProd. It has been broken down into several sub-handlers for easier maintenance.
- class iceprod.server.modules.website.website(*args, **kwargs)[source]¶
The main website module.
Run the website, which is required for anything to work.
- iceprod.server.modules.website.authenticated(method)[source]¶
Decorate methods with this to require that the user be logged in.
If the user is not logged in, they will be redirected to the configured login url <RequestHandler.get_login_url>.
If you configure a login url with a query parameter, Tornado will assume you know what you’re doing and use it as-is. If not, it will add a next parameter so the login page knows where to send you once you’re logged in.
- iceprod.server.modules.website.eval_expression(token, e)[source]¶
from rest_tools.server.decorators.token_attribute_role_mapping_auth
- class iceprod.server.modules.website.TokenStorageMixin[source]¶
Store/load current user’s OpenIDLoginHandler tokens in iceprod credentials API.
- store_tokens(access_token, access_token_exp, refresh_token=None, refresh_token_exp=None, user_info=None, user_info_exp=None)[source]¶
Store jwt tokens and user info from OpenID-compliant auth source.
- Parameters:
access_token (str) – jwt access token
access_token_exp (int) – access token expiration in seconds
refresh_token (str) – jwt refresh token
refresh_token_exp (int) – refresh token expiration in seconds
user_info (dict) – user info (from id token or user info lookup)
user_info_exp (int) – user info expiration in seconds
- class iceprod.server.modules.website.PublicHandler(*args, **kwargs)[source]¶
Default Handler
- initialize(cfg=None, modules=None, statsd=None, rest_api=None, cred_rest_client=None, system_rest_client=None, full_url=None, **kwargs)[source]¶
Get some params from the website module
- Parameters:
cfg – the global config
modules – modules handle
statsd – statsd client
rest_api – the rest api url
- get_template_namespace()[source]¶
Returns a dictionary to be used as the default template namespace.
May be overridden by subclasses to add or modify values.
The results of this method will be combined with additional defaults in the tornado.template module and keyword arguments to render or render_string.
- write_error(**kwargs: Any) Any ¶
Override to implement custom error pages.
write_error
may call write, render, set_header, etc to produce output as usual.If this error was caused by an uncaught exception (including HTTPError), an
exc_info
triple will be available askwargs["exc_info"]
. Note that this exception may not be the “current” exception for purposes of methods likesys.exc_info()
ortraceback.format_exc
.
- class iceprod.server.modules.website.Other(*args, **kwargs)[source]¶
Handle any other urls - this is basically all 404