Created
January 12, 2013 06:15
-
-
Save techniq/4516395 to your computer and use it in GitHub Desktop.
Configure Flask-Security
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
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