@proconnect-gouv/proconnect.identite 10.2.0 → 10.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/managers/certification/normalize.d.ts.map +1 -1
- package/dist/managers/certification/normalize.js +8 -20
- package/dist/managers/franceconnect/openid-client.d.ts +1 -1
- package/dist/managers/franceconnect/openid-client.d.ts.map +1 -1
- package/dist/managers/franceconnect/openid-client.js +4 -2
- package/package.json +3 -3
- package/src/managers/certification/normalize.test.ts +15 -0
- package/src/managers/certification/normalize.ts +9 -20
- package/src/managers/franceconnect/openid-client.ts +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @proconnect-gouv/proconnect.identite
|
|
2
2
|
|
|
3
|
+
## 10.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2170](https://github.com/proconnect-gouv/proconnect-identite/pull/2170) [`5fc628d`](https://github.com/proconnect-gouv/proconnect-identite/commit/5fc628d82e7b2ae0bcc1961d5d7a7e3f1fd0c7d2) Thanks [@BenoitSerrano](https://github.com/BenoitSerrano)! - renommage de la variable allowLocalhost pour FranceConnect en allowInsecureRequests
|
|
8
|
+
- Updated dependencies [[`9a0ca7c`](https://github.com/proconnect-gouv/proconnect-identite/commit/9a0ca7c55d8ad6dd70cd49f6ddf470a4ee436f42)]:
|
|
9
|
+
- @proconnect-gouv/proconnect.annuaire_entreprises@3.0.5
|
|
10
|
+
|
|
11
|
+
## 10.2.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#2174](https://github.com/proconnect-gouv/proconnect-identite/pull/2174) [`bdc9f6d`](https://github.com/proconnect-gouv/proconnect-identite/commit/bdc9f6d34c80b3a5fe1bb3ad9f97212a8e913932) Thanks [@Dev-next-gen](https://github.com/Dev-next-gen)! - normalizeText retire tous les diacritiques (ñ, ã, á, ř…) et traite pareil les accents composés et décomposés
|
|
16
|
+
- Updated dependencies [[`4c83789`](https://github.com/proconnect-gouv/proconnect-identite/commit/4c837898d9c1e2781525aed02d7b53cc4f755f11)]:
|
|
17
|
+
- @proconnect-gouv/proconnect.annuaire_entreprises@3.0.4
|
|
18
|
+
|
|
3
19
|
## 10.2.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/normalize.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/normalize.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAgCrE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAM7E"}
|
|
@@ -15,29 +15,17 @@ export function normalizeText(text) {
|
|
|
15
15
|
return "";
|
|
16
16
|
// Convert to uppercase
|
|
17
17
|
let normalized = text.toUpperCase();
|
|
18
|
-
// Replace accented characters with their simple versions
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
É: "E",
|
|
25
|
-
È: "E",
|
|
26
|
-
Ê: "E",
|
|
27
|
-
Ë: "E",
|
|
28
|
-
Î: "I",
|
|
29
|
-
Ï: "I",
|
|
30
|
-
Ô: "O",
|
|
31
|
-
Ö: "O",
|
|
32
|
-
Ù: "U",
|
|
33
|
-
Û: "U",
|
|
34
|
-
Ü: "U",
|
|
35
|
-
Ÿ: "Y",
|
|
18
|
+
// Replace accented characters with their simple versions: decompose them
|
|
19
|
+
// (NFD) and drop the combining marks, so that every Latin diacritic is
|
|
20
|
+
// covered and precomposed and decomposed inputs normalize the same way
|
|
21
|
+
normalized = normalized.normalize("NFD").replace(/\p{M}/gu, "");
|
|
22
|
+
// Ligatures do not decompose
|
|
23
|
+
const ligatureMap = {
|
|
36
24
|
Æ: "AE",
|
|
37
25
|
Œ: "OE",
|
|
38
26
|
};
|
|
39
|
-
for (const [
|
|
40
|
-
normalized = normalized.replaceAll(
|
|
27
|
+
for (const [ligature, simple] of Object.entries(ligatureMap)) {
|
|
28
|
+
normalized = normalized.replaceAll(ligature, simple);
|
|
41
29
|
}
|
|
42
30
|
// Replace special characters (including ' and -) with spaces
|
|
43
31
|
// Keep only letters, digits, and spaces
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openid-client.d.ts","sourceRoot":"","sources":["../../../src/managers/franceconnect/openid-client.ts"],"names":[],"mappings":"AAMA,OAAO,EAUL,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAKvB,MAAM,MAAM,gCAAgC,GAAG;IAC7C,
|
|
1
|
+
{"version":3,"file":"openid-client.d.ts","sourceRoot":"","sources":["../../../src/managers/franceconnect/openid-client.ts"],"names":[],"mappings":"AAMA,OAAO,EAUL,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAKvB,MAAM,MAAM,gCAAgC,GAAG;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAClC,MAAM,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,gCAAgC,wDAczC;AAED,MAAM,MAAM,oCAAoC,GAAG,UAAU,CAC3D,OAAO,oCAAoC,CAC5C,CAAC;AAEF,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,kCAAkC,CAChD,gBAAgB,EAAE,oCAAoC,EACtD,UAAU,EAAE;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,IAG0C,OAAO,MAAM,EAAE,OAAO,MAAM,kBAaxE;AAED,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,oCAAoC,IAEX,YAAY;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,GAAG,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;;;;;;;;;;;;GA0BF;AAED,wBAAgB,wCAAwC,CACtD,gBAAgB,EAAE,oCAAoC,IAGpD,eAAe,MAAM,EACrB,0BAA0B,MAAM,EAChC,OAAO,MAAM,kBAShB"}
|
|
@@ -3,9 +3,11 @@ import { FranceConnectUserInfoResponseSchema, } from "#src/types";
|
|
|
3
3
|
import { allowInsecureRequests, authorizationCodeGrant, buildAuthorizationUrl, buildEndSessionUrl, ClientSecretBasic, discovery, fetchUserInfo, randomNonce, randomState, } from "openid-client";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
export function getFranceConnectConfigurationFactory(params) {
|
|
6
|
-
const {
|
|
6
|
+
const { clientId, clientSecret, metadata, server } = params;
|
|
7
7
|
return function getFranceConnectConfiguration() {
|
|
8
|
-
return discovery(server, clientId, metadata, ClientSecretBasic(clientSecret),
|
|
8
|
+
return discovery(server, clientId, metadata, ClientSecretBasic(clientSecret), params.allowInsecureRequests
|
|
9
|
+
? { execute: [allowInsecureRequests] }
|
|
10
|
+
: undefined);
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
export function createOidcChecks() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proconnect-gouv/proconnect.identite",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.2",
|
|
4
4
|
"homepage": "https://github.com/proconnect-gouv/proconnect-identite/tree/main/packages/identite#readme",
|
|
5
5
|
"bugs": "https://github.com/proconnect-gouv/proconnect-identite/issues",
|
|
6
6
|
"repository": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@electric-sql/pglite": "^0.3.12",
|
|
54
|
-
"@proconnect-gouv/proconnect.annuaire_entreprises": "^3.0.
|
|
54
|
+
"@proconnect-gouv/proconnect.annuaire_entreprises": "^3.0.5",
|
|
55
55
|
"@proconnect-gouv/proconnect.api_entreprise": "^2.3.0",
|
|
56
56
|
"@proconnect-gouv/proconnect.core": "^1.0.0",
|
|
57
57
|
"@proconnect-gouv/proconnect.devtools.typescript": "1.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"tsx": "^4.20.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@proconnect-gouv/proconnect.annuaire_entreprises": "^3.0.
|
|
68
|
+
"@proconnect-gouv/proconnect.annuaire_entreprises": "^3.0.5",
|
|
69
69
|
"@proconnect-gouv/proconnect.api_entreprise": "^2.3.0",
|
|
70
70
|
"@proconnect-gouv/proconnect.core": "^1.0.0",
|
|
71
71
|
"@proconnect-gouv/proconnect.insee": "^2.0.0",
|
|
@@ -17,6 +17,17 @@ describe("normalizeText", () => {
|
|
|
17
17
|
assert.equal(normalizeText("Hélène"), "HELENE");
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
it("removes diacritics outside the French alphabet", () => {
|
|
21
|
+
assert.equal(normalizeText("Muñoz"), "MUNOZ");
|
|
22
|
+
assert.equal(normalizeText("João"), "JOAO");
|
|
23
|
+
assert.equal(normalizeText("Ángel Íñigo"), "ANGEL INIGO");
|
|
24
|
+
assert.equal(normalizeText("Dvořák"), "DVORAK");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("normalizes decomposed and precomposed accents the same way", () => {
|
|
28
|
+
assert.equal(normalizeText("He\u0301le\u0300ne"), "HELENE");
|
|
29
|
+
});
|
|
30
|
+
|
|
20
31
|
it("replaces special characters with spaces", () => {
|
|
21
32
|
assert.equal(normalizeText("Jean-Pierre"), "JEAN PIERRE");
|
|
22
33
|
assert.equal(normalizeText("O'Connor"), "O CONNOR");
|
|
@@ -60,6 +71,10 @@ describe("extractFirstName", () => {
|
|
|
60
71
|
assert.equal(extractFirstName("Marie-Thérèse"), "MARIE");
|
|
61
72
|
});
|
|
62
73
|
|
|
74
|
+
it("keeps the whole first name when it has a non-French diacritic", () => {
|
|
75
|
+
assert.equal(extractFirstName("João Pedro"), "JOAO");
|
|
76
|
+
});
|
|
77
|
+
|
|
63
78
|
it("handles single name", () => {
|
|
64
79
|
assert.equal(extractFirstName("Jean"), "JEAN");
|
|
65
80
|
});
|
|
@@ -17,30 +17,19 @@ export function normalizeText(text: string | null | undefined): string {
|
|
|
17
17
|
// Convert to uppercase
|
|
18
18
|
let normalized = text.toUpperCase();
|
|
19
19
|
|
|
20
|
-
// Replace accented characters with their simple versions
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
È: "E",
|
|
28
|
-
Ê: "E",
|
|
29
|
-
Ë: "E",
|
|
30
|
-
Î: "I",
|
|
31
|
-
Ï: "I",
|
|
32
|
-
Ô: "O",
|
|
33
|
-
Ö: "O",
|
|
34
|
-
Ù: "U",
|
|
35
|
-
Û: "U",
|
|
36
|
-
Ü: "U",
|
|
37
|
-
Ÿ: "Y",
|
|
20
|
+
// Replace accented characters with their simple versions: decompose them
|
|
21
|
+
// (NFD) and drop the combining marks, so that every Latin diacritic is
|
|
22
|
+
// covered and precomposed and decomposed inputs normalize the same way
|
|
23
|
+
normalized = normalized.normalize("NFD").replace(/\p{M}/gu, "");
|
|
24
|
+
|
|
25
|
+
// Ligatures do not decompose
|
|
26
|
+
const ligatureMap: Record<string, string> = {
|
|
38
27
|
Æ: "AE",
|
|
39
28
|
Œ: "OE",
|
|
40
29
|
};
|
|
41
30
|
|
|
42
|
-
for (const [
|
|
43
|
-
normalized = normalized.replaceAll(
|
|
31
|
+
for (const [ligature, simple] of Object.entries(ligatureMap)) {
|
|
32
|
+
normalized = normalized.replaceAll(ligature, simple);
|
|
44
33
|
}
|
|
45
34
|
|
|
46
35
|
// Replace special characters (including ' and -) with spaces
|
|
@@ -21,7 +21,7 @@ import { z } from "zod";
|
|
|
21
21
|
//
|
|
22
22
|
|
|
23
23
|
export type FranceConnectConfigurationParams = {
|
|
24
|
-
|
|
24
|
+
allowInsecureRequests?: boolean;
|
|
25
25
|
clientId: string;
|
|
26
26
|
clientSecret: string;
|
|
27
27
|
metadata: Partial<ClientMetadata>;
|
|
@@ -31,14 +31,16 @@ export type FranceConnectConfigurationParams = {
|
|
|
31
31
|
export function getFranceConnectConfigurationFactory(
|
|
32
32
|
params: FranceConnectConfigurationParams,
|
|
33
33
|
) {
|
|
34
|
-
const {
|
|
34
|
+
const { clientId, clientSecret, metadata, server } = params;
|
|
35
35
|
return function getFranceConnectConfiguration() {
|
|
36
36
|
return discovery(
|
|
37
37
|
server,
|
|
38
38
|
clientId,
|
|
39
39
|
metadata,
|
|
40
40
|
ClientSecretBasic(clientSecret),
|
|
41
|
-
|
|
41
|
+
params.allowInsecureRequests
|
|
42
|
+
? { execute: [allowInsecureRequests] }
|
|
43
|
+
: undefined,
|
|
42
44
|
);
|
|
43
45
|
};
|
|
44
46
|
}
|