Extras

Flask Extras

Utilities you can use when using this library with the Flask framework.

Thanks to Mark Steve Samson.

class authomatic.extras.flask.FlaskAuthomatic(config, secret, session_max_age=600, secure_cookie=False, session=None, session_save_method=None, report_errors=True, debug=False, logging_level=20, prefix='authomatic', logger=None)[source]

Flask Plugin for authomatic support.

Encapsulates all the functionality of this package.

Parameters:
  • config (dict) – Config
  • secret (str) – A secret string that will be used as the key for signing Session cookie and as a salt by CSRF token generation.
  • session_max_age – Maximum allowed age of Session cookie nonce in seconds.
  • secure_cookie (bool) – If True the Session cookie will be saved wit Secure attribute.
  • session – Custom dictionary-like session implementation.
  • session_save_method (callable) – A method of the supplied session or any mechanism that saves the session data and cookie.
  • report_errors (bool) – If True exceptions encountered during the login procedure will be caught and reported in the LoginResult.error attribute. Default is True.
  • debug (bool) – If True traceback of exceptions will be written to response. Default is False.
  • logging_level (int) – The logging level threshold for the default logger as specified in the standard Python logging library. This setting is ignored when logger is set. Default is logging.INFO.
  • prefix (str) – Prefix used as the Session cookie name.
  • logger – A logging.logger instance.
login(*login_args, **login_kwargs)[source]

Decorator for Flask view functions.

Interfaces

If you want to implement framework specific extras, use these abstract classes as bases:

class authomatic.extras.interfaces.BaseSession[source]

Abstract class for custom session implementations.

save()[source]

Called only once per request.

Should implement a mechanism for setting the the session cookie and saving the session data to storage.

get(key)[source]

Same as dict.get().

class authomatic.extras.interfaces.BaseConfig[source]

Abstract class for Config implementations.

get(key)[source]

Same as dict.get.

values()[source]

Same as dict.values().

Google Appengine 1st generation

The module authomatic.extras.gae is outdated and supports only first generation Google Appengine. It can be used for backward compatibility. For internals please look at the source code. Auto documentation is not supported.

Fork me on GitHub