MolSSI / QCFractal

A distributed compute and database platform for quantum chemistry.
https://molssi.github.io/QCFractal/
BSD 3-Clause "New" or "Revised" License
144 stars 47 forks source link

[WIP] Flask authorization refactor #654

Closed doaa-altarawy closed 2 years ago

doaa-altarawy commented 3 years ago

Description

Add flexible authorization using JWT (JSON web tokens), which integrates well with Flask. Refactor Tornado into Flask, keeping all current functionalities, but make use of the ease of use of authentication and other features in Flask. The goal is to move towards more sophisticated and customized access so that users can manage their queues and data, safer delete of unused data, and dashboard access.

Main changes in authorization: Each user has one role that defines their permission. Each role can have many users.

This is an example structure of the role (adapted from AWS policy format which is very flexible and widely known):

 user_permissions = {"Statement": [
        {"Effect": "Allow", "Action": "GET", "Resource": "*"},
        {"Effect": "Deny", "Action": "*", "Resource": "user"},
        {"Effect": "Deny", "Action": "*", "Resource": "manager"},
    ]}

 admin_permissions = {"Statement": [
        {"Effect": "Allow", "Action": "*", "Resource": "*"},
    ]}

 read_role = {"rolename": 'user', "permissions": user_permissions}
 admin_role = {"rolename": 'admin', "permissions": admin_permissions}

`

Changelog description

Refactor Tornado into Flask, and add JWT authorization

Status

lgtm-com[bot] commented 3 years ago

This pull request introduces 26 alerts when merging 9d8625a1ffa00feb2a95ce06b142c526d939e08b into a8e0af89c4500dfa965ff93ee8dfc51850b15502 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 26 alerts when merging cb411eaeaf076d2a089adfb81f10773912badf48 into a8e0af89c4500dfa965ff93ee8dfc51850b15502 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 26 alerts when merging b721c5cb97e12bac8bc1f12fc30ce5043f80700d into a8e0af89c4500dfa965ff93ee8dfc51850b15502 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 25 alerts when merging a9b4a1cd50e7b26f2e4983d3ad39685baad4d2b9 into a49f51d0bb538a350ba42430772528b61b954ccf - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 25 alerts when merging 8af4a21bb66fb86ebe22495c7427afd7ba5dcbe2 into a49f51d0bb538a350ba42430772528b61b954ccf - view on LGTM.com

new alerts:

codecov[bot] commented 3 years ago

Codecov Report

Merging #654 (78e4b18) into master (a8e0af8) will decrease coverage by 0.01%. The diff coverage is n/a.

lgtm-com[bot] commented 3 years ago

This pull request introduces 25 alerts when merging a06c721bf559dc4e75984bae649303905c5cb29b into a49f51d0bb538a350ba42430772528b61b954ccf - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 26 alerts when merging 69bb0f32f80f7ccd252ed1a1db7c299e6ecc6729 into a49f51d0bb538a350ba42430772528b61b954ccf - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 25 alerts when merging 34b7969e7c48848b8ae2a0fc9bc139d4aee639e5 into 78e4b18082db0ec03677b335d03a80a5f4b90240 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 24 alerts when merging 430d9e300947a7cd4ac29e3977c2c26734f7dcbf into 78e4b18082db0ec03677b335d03a80a5f4b90240 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 23 alerts when merging 7c6f1a5443939af8c1a4faab89942b6f99be4440 into 78e4b18082db0ec03677b335d03a80a5f4b90240 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 21 alerts when merging 15a9d03d1b095c573d2a55619a5a5ffa9347c758 into 78e4b18082db0ec03677b335d03a80a5f4b90240 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 3 years ago

This pull request introduces 20 alerts when merging d4c552709748bd517153f5cfab089f50161cdf01 into 78e4b18082db0ec03677b335d03a80a5f4b90240 - view on LGTM.com

new alerts:

bennybp commented 2 years ago

This has all been merged in the next branch :)