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

[AIDANT][REINITIALISATION MOT DE PASSE] Ajoute la limitation du traffic sur les routes de réinitialisation du mot de passe (même valeur que l’authentification) #735

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions mon-aide-cyber-api/src/api/routesAPIUtilisateur.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import { EntrepotUtilisateur } from '../authentification/Utilisateur';
import { ServiceDeChiffrement } from '../securite/ServiceDeChiffrement';
import { CommandeReinitialisationMotDePasse } from '../authentification/reinitialisation-mot-de-passe/CapteurCommandeReinitialisationMotDePasse';
import { adaptateurConfigurationLimiteurTraffic } from './adaptateurLimiteurTraffic';

type CorpsRequeteReinitialiserMotDePasse = core.ParamsDictionary & {
token: string;
Expand Down Expand Up @@ -56,6 +57,9 @@ const valitateurUtilisateur = (
export const routesAPIUtilisateur = (configuration: ConfigurationServeur) => {
const routes = express.Router();

const limiteurTrafficReinitialisationMotDePasse =
adaptateurConfigurationLimiteurTraffic('AUTHENTIFICATION');

const {
entrepots,
adaptateurDeVerificationDeSession: session,
Expand Down Expand Up @@ -97,6 +101,7 @@ export const routesAPIUtilisateur = (configuration: ConfigurationServeur) => {

routes.post(
'/reinitialisation-mot-de-passe',
limiteurTrafficReinitialisationMotDePasse,
express.json(),
async (
requete: Request<CorpsRequeteReinitialisationMotDePasse>,
Expand All @@ -114,6 +119,7 @@ export const routesAPIUtilisateur = (configuration: ConfigurationServeur) => {

routes.patch(
'/reinitialiser-mot-de-passe',
limiteurTrafficReinitialisationMotDePasse,
express.json(),
validateursDeCreationDeMotDePasse(),
valitateurUtilisateur(entrepots.utilisateurs(), serviceDeChiffrement),
Expand Down
Loading