feat(idnot): accepter code en JSON body sur POST /api/v1/idnot/auth | ci: docker_tag=ext
This commit is contained in:
parent
10832ef375
commit
7f5c7f041c
@ -90,3 +90,4 @@ STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID=
|
|||||||
STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID=
|
STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID=
|
||||||
|
|
||||||
SIGNER_API_KEY=your-api-key-change-this
|
SIGNER_API_KEY=your-api-key-change-this
|
||||||
|
VITE_JWT_SECRET_KEY=52b3d77617bb00982dfee15b08effd52cfe5b2e69b2f61cc4848cfe1e98c0bc9
|
7
CHANGELOG.md
Normal file
7
CHANGELOG.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## v1.0.1
|
||||||
|
|
||||||
|
- IdNot: l’endpoint d’authentification accepte désormais le code en POST `/api/v1/idnot/auth` avec `{ code }` dans le corps.
|
||||||
|
- Handler compatible params/body, recommandation: body JSON.
|
||||||
|
- Rappel déploiement: image Docker consommée par `lecoffre_node` via tag `ext`.
|
||||||
|
|
||||||
|
|
@ -24,6 +24,10 @@ Analyse synthétique de `lecoffre-back-mini` (Express + TypeScript).
|
|||||||
- retry emails (1 min)
|
- retry emails (1 min)
|
||||||
- **Arrêts propres**: gestion `SIGINT`/`SIGTERM`, exceptions et promesses rejetées
|
- **Arrêts propres**: gestion `SIGINT`/`SIGTERM`, exceptions et promesses rejetées
|
||||||
|
|
||||||
|
### Changements IdNot
|
||||||
|
- L’endpoint d’authentification accepte désormais le code en POST corps JSON sur `/api/v1/idnot/auth` (au lieu d’un segment d’URL).
|
||||||
|
- Le handler supporte à la fois `req.params.code` et `req.body.code` pour compatibilité, mais l’usage recommandé est `req.body.code`.
|
||||||
|
|
||||||
### Dépendances clés
|
### Dépendances clés
|
||||||
- **HTTP**: `express`, `cors`
|
- **HTTP**: `express`, `cors`
|
||||||
- **Infra**: `pg`, `dotenv`
|
- **Infra**: `pg`, `dotenv`
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lecoffre-back-mini",
|
"name": "lecoffre-back-mini",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "Mini serveur avec une route /api/ping",
|
"description": "Mini serveur avec une route /api/ping",
|
||||||
"main": "dist/server.js",
|
"main": "dist/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -60,8 +60,10 @@ export class IdNotHandlers {
|
|||||||
static authenticate = asyncHandler(async (req: Request, res: Response): Promise<void> => {
|
static authenticate = asyncHandler(async (req: Request, res: Response): Promise<void> => {
|
||||||
const requestId = req.headers['x-request-id'] as string;
|
const requestId = req.headers['x-request-id'] as string;
|
||||||
|
|
||||||
// Extract and validate parameters
|
// Extract and validate parameters (support body or URL param)
|
||||||
const { code } = req.params;
|
const codeParam = req.params?.code;
|
||||||
|
const codeBody = (req.body && typeof req.body.code === 'string') ? req.body.code : undefined;
|
||||||
|
const code = (codeBody && codeBody.length > 0) ? codeBody : codeParam;
|
||||||
|
|
||||||
if (!code || typeof code !== 'string' || code.length < 10) {
|
if (!code || typeof code !== 'string' || code.length < 10) {
|
||||||
throw new ValidationError('Invalid authentication code', [
|
throw new ValidationError('Invalid authentication code', [
|
||||||
|
@ -6,7 +6,7 @@ const router = Router();
|
|||||||
|
|
||||||
router.get('/user/rattachements', IdNotHandlers.getUserRattachements);
|
router.get('/user/rattachements', IdNotHandlers.getUserRattachements);
|
||||||
router.get('/office/rattachements', IdNotHandlers.getOfficeRattachements);
|
router.get('/office/rattachements', IdNotHandlers.getOfficeRattachements);
|
||||||
router.post('/auth/:code', IdNotHandlers.authenticate);
|
router.post('/auth', IdNotHandlers.authenticate);
|
||||||
|
|
||||||
router.get('/user', authenticateIdNot, IdNotHandlers.getCurrentUser);
|
router.get('/user', authenticateIdNot, IdNotHandlers.getCurrentUser);
|
||||||
router.post('/logout', authenticateIdNot, IdNotHandlers.logout);
|
router.post('/logout', authenticateIdNot, IdNotHandlers.logout);
|
||||||
|
@ -14,3 +14,7 @@ Axes de tests pour `lecoffre-back-mini` (sans exemples d’implémentation).
|
|||||||
### Sécurité
|
### Sécurité
|
||||||
- **Entrées**: validation, schémas, erreurs typées
|
- **Entrées**: validation, schémas, erreurs typées
|
||||||
- **Secrets**: vérification de la non-exposition via réponses API
|
- **Secrets**: vérification de la non-exposition via réponses API
|
||||||
|
|
||||||
|
### Auth IdNot
|
||||||
|
- Vérifier POST `/api/v1/idnot/auth` avec un code long dans le corps JSON (`{ code }`) retourne un statut applicatif (4xx/5xx) mais pas 502.
|
||||||
|
- Vérifier qu’un GET/POST avec segment d’URL trop long n’est plus utilisé par le front.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user