Skip to content

Instantly share code, notes, and snippets.

@techniq
Created January 12, 2013 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techniq/4516395 to your computer and use it in GitHub Desktop.
Save techniq/4516395 to your computer and use it in GitHub Desktop.
Configure Flask-Security
...
def configure_security(app):
# Flask-Security / Flask-Social / Flask-Login / Flask-Principal
from flask_security import Security
from flask_security.datastore import SQLAlchemyUserDatastore
from flask_social import Social
from flask_social.datastore import SQLAlchemyConnectionDatastore
Security(app, SQLAlchemyUserDatastore(db, models.User, models.Role))
Social(app, SQLAlchemyConnectionDatastore(db, models.Connection))
# Set custom anonymous class
from application.auth.models import AnonymousUser
app.security.login_manager.anonymous_user = AnonymousUser
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment