diff --git a/api_pagopa.yaml b/api_pagopa.yaml
index b29913913..e7069e2fa 100644
--- a/api_pagopa.yaml
+++ b/api_pagopa.yaml
@@ -40,10 +40,20 @@ definitions:
description: User data needed by PagaPA proxy.
type: object
properties:
+ name:
+ type: string
+ family_name:
+ type: string
email:
$ref: '#/definitions/EmailAddress'
+ mobile_phone:
+ type: string
+ minLength: 1
required:
+ - name
+ - family_name
- email
+ - mobile_phone
responses: {}
parameters: {}
consumes:
diff --git a/api_proxy.yaml b/api_proxy.yaml
index 82200bde7..7b1ecab4e 100644
--- a/api_proxy.yaml
+++ b/api_proxy.yaml
@@ -477,6 +477,9 @@ definitions:
type: string
spid_email:
$ref: '#/definitions/EmailAddress'
+ spid_mobile_phone:
+ type: string
+ minLength: 1
preferred_languages:
type: array
items:
@@ -492,6 +495,7 @@ definitions:
- is_webhook_enabled
- name
- spid_email
+ - spid_mobile_phone
- version
ProfileWithoutEmail:
type: object
@@ -514,6 +518,9 @@ definitions:
type: string
spid_email:
$ref: '#/definitions/EmailAddress'
+ spid_mobile_phone:
+ type: string
+ minLength: 1
preferred_languages:
type: array
items:
@@ -529,6 +536,7 @@ definitions:
- is_webhook_enabled
- name
- spid_email
+ - spid_mobile_phone
- version
PublicSession:
type: object
diff --git a/package.json b/package.json
index 2bb528b71..fd058f20a 100644
--- a/package.json
+++ b/package.json
@@ -60,7 +60,7 @@
"redis": "^2.8.0",
"redis-clustr": "^1.6.0",
"request-ip": "^2.1.1",
- "spid-passport": "git://github.com/gunzip/spid-passport.git#5cd9f353",
+ "spid-passport": "git://github.com/gunzip/spid-passport.git#5900adf9",
"typescript": "^2.9.2",
"ulid": "^2.2.2",
"validator": "^10.4.0",
diff --git a/src/controllers/__tests__/authenticationController.test.ts b/src/controllers/__tests__/authenticationController.test.ts
index 2cbc736e4..aad366311 100644
--- a/src/controllers/__tests__/authenticationController.test.ts
+++ b/src/controllers/__tests__/authenticationController.test.ts
@@ -5,6 +5,7 @@
/* tslint:disable:no-big-function */
import { left, right } from "fp-ts/lib/Either";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import { UrlFromString } from "italia-ts-commons/lib/url";
import * as lolex from "lolex";
import * as redis from "redis";
@@ -109,6 +110,7 @@ const mockedUser: User = {
spid_email: anEmailAddress,
spid_idp: "xxx",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: mockWalletToken as WalletToken
};
@@ -122,6 +124,7 @@ const validUserPayload = {
issuer: {
_: "xxx"
},
+ mobilePhone: "3222222222222",
name: aValidname,
nameID: "garibaldi",
nameIDFormat: aValidIDFormat,
@@ -136,6 +139,7 @@ const invalidUserPayload = {
issuer: {
_: "xxx"
},
+ mobilePhone: "3222222222222",
name: aValidname,
nameID: "garibaldi",
nameIDFormat: aValidIDFormat,
@@ -428,6 +432,7 @@ IFJiDanROwzoG0YNd8aCWE8ZM2y81Ww=
+
@@ -435,7 +440,7 @@ IFJiDanROwzoG0YNd8aCWE8ZM2y81Ww=
Digital citizenship proxy
https://github.com/teamdigitale/italia-backend
-Mh1V7fJl+pMthhcJAAhEBuY58dWxqd3NI2ha/JyPpeI=SIzSS+ZwK00YtvsXR8odCkrkBapatSdy8n4ifLl0/zoRQM7UCPrSKbUWihMBJCe7HdoT4VXOhhhgo9+IdE1qunrxQ1a3ydQbySRAidtaGbOQf5JxfzH0zYcKCQJLRPMXtLBNL3qlt+np0Bf740ZpzaKHRktaRn/0yKEHEtE9khf8d2xuzIm/fw75L2/i7wSggNFSUBzwSGd8EN3XRFWgwUuIwP6NK8GAjZa7pO0sZ0Z2zqCL1Q75/FZqaRBqvkrGDmlVu7wRJDTY6WSlzQ7PdhrLyGb4pxjWER0SfnKJBskS9SVjPP9ypb/AoQB6zoFX/58NtDUaluBr3jgxvWLH5R4=
+Bf2Cp9GHtyquphvca26konsKBCC5ZWZE/Jg/ouPscmg=Xy6T5fn1q2IS0GCXkfOccJv4rF+QrUshbV4hcn/XCfeGSX+C9Kunxx2+BuVMOpuTjtYGUxgCEdMAGOGbaOtCM8pE0XlrCDrAibvSYMvREYSWIWg6ljpUpnPTkM8YNlkot7Gl5Vs7sR3+5vA00SvudJqElttDo3/jrMLGSp4QmX5pcoycmvxummZ4rVktxhQuVdUyODD3Hl+DYJMzkUIBrxz+wR/ysPpi+aBAfNFY+WwTFB/JmVmDHmyoCo02QTaLZqSDRE9JfYU3bmTApqDOwRUAX3MKGx13i/wIw2iqPAakqRM7lHfJBzFS3cTXziCqHB72++pGc/ys9HFoddw+3Is=
MIIDczCCAlqgAwIBAgIBADANBgkqhkiG9w0BAQ0FADBTMQswCQYDVQQGEwJpdDEN
MAsGA1UECAwEUm9tZTEUMBIGA1UECgwLYWdpZC5nb3YuaXQxHzAdBgNVBAMMFmh0
dHBzOi8vaXRhbGlhLWJhY2tlbmQwHhcNMTcxMDI2MTAzNTQwWhcNMTgxMDI2MTAz
@@ -457,8 +462,8 @@ OM+P8UsrYi2KZuyzSrHq5c0GJz0UzSs8cIDC/CPEajx2Uy+7TABwR4d20Hyo6WIm
IFJiDanROwzoG0YNd8aCWE8ZM2y81Ww=
`;
- const matadata = await controller.metadata();
- matadata.apply(res);
+ const metadata = await controller.metadata();
+ metadata.apply(res);
expect(controller).toBeTruthy();
expect(res.status).toHaveBeenCalledWith(200);
diff --git a/src/controllers/__tests__/messagesController.test.ts b/src/controllers/__tests__/messagesController.test.ts
index 1a97c9184..b073ab2d0 100644
--- a/src/controllers/__tests__/messagesController.test.ts
+++ b/src/controllers/__tests__/messagesController.test.ts
@@ -1,6 +1,7 @@
/* tslint:disable:no-any */
import { right } from "fp-ts/lib/Either";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import mockReq from "../../__mocks__/request";
import mockRes from "../../__mocks__/response";
import ApiClient from "../../services/apiClientFactory";
@@ -54,6 +55,7 @@ const mockedUser: User = {
spid_email: anEmailAddress,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "123hexToken" as WalletToken
};
diff --git a/src/controllers/__tests__/notificationController.test.ts b/src/controllers/__tests__/notificationController.test.ts
index 4b2291c20..b2b145c24 100644
--- a/src/controllers/__tests__/notificationController.test.ts
+++ b/src/controllers/__tests__/notificationController.test.ts
@@ -1,4 +1,5 @@
import { ResponseSuccessJson } from "italia-ts-commons/lib/responses";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import mockReq from "../../__mocks__/request";
import mockRes from "../../__mocks__/response";
import NotificationService from "../../services/notificationService";
@@ -31,6 +32,7 @@ const mockedUser: User = {
spid_email: anEmailAddress,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "123hexToken" as WalletToken
};
@@ -46,6 +48,7 @@ const mockedInvalidUser: User = {
spid_email: anEmailAddress,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "123hexToken" as WalletToken
};
diff --git a/src/controllers/__tests__/profileController.test.ts b/src/controllers/__tests__/profileController.test.ts
index 0a67a5cc4..39f570aba 100644
--- a/src/controllers/__tests__/profileController.test.ts
+++ b/src/controllers/__tests__/profileController.test.ts
@@ -2,6 +2,7 @@
import { right } from "fp-ts/lib/Either";
import { NonNegativeInteger } from "italia-ts-commons/lib/numbers";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import mockReq from "../../__mocks__/request";
import mockRes from "../../__mocks__/response";
import ApiClient from "../../services/apiClientFactory";
@@ -63,6 +64,7 @@ const mockedUser: User = {
spid_email: anEmailAddress,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "123hexToken" as WalletToken
};
diff --git a/src/controllers/__tests__/serviceController.test.ts b/src/controllers/__tests__/serviceController.test.ts
index b299e2487..1ba8adb49 100644
--- a/src/controllers/__tests__/serviceController.test.ts
+++ b/src/controllers/__tests__/serviceController.test.ts
@@ -46,6 +46,7 @@ const mockedUser: User = {
spid_email: anEmailAddress,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "123hexToken" as WalletToken
};
diff --git a/src/controllers/__tests__/sessionController.test.ts b/src/controllers/__tests__/sessionController.test.ts
index 93565ee60..b32891401 100644
--- a/src/controllers/__tests__/sessionController.test.ts
+++ b/src/controllers/__tests__/sessionController.test.ts
@@ -4,6 +4,7 @@
/* tslint:disable:no-identical-functions */
/* tslint:disable:no-big-function */
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import mockReq from "../../__mocks__/request";
import mockRes from "../../__mocks__/response";
import { EmailAddress } from "../../types/api/EmailAddress";
@@ -41,6 +42,7 @@ const mockedUser: User = {
spid_email: anEmailAddress,
spid_idp: "xxx",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: mockWalletToken as WalletToken
};
diff --git a/src/controllers/pagoPAController.ts b/src/controllers/pagoPAController.ts
index fba412cc8..705e8ddd2 100644
--- a/src/controllers/pagoPAController.ts
+++ b/src/controllers/pagoPAController.ts
@@ -47,7 +47,10 @@ export default class PagoPAController {
const email = maybeCustomEmail ? maybeCustomEmail : profile.spid_email;
return ResponseSuccessJson({
- email
+ email,
+ family_name: user.family_name,
+ mobile_phone: user.spid_mobile_phone,
+ name: user.name
});
}
}
diff --git a/src/services/__tests__/messagesService.test.ts b/src/services/__tests__/messagesService.test.ts
index 65cdc1fa5..5db686809 100644
--- a/src/services/__tests__/messagesService.test.ts
+++ b/src/services/__tests__/messagesService.test.ts
@@ -1,4 +1,5 @@
import { left, right } from "fp-ts/lib/Either";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import { EmailAddress } from "../../types/api/EmailAddress";
import { FiscalCode } from "../../types/api/FiscalCode";
import { SpidLevelEnum } from "../../types/api/SpidLevel";
@@ -177,6 +178,7 @@ const mockedUser: User = {
spid_email: aValidEmail,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "HexToKen" as WalletToken
};
diff --git a/src/services/__tests__/profileService.test.ts b/src/services/__tests__/profileService.test.ts
index 7df673115..26104062b 100644
--- a/src/services/__tests__/profileService.test.ts
+++ b/src/services/__tests__/profileService.test.ts
@@ -1,4 +1,5 @@
import { right } from "fp-ts/lib/Either";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import { EmailAddress } from "../../types/api/EmailAddress";
import { FiscalCode } from "../../types/api/FiscalCode";
import { IsInboxEnabled } from "../../types/api/IsInboxEnabled";
@@ -46,6 +47,7 @@ const proxyProfileWithEmailResponse = {
name: "Luca",
preferred_languages: ["it_IT"],
spid_email: aValidSPIDEmail,
+ spid_mobile_phone: "3222222222222",
version: 42
};
const proxyProfileWithoutEmailResponse = {
@@ -57,6 +59,7 @@ const proxyProfileWithoutEmailResponse = {
is_webhook_enabled: false,
name: "Luca",
spid_email: aValidSPIDEmail,
+ spid_mobile_phone: "3222222222222",
version: 0
};
const proxyUpsertRequest = {
@@ -103,6 +106,7 @@ const mockedUser: User = {
spid_email: aValidSPIDEmail,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "HexToKen" as WalletToken
};
diff --git a/src/services/__tests__/redisSessionStorage.test.ts b/src/services/__tests__/redisSessionStorage.test.ts
index 886c6d134..ad600350f 100644
--- a/src/services/__tests__/redisSessionStorage.test.ts
+++ b/src/services/__tests__/redisSessionStorage.test.ts
@@ -5,6 +5,7 @@
/* tslint:disable:no-null-keyword */
import { left, right } from "fp-ts/lib/Either";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import * as lolex from "lolex";
import { createMockRedis } from "mock-redis-client";
import { EmailAddress } from "../../types/api/EmailAddress";
@@ -35,6 +36,7 @@ const aValidUser: User = {
spid_email: anEmailAddress,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "HexToKen" as WalletToken
};
diff --git a/src/strategies/spidStrategy.ts b/src/strategies/spidStrategy.ts
index a17dc6c35..544eef8c2 100644
--- a/src/strategies/spidStrategy.ts
+++ b/src/strategies/spidStrategy.ts
@@ -88,7 +88,13 @@ const spidStrategy = (
acceptedClockSkewMs: samlAcceptedClockSkewMs,
attributeConsumingServiceIndex: samlAttributeConsumingServiceIndex,
attributes: {
- attributes: ["fiscalNumber", "name", "familyName", "email"],
+ attributes: [
+ "fiscalNumber",
+ "name",
+ "familyName",
+ "email",
+ "mobilePhone"
+ ],
name: "Required attributes"
},
callbackUrl: samlCallbackUrl,
diff --git a/src/types/__tests__/profile.test.ts b/src/types/__tests__/profile.test.ts
index a01a6a6ab..68f5a70ae 100644
--- a/src/types/__tests__/profile.test.ts
+++ b/src/types/__tests__/profile.test.ts
@@ -4,6 +4,7 @@ import { isLeft, isRight } from "fp-ts/lib/Either";
import mockReq from "../../__mocks__/request";
import { NonNegativeInteger } from "italia-ts-commons/lib/numbers";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import { EmailAddress } from "../api/EmailAddress";
import { ExtendedProfile } from "../api/ExtendedProfile";
import { FiscalCode } from "../api/FiscalCode";
@@ -55,6 +56,7 @@ const mockedUser: User = {
spid_email: anEmailAddress,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "HexToKen" as WalletToken
};
diff --git a/src/types/__tests__/user.test.ts b/src/types/__tests__/user.test.ts
index 536801a9f..ba7eb8e20 100644
--- a/src/types/__tests__/user.test.ts
+++ b/src/types/__tests__/user.test.ts
@@ -3,6 +3,7 @@
import { Either, isLeft, isRight } from "fp-ts/lib/Either";
import mockReq from "../../__mocks__/request";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import { EmailAddress } from "../api/EmailAddress";
import { FiscalCode } from "../api/FiscalCode";
import { SpidLevelEnum } from "../api/SpidLevel";
@@ -31,6 +32,7 @@ const mockedSpidUser: any = {
fiscalNumber: aFiscalNumber,
getAssertionXml: () => "",
issuer: anIssuer,
+ mobilePhone: "3222222222222",
name: "Giuseppe Maria",
nameID: "garibaldi",
nameIDFormat: "urn:oasis:names:tc:SAML:2.0:nameid-format:transient",
@@ -55,6 +57,7 @@ const mockedUser: User = {
spid_email: anEmailAddress,
spid_idp: "spid_idp_name",
spid_level: aValidSpidLevel,
+ spid_mobile_phone: "3222222222222" as NonEmptyString,
wallet_token: "HexToKen" as WalletToken
};
diff --git a/src/types/profile.ts b/src/types/profile.ts
index 7754bd667..1db1cf6e6 100644
--- a/src/types/profile.ts
+++ b/src/types/profile.ts
@@ -35,6 +35,7 @@ export function toAppProfileWithEmail(
name: user.name,
preferred_languages: from.preferredLanguages,
spid_email: user.spid_email,
+ spid_mobile_phone: user.spid_mobile_phone,
version: from.version
};
}
@@ -54,6 +55,7 @@ export function toAppProfileWithoutEmail(user: User): ProfileWithoutEmail {
is_webhook_enabled: false,
name: user.name,
spid_email: user.spid_email,
+ spid_mobile_phone: user.spid_mobile_phone,
version: 0 as NonNegativeInteger
};
}
diff --git a/src/types/user.ts b/src/types/user.ts
index 3df7c15d0..9c00a5dcc 100644
--- a/src/types/user.ts
+++ b/src/types/user.ts
@@ -10,6 +10,7 @@ import { number, string } from "io-ts";
import * as t from "io-ts";
import { JSONFromString } from "io-ts-types";
import { readableReport } from "italia-ts-commons/lib/reporters";
+import { NonEmptyString } from "italia-ts-commons/lib/strings";
import { DOMParser } from "xmldom";
import { log } from "../utils/logger";
import { EmailAddress } from "./api/EmailAddress";
@@ -32,6 +33,7 @@ export const User = t.interface({
spid_email: EmailAddress,
spid_idp: string,
spid_level: SpidLevel,
+ spid_mobile_phone: NonEmptyString,
wallet_token: WalletToken
});
@@ -45,6 +47,7 @@ export const SpidUser = t.interface({
fiscalNumber: FiscalCode,
getAssertionXml: t.Function,
issuer: Issuer,
+ mobilePhone: NonEmptyString,
name: string,
nameID: string,
nameIDFormat: string,
@@ -73,6 +76,7 @@ export function toAppUser(
spid_email: from.email,
spid_idp: from.issuer._, // The used idp is needed for logout.
spid_level: from.authnContextClassRef,
+ spid_mobile_phone: from.mobilePhone,
wallet_token: walletToken
};
}
diff --git a/yarn.lock b/yarn.lock
index 5cd7d0e67..920178d0f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5197,9 +5197,9 @@ spdx-license-ids@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87"
-"spid-passport@git://github.com/gunzip/spid-passport.git#6395dd9e5fdf1ecd48af5f02745a37a7aec9b9d0":
+"spid-passport@git://github.com/gunzip/spid-passport.git#5900adf9":
version "1.0.0"
- resolved "git://github.com/gunzip/spid-passport.git#6395dd9e5fdf1ecd48af5f02745a37a7aec9b9d0"
+ resolved "git://github.com/gunzip/spid-passport.git#5900adf925b99a91861b5d1f348ee8c7d499ed55"
dependencies:
passport "^0.4.0"
passport-saml "^0.33.0"