Skip to content

Commit

Permalink
WIP: mob prog on certification dirigeant
Browse files Browse the repository at this point in the history
  • Loading branch information
rdubigny committed Dec 16, 2024
1 parent afdfb04 commit 3daf4e9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Les valeurs `acr` utilisées par ProConnect Identité sont les suivantes :
- code à usage unique envoyé par email à l'adresse de contact référencée dans un annuaire de référence
- identité du dirigeant d'association conforme
- `https://proconnect.gouv.fr/assurance/consistency-checked-2fa` : `https://proconnect.gouv.fr/assurance/consistency-checked` + authentification à double facteur
- `https://proconnect.gouv.fr/assurance/certification-dirigeant` : pour activer la certification dirigeant

## 3. 👋 Contribuer à ProConnect Identité

Expand Down
7 changes: 6 additions & 1 deletion cypress/e2e/signin_with_right_acr/fixtures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ VALUES
(4, '[email protected]', true, CURRENT_TIMESTAMP,
'$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,
'Jean', 'IAL1 AAL1', '0123456789', 'Sbire',
null, null, false),
(5, '[email protected]', true, CURRENT_TIMESTAMP,
'$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,
'Jean', 'Certification', '0123456789', 'Dirigeant',
null, null, false);

INSERT INTO organizations
Expand All @@ -34,7 +38,8 @@ VALUES
(1, 1, false, 'domain', true),
(2, 1, false, null, true),
(3, 1, false, 'domain', true),
(4, 1, false, null, true);
(4, 1, false, null, true),
(5, 1, false, null, true);

INSERT INTO oidc_clients
(client_name, client_id, client_secret, redirect_uris,
Expand Down
19 changes: 19 additions & 0 deletions cypress/e2e/signin_with_right_acr/index.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,22 @@ describe("sign-in with a client requiring 2fa identity", () => {
cy.contains("Attention : le site que vous voulez utiliser requiert la 2FA");
});
});

describe("sign-in with a client requiring certification dirigeant identity", () => {
beforeEach(() => {
cy.visit("http://localhost:4000");
cy.setRequestedAcrs([
"https://proconnect.gouv.fr/assurance/certification-dirigeant",
]);
});

it.only("should sign-in an return the right acr value", function () {
cy.get("button#custom-connection").click({ force: true });

cy.login("[email protected]");

cy.contains(
'"acr": "https://proconnect.gouv.fr/assurance/certification-dirigeant"',
);
});
});
1 change: 1 addition & 0 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const {
ACR_VALUE_FOR_IAL1_AAL2,
ACR_VALUE_FOR_IAL2_AAL1,
ACR_VALUE_FOR_IAL2_AAL2,
ACR_VALUE_FOR_CERTIFICATION_DIRIGEANT,
BREVO_API_KEY,
CRISP_BASE_URL,
CRISP_IDENTIFIER,
Expand Down
3 changes: 3 additions & 0 deletions src/config/env.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export const paramsEnvSchema = z.object({
ACR_VALUE_FOR_IAL2_AAL2: z
.string()
.default("https://proconnect.gouv.fr/assurance/consistency-checked-2fa"),
ACR_VALUE_FOR_CERTIFICATION_DIRIGEANT: z
.string()
.default("https://proconnect.gouv.fr/assurance/certification-dirigeant"),
DEPLOY_ENV: z
.enum(["localhost", "preview", "production", "sandbox"])
.default("localhost"),
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { NextFunction, Request, Response } from "express";
import Provider, { errors } from "oidc-provider";
import { z } from "zod";
import {
ACR_VALUE_FOR_CERTIFICATION_DIRIGEANT,
ACR_VALUE_FOR_IAL1_AAL1,
ACR_VALUE_FOR_IAL1_AAL2,
ACR_VALUE_FOR_IAL2_AAL1,
Expand Down Expand Up @@ -95,6 +96,7 @@ export const interactionEndControllerFactory =
: isConsistencyChecked
? ACR_VALUE_FOR_IAL2_AAL1
: ACR_VALUE_FOR_IAL1_AAL1;
currentAcr = ACR_VALUE_FOR_CERTIFICATION_DIRIGEANT;

const amr = getSessionStandardizedAuthenticationMethodsReferences(req);
const ts = user.last_sign_in_at
Expand Down
2 changes: 2 additions & 0 deletions test/env.zod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ test("default sample env with configured INSEE secrets", () => {
"https://proconnect.gouv.fr/assurance/consistency-checked",
ACR_VALUE_FOR_IAL2_AAL2:
"https://proconnect.gouv.fr/assurance/consistency-checked-2fa",
ACR_VALUE_FOR_CERTIFICATION_DIRIGEANT:
"https://proconnect.gouv.fr/assurance/certification-dirigeant",
API_AUTH_PASSWORD: "admin",
API_AUTH_USERNAME: "admin",
CRISP_BASE_URL: "https://api.crisp.chat",
Expand Down

0 comments on commit 3daf4e9

Please sign in to comment.