Skip to content

Instantly share code, notes, and snippets.

@chadwhitacre
Created November 26, 2012 21:30
Show Gist options
  • Save chadwhitacre/4150750 to your computer and use it in GitHub Desktop.
Save chadwhitacre/4150750 to your computer and use it in GitHub Desktop.
# === configure-aspen.py ===
website.security.timeout = 86400
website.security.httpbasic.enabled = True
website.security.httpdigest.enabled = True
website.security.cookieauth.enabled = True
website.security.cookieauth.timeout = 86400 * 7
# === login / logout ===
if credentials_valid:
website.security.grant_session(username)
if logout_button_pressed:
website.security.logout(username)
# === authorization option: declarative ===
roles_allowed = ('admin', 'user')
^L
^L
# === authorization option: user object ===
^L
if user.ANON:
raise Response(404)
^L
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment