Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flask login #68

Merged
merged 4 commits into from
Oct 18, 2023
Merged

Flask login #68

merged 4 commits into from
Oct 18, 2023

Conversation

TheoLechemia
Copy link
Member

@TheoLechemia TheoLechemia commented Jun 12, 2023

  • Utilisation de flask-login : corrige une faille de sécurité sur les cookie (#2574)
  • Ajout de la possibilité de passer le token d'authentification via le header HTTP Authorization Bearer
  • La route /login renvoie le token dans le body pour qu'il puisse être récupérer en frontend
  • Le support de l'authentification via cookie est maintenu (pour UsersHub)
  • Suppression de la fonctionnalité de renouvellement automatique du cookie (qui était non fonctionnelle depuis plusieurs versions)

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Attention: 41 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/pypnusershub/db/models.py 83.48% <100.00%> (+8.37%) ⬆️
src/pypnusershub/schemas.py 95.83% <100.00%> (+0.18%) ⬆️
src/pypnusershub/test_settings.py 100.00% <100.00%> (ø)
src/pypnusershub/decorators.py 29.41% <29.41%> (ø)
src/pypnusershub/login_manager.py 57.14% <57.14%> (ø)
src/pypnusershub/routes.py 67.85% <58.53%> (+45.03%) ⬆️

... and 2 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

src/pypnusershub/tests/utils.py Outdated Show resolved Hide resolved
src/pypnusershub/tests/utils.py Outdated Show resolved Hide resolved
src/pypnusershub/tests/fixtures.py Outdated Show resolved Hide resolved
@@ -15,6 +17,12 @@
}


@pytest.fixture(autouse=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

src/pypnusershub/tests/fixtures.py Outdated Show resolved Hide resolved
requirements-dependencies.in Outdated Show resolved Hide resolved
src/pypnusershub/db/models.py Show resolved Hide resolved
def decorated_view(*args, **kwargs):
if not current_user.is_authenticated:
raise Unauthorized
if current_user.max_level_profil < level:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dépend de current_app

src/pypnusershub/tests/fixtures.py Outdated Show resolved Hide resolved
value=token,
expires=cookie_exp,
return Response(msg, status=400)
user = models.User.query.filter(models.User.identifiant == login).one()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool de plus utiliser AppUser, mais il me semble encore nécessaire de checker l’app et le profile associé non ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oui

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheoLechemia TheoLechemia force-pushed the flask_login branch 9 times, most recently from 2ba8bfe to 1040edb Compare October 16, 2023 12:06
- remove home made cookie management
- support of HTTP Header JWT for authentification
@TheoLechemia TheoLechemia merged commit d65526f into develop Oct 18, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants