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

Header auth #2586

Merged
merged 7 commits into from
Oct 25, 2023
Merged

Header auth #2586

merged 7 commits into from
Oct 25, 2023

Conversation

TheoLechemia
Copy link
Member

@TheoLechemia TheoLechemia commented Jun 5, 2023

Abandon du système d'authentification par cookie. Le token d'authentification (JWT) est maintenant passé dans chaque appel à l'API dans le header HTTP "Authorization Bearer". Il est aussi fourni par la route de login du sous module d'authentification et stocké dans le localStorage (voir : PnX-SI/UsersHub-authentification-module#64)
Fix : #2161 #490 #2574

@TheoLechemia TheoLechemia changed the base branch from master to develop June 5, 2023 07:51
@codecov
Copy link

codecov bot commented Jun 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
backend/geonature/app.py 77.41% <100.00%> (+0.18%) ⬆️
...ackend/geonature/core/gn_permissions/decorators.py 97.50% <100.00%> (-0.33%) ⬇️
backend/geonature/core/users/routes.py 53.76% <ø> (-0.24%) ⬇️

... and 11 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

setToken(token, expireDate) {
this._cookie.set('token', token, expireDate);
}

getToken() {
Copy link
Contributor

Choose a reason for hiding this comment

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

getToken ne m’a l’air plus utilisé et peut être supprimée

@@ -1,2 +1,3 @@
# force discovery of some fixtures
from .fixtures import app, users, _session
from pypnusershub.tests.fixtures import _logout_user
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
from pypnusershub.tests.fixtures import _logout_user
from pypnusershub.tests.fixtures import teardown_logout_user

Peut-être plus clair comme ça, ou alors logout_user_at_teardown ?

backend/geonature/tests/test_gn_commons.py Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Est-ce qu’on dit qu’à terme on supprime g.current_user ?
Dans ce cas on peut remplacer les if g.current_user is None par if not current_user.is_authenticated dans les autres décorateurs.
Mais j’ai tendance à me dire que l’avantage de g.current_user, c’est que si on change de lib d’auth, on aura à modifier que load_current_user.

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 c'est peut être plus sur de continuer à utilser g.current_user

backend/geonature/app.py Outdated Show resolved Hide resolved
backend/geonature/core/gn_permissions/decorators.py Outdated Show resolved Hide resolved
backend/geonature/utils/config_schema.py Outdated Show resolved Hide resolved
@TheoLechemia TheoLechemia force-pushed the header-auth branch 5 times, most recently from c8d100a to 6590f2e Compare October 11, 2023 15:13
- Use HTTP Header JWT for API auth
- keep cookie auth for GN-Admin
- bump usershub-auth submodule

Co-authored-by: Élie Bouttier <bouttier@users.noreply.github.com>
@TheoLechemia TheoLechemia merged commit f07241e into develop Oct 25, 2023
7 of 8 checks passed
@TheoLechemia TheoLechemia deleted the header-auth branch October 25, 2023 15:53
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.

Connexion impossible sur un autre domaine que celui de la configuration
3 participants