Skip to content

Commit

Permalink
Merge pull request #119 from dojot/release/v0.5.2
Browse files Browse the repository at this point in the history
Merge version v0.5.2 from branch release/v0.5.2 to branch master
  • Loading branch information
Mariane Previde committed Feb 5, 2021
2 parents 8245b68 + 1a731ea commit e6a19d7
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 745 deletions.
876 changes: 202 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
auth
This software is copyright (c) 2020 by CPQD <www.cpqd.com.br>.

It is licensed under Apache License, Version 2.0.

It uses libraries, which are available under the following licenses:

* Apache License, Version 2.0
- requests (source code available at https://github.com/psf/requests)
- kafka-python (source code available at https://github.com/dpkp/kafka-python)
- flask-redis (source code available at https://github.com/underyx/flask-redis)
- dojot.module (source code available at https://github.com/dojot/dojot-module-python)

* MIT
- colorlog (source code available at https://github.com/borntyping/python-colorlog)
- redis (source code available at https://github.com/andymccurdy/redis-py)
- urllib3 (source code available at https://github.com/urllib3/urllib3)
- PyJWT (source code available at https://github.com/jpadilla/pyjwt)
- SQLAlchemy (source code available at https://github.com/sqlalchemy)
- gevent (source code available at https://github.com/gevent/gevent)
- greenlet (source code available at https://github.com/python-greenlet/greenlet)
- gunicorn (source code available at https://github.com/benoitc/gunicorn)
- json-logging-py (source code available at https://github.com/sebest/json-logging-py)
- marisa-trie (source code available at https://github.com/pytries/marisa-trie)
- pbkdf2 (source code available at https://github.com/dlitz/python-pbkdf2)
- dredd-hooks (source code available at https://github.com/apiaryio/dredd-hooks-python)

* BSD (3-Clause)
- Click (source code available at https://github.com/pallets/click)
- Flask (source code available at https://github.com/pallets/flask)
- Flask-SQLAlchemy (source code available at https://github.com/pallets/flask-sqlalchemy)
- Jinja2 (source code available at https://github.com/pallets/jinja)
- MarkupSafe (source code available at https://github.com/pallets/markupsafe)
- Werkzeug (source code available at https://github.com/pallets/werkzeug)
- itsdangerous (source code available at https://github.com/pallets/itsdangerous)

* BSD-Like
- idna (source code available at https://github.com/kjd/idna)

* MPL 2.0
- certifi (source code available at https://github.com/certifi/python-certifi)

* LGPL
- chardet (source code available at https://github.com/chardet/chardet)
- psycopg2 (source code available at https://github.com/psycopg/psycopg2)
2 changes: 1 addition & 1 deletion auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Following PEP 386
import time

__version__ = (0, 1, 0, 'alpha', int(time.time() / 100))
__version__ = (0, 1, 1)
60 changes: 0 additions & 60 deletions auth/alarms.py

This file was deleted.

3 changes: 0 additions & 3 deletions auth/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,3 @@

# Kafka topic (subject) manager
data_broker_host = os.environ.get("DATA_BROKER_URL", 'http://data-broker')

# TODO: we haven't tested this for a while, is this really working? And is this really necessary?
rabbitmq_host = os.environ.get("RABBITMQ_HOST", "rabbitmq")
5 changes: 2 additions & 3 deletions auth/controller/AuthenticationController.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from database.flaskAlchemyInit import HTTPRequestError
from database.Models import User
from auth.alarms import AlarmError

from dojot.module import Log

Expand All @@ -31,7 +30,7 @@ def authenticate(db_session, auth_data):
try:
user = db_session.query(User).filter_by(username=username.lower()).one()
except orm_exceptions.NoResultFound:
raise AlarmError(401, 'AuthenticationError', username)
raise HTTPRequestError(401, 'AuthenticationError')
except sqlalchemy_exceptions.DBAPIError:
raise HTTPRequestError(500, 'Problem connecting to database')

Expand All @@ -58,7 +57,7 @@ def authenticate(db_session, auth_data):
LOGGER.info('user ' + user.username + ' loged in')
return str(encoded, 'ascii')

raise AlarmError(403, 'AuthorizationError', username, user.id)
raise HTTPRequestError(403, 'AuthorizationError')


# this helper function receive a base64 JWT token
Expand Down
5 changes: 1 addition & 4 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ certifi==2019.11.28
chardet==3.0.4
Click==7.0
colorlog==3.1.4
git+https://github.com/dojot/alarm-client-python.git#egg=dojot-alarmlibrary
dojot.module==0.0.1a5
enum34==1.1.6
dojot.module==0.1.0
Flask==0.12.2
Flask-Redis==0.3.0
Flask-SQLAlchemy==2.3.2
Expand All @@ -19,7 +17,6 @@ kafka-python==1.4.7
marisa-trie==0.7.4
MarkupSafe==1.1.1
pbkdf2==1.3
pika==0.11.2
psycopg2==2.7.4
PyJWT==1.5.3
redis==3.3.11
Expand Down

0 comments on commit e6a19d7

Please sign in to comment.