Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Commit

Permalink
Replacing Flask-Security with Flask-Security-Fork. Removing some expl…
Browse files Browse the repository at this point in the history
…icit dependencies to rely on flask-security-fork dependencies. SSO will use flask-security login_user instead of flask-login so that security_trackable works. Replacing current_user.is_authenticated() method with property so we can use a newer version of flask-login. (#482)
  • Loading branch information
Patrick Kelley committed Dec 30, 2016
1 parent da8c81e commit 3b4da13
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions security_monkey/auth/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def _check_permission(self, roles, method, resource):

def _deny_hook(self, resource=None):
app = self.get_app()
if current_user.is_authenticated():
if current_user.is_authenticated:
status = 403
else:
status = 401
Expand All @@ -250,7 +250,7 @@ def _deny_hook(self, resource=None):
url = "https://{}:{}{}".format(app.config.get('FQDN'), app.config.get('NGINX_PORT'), '/login')
else:
url = "http://{}:{}{}".format(app.config.get('FQDN'), app.config.get('API_PORT'), '/login')
if current_user.is_authenticated():
if current_user.is_authenticated:
auth_dict = {
"authenticated": True,
"user": current_user.email,
Expand Down
4 changes: 2 additions & 2 deletions security_monkey/sso/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from flask.ext.restful import reqparse, Resource, Api
from flask.ext.principal import Identity, identity_changed
from flask_login import login_user
from flask_security.utils import login_user

try:
from onelogin.saml2.auth import OneLogin_Saml2_Auth
Expand Down Expand Up @@ -264,7 +264,7 @@ def _consumer(self, auth):
auth.process_response()
errors = auth.get_errors()
if not errors:
if auth.is_authenticated():
if auth.is_authenticated:
return True
else:
return False
Expand Down
2 changes: 1 addition & 1 deletion security_monkey/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def __init__(self):
self.reqparse = reqparse.RequestParser()
super(AuthenticatedService, self).__init__()
self.auth_dict = dict()
if current_user.is_authenticated():
if current_user.is_authenticated:
roles_marshal = []
for role in current_user.roles:
roles_marshal.append(marshal(role.__dict__, ROLE_FIELDS))
Expand Down
2 changes: 1 addition & 1 deletion security_monkey/views/logout.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Logout(Resource):
decorators = [rbac.exempt]

def get(self):
if not current_user.is_authenticated():
if not current_user.is_authenticated:
return "Must be logged in to log out", 200

logout_user()
Expand Down
11 changes: 5 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,24 @@
install_requires=[
'APScheduler==2.1.2',
'Flask==0.10.1',
'Flask-Login==0.2.10',
'Flask-Mail==0.9.0',
'Flask-Migrate==1.3.1',
'Flask-Principal==0.4.0',
'Flask-RESTful==0.3.3',
'Flask-SQLAlchemy==1.0',
'Flask-Script==0.6.3',
'Flask-Security==1.7.4',
'Flask-WTF==0.9.5',
# 'Flask-Security==1.7.4',
'Flask-Security-Fork==1.8.2',
'Jinja2==2.8',
'SQLAlchemy==0.9.2',
'boto>=2.41.0',
'ipaddr==2.1.11',
'itsdangerous==0.23',
'psycopg2==2.5.2',
'bcrypt==2.0.0',
'psycopg2==2.6.2',
'bcrypt==3.1.2',
'Sphinx==1.2.2',
'gunicorn==18.0',
'cryptography==1.3.2',
'cryptography==1.7.1',
'boto3>=1.4.2',
'botocore>=1.4.81',
'dpath==1.3.2',
Expand Down

0 comments on commit 3b4da13

Please sign in to comment.