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

[TECH] Simplifier l'usage de stratégie de connexions au sein de l'API (PIX-16585). #11427

Merged
merged 4 commits into from
Feb 18, 2025

Conversation

VincentHardouin
Copy link
Member

@VincentHardouin VincentHardouin commented Feb 14, 2025

🥞 Problème

Actuellement, nous avons une unique stratégie de connexion pour les utilisateurs et une stratégie pour chaque application, servant en réalité de restriction pour les routes.

🥓 Proposition

Nous proposons d'utiliser le scope à bon escient en protégeant les routes avec grâce à access: { scope: [] } proposé par Hapi.js.
Puis, nous proposons un petit refacto du fichier authentication avec deux bénéfices :

  • Rendre l'ancienne méthode _checkIsAuthenticated renommé au passage en authenticateJWT agnostique du token et déléguer la partie spécifique à la méthode validate de la stratégie.
  • Nous permettre à l'avenir dans l'API Maddo d'utiliser facilement qu'une seule stratégie.

Enfin, nous avons ajouté une configuration unique pour toutes les applications

🧃 Remarques

😋 Pour tester

Essayer de se connecter en tant qu'utilisateur et en tant qu'application

@pix-bot-github
Copy link

Une fois les applications déployées, elles seront accessibles via les liens suivants :

Les variables d'environnement seront accessibles via les liens suivants :

@VincentHardouin VincentHardouin changed the title [TECH] Simplifier l'usage de stratégie de connections au sein de l'API. [TECH] Simplifier l'usage de stratégie de connections au sein de l'API (PIX-16585). Feb 17, 2025
@HEYGUL HEYGUL force-pushed the prepare-maddo-authentication-config branch from f5b0e1a to db96aae Compare February 17, 2025 10:14
@HEYGUL HEYGUL changed the title [TECH] Simplifier l'usage de stratégie de connections au sein de l'API (PIX-16585). [TECH] Simplifier l'usage de stratégie de connexions au sein de l'API (PIX-16585). Feb 17, 2025
@nlepage nlepage force-pushed the prepare-maddo-authentication-config branch 3 times, most recently from 25bafe4 to 61b5d38 Compare February 17, 2025 11:04
@VincentHardouin VincentHardouin added team-maddo Mise à Dispo de Données and removed team-maddo labels Feb 17, 2025
@VincentHardouin
Copy link
Member Author

FUNC Review OK : user + application

@pix-service-auto-merge pix-service-auto-merge force-pushed the prepare-maddo-authentication-config branch from 61b5d38 to 3c10f7e Compare February 18, 2025 09:09
@pix-service-auto-merge pix-service-auto-merge merged commit 95361a2 into dev Feb 18, 2025
9 of 11 checks passed
@pix-service-auto-merge pix-service-auto-merge deleted the prepare-maddo-authentication-config branch February 18, 2025 09:16
Copy link
Contributor

@bpetetot bpetetot left a comment

Choose a reason for hiding this comment

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

Nickel 👏 Le code est beaucoup plus clair 👍

J'ai testé la connexion utilisateur et application (parcours sup) ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Func Review OK PO validated functionally the PR 🚀 Ready to Merge team-acces team-maddo Mise à Dispo de Données Tech Review OK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants