-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CORRECTION] Pas d'utilisateur courant si processus authent interrompu
Jusqu'à présent, si l'utilisateur appuie sur le bouton de connexion, est redirigé vers la mire d'authentification FC+, puis revient avec le bouton « back » du navigateur (avant de s'être authentifié, donc), et qu'on recharge la page, on affiche l'utilisateur courant « undefined undefined », ainsi qu'un lien de déconnexion qui génère une erreur FC+. Cause : avant d'être redirigé vers la mire d'authentification, on sauve en session un `etat` et un `nonce` utilisés plus tard pour vérifications de cohérence des données reçues de FC+. Le Middleware chargé de mettre en session l'utilisateur courant détecte la présence de ces infos et considère qu'il s'agit d'un utilisateur valide – alors que ce n'est pas le cas. Ce commit corrige le problème. Co-authored-by: Fabien Lamarque <[email protected]>
- Loading branch information
Showing
5 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
const { ErreurSessionFCPlusInexistante } = require('../../src/erreurs'); | ||
const Utilisateur = require('../../src/modeles/utilisateur'); | ||
|
||
describe("L'utilisateur courant", () => { | ||
it("sait s'afficher", () => { | ||
const utilisateur = new Utilisateur({ prenom: 'Juliette', nomUsage: 'Haucourt' }); | ||
const utilisateur = new Utilisateur({ prenom: 'Juliette', nomUsage: 'Haucourt', jwtSessionFCPlus: 'abcdef' }); | ||
expect(utilisateur.afficheToi()).toBe('Juliette Haucourt'); | ||
}); | ||
|
||
it("vérifie qu'il est initialisé avec un jeton de session FC+", () => { | ||
expect.assertions(1); | ||
|
||
try { | ||
new Utilisateur({ prenom: 'Juliette', nomUsage: 'Haucourt' }); | ||
} catch (e) { | ||
expect(e).toBeInstanceOf(ErreurSessionFCPlusInexistante); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters