Skip to content

Commit b13a152

Browse files
authored
Merge pull request #28 from DSorlov/dev
Dev to prod 1.1.2
2 parents b0f09ee + 992a41e commit b13a152

File tree

7 files changed

+110
-76
lines changed

7 files changed

+110
-76
lines changed

Diff for: changelog.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
The format is based on [Keep a Changelog][keep-a-changelog]
44
<!-- and this project adheres to [Semantic Versioning][semantic-versioning]. -->
55

6+
## [1.1.2] (2024-10-23)
7+
8+
### Added
9+
- Added extras.phoneNumber to denote primary phone (Freja)
10+
- Added photoHash (Freja)
11+
12+
### Fixed
13+
- Fixed broken photo attribute (Freja)
14+
15+
## [1.1.1] (2024-07-16)
16+
17+
### Added
18+
- Freja eID Added userConfirmationMethod
19+
20+
### Fixed
21+
- Freja eID orgID getAll function API change implemented
22+
- Freja eID orgID getAll RP-id was broken
23+
- Freja eID Fixed when no extra attributes are present in response
24+
625
## [1.1.0] (2024-02-25)
726

827
### Removed
@@ -151,7 +170,12 @@ The format is based on [Keep a Changelog][keep-a-changelog]
151170

152171
[keep-a-changelog]: http://keepachangelog.com/en/1.0.0/
153172
[Unreleased]: https://github.com/DSorlov/eid-provider/compare/master...dev
154-
[1.0.1]: https://github.com/DSorlov/eid-provider/releases/tag/v1.0.0
173+
[1.1.2]: https://github.com/DSorlov/eid-provider/releases/tag/v1.1.2
174+
[1.1.1]: https://github.com/DSorlov/eid-provider/releases/tag/v1.1.1
175+
[1.1.0]: https://github.com/DSorlov/eid-provider/releases/tag/v1.1.0
176+
[1.0.3]: https://github.com/DSorlov/eid-provider/releases/tag/v1.0.3
177+
[1.0.2]: https://github.com/DSorlov/eid-provider/releases/tag/v1.0.2
178+
[1.0.1]: https://github.com/DSorlov/eid-provider/releases/tag/v1.0.1
155179
[1.0.0]: https://github.com/DSorlov/eid-provider/releases/tag/v1.0.0
156180
[0.2.1]: https://github.com/DSorlov/eid-provider/releases/tag/v0.2.1
157181
[0.2.0]: https://github.com/DSorlov/eid-provider/releases/tag/v0.2.0

Diff for: clients/frejaeid/client.js

+49-39
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class FrejaEID extends BaseClient {
1515

1616
this.clientInfo = {
1717
name: "FrejaEID",
18-
version: "20240225",
18+
version: "20241023",
1919
author: "Daniel Sörlöv <[email protected]>",
2020
url: "https://github.com/DSorlov/eid-provider",
2121
methods: ['auth','sign']
@@ -148,46 +148,54 @@ class FrejaEID extends BaseClient {
148148
jwtToken: result.json.details
149149
};
150150

151-
if (decoded.requestedAttributes.age) extras.age = decoded.requestedAttributes.age;
152-
if (decoded.requestedAttributes.photoFileInfo) extras.photo = decoded.requestedAttributes.photoFileInfo.fileHash;
153-
if (decoded.requestedAttributes.dateOfBirth) extras.dateOfBirth = decoded.requestedAttributes.dateOfBirth;
154-
if (decoded.requestedAttributes.emailAddress) extras.primaryEmail = decoded.requestedAttributes.emailAddress;
155-
if (decoded.requestedAttributes.addresses) extras.addresses = decoded.requestedAttributes.addresses;
156-
if (decoded.requestedAttributes.customIdentifier) extras.customIdentifier = decoded.requestedAttributes.customIdentifier;
157-
if (decoded.requestedAttributes.relyingPartyUserId) extras.relyingPartyUserId = decoded.requestedAttributes.relyingPartyUserId;
158-
if (decoded.requestedAttributes.registrationLevel) extras.registrationLevel = decoded.requestedAttributes.registrationLevel;
159-
160-
if (decoded.requestedAttributes.allEmailAddresses) {
161-
extras.emailAddresses = [];
162-
decoded.requestedAttributes.allEmailAddresses.forEach((emailObject)=>{
163-
extras.emailAddresses.push(emailObject.emailAddress);
164-
})
165-
}
166-
if (decoded.requestedAttributes.allPhoneNumbers) {
167-
extras.phoneNumbers = [];
168-
decoded.requestedAttributes.allPhoneNumbers.forEach((phoneObject)=>{
169-
extras.phoneNumbers.push(phoneObject.phoneNumber);
170-
})
171-
}
172-
173-
if (decoded.requestedAttributes.ssn) {
174-
extras.ssnNumber = decoded.requestedAttributes.ssn.ssn;
175-
extras.ssnCountry = decoded.requestedAttributes.ssn.country;
151+
if (result.json.requestedAttributes.photo) {
152+
extras.photo = result.json.requestedAttributes.photo
176153
}
177154

178-
if (decoded.requestedAttributes.document) {
179-
extras.documentType = decoded.requestedAttributes.document.type;
180-
extras.documentCountry = decoded.requestedAttributes.document.country;
181-
extras.documentNumber = decoded.requestedAttributes.document.serialNumber;
182-
extras.documentExpiration = decoded.requestedAttributes.document.expirationDate;
183-
}
184-
185-
if (decoded.requestedAttributes.basicUserInfo) {
186-
firstname = decoded.requestedAttributes.basicUserInfo ? decoded.requestedAttributes.basicUserInfo.name : '',
187-
lastname = decoded.requestedAttributes.basicUserInfo ? decoded.requestedAttributes.basicUserInfo.surname : '',
188-
fullname = decoded.requestedAttributes.basicUserInfo ? decoded.requestedAttributes.basicUserInfo.name+' '+decoded.requestedAttributes.basicUserInfo.surname : ''
189-
}
155+
if (decoded.requestedAttributes) {
156+
if (decoded.requestedAttributes.age) extras.age = decoded.requestedAttributes.age;
157+
if (decoded.requestedAttributes.photoFileInfo) extras.photoHash = decoded.requestedAttributes.photoFileInfo.fileHash;
158+
if (decoded.requestedAttributes.dateOfBirth) extras.dateOfBirth = decoded.requestedAttributes.dateOfBirth;
159+
if (decoded.requestedAttributes.emailAddress) extras.primaryEmail = decoded.requestedAttributes.emailAddress;
160+
if (decoded.requestedAttributes.addresses) extras.addresses = decoded.requestedAttributes.addresses;
161+
if (decoded.requestedAttributes.customIdentifier) extras.customIdentifier = decoded.requestedAttributes.customIdentifier;
162+
if (decoded.requestedAttributes.relyingPartyUserId) extras.relyingPartyUserId = decoded.requestedAttributes.relyingPartyUserId;
163+
if (decoded.requestedAttributes.registrationLevel) extras.registrationLevel = decoded.requestedAttributes.registrationLevel;
164+
165+
if (decoded.requestedAttributes.allEmailAddresses) {
166+
extras.emailAddresses = [];
167+
decoded.requestedAttributes.allEmailAddresses.forEach((emailObject)=>{
168+
extras.emailAddresses.push(emailObject.emailAddress);
169+
})
170+
}
171+
if (decoded.requestedAttributes.allPhoneNumbers) {
172+
extras.phoneNumbers = [];
173+
decoded.requestedAttributes.allPhoneNumbers.forEach((phoneObject)=>{
174+
extras.phoneNumbers.push(phoneObject.phoneNumber);
175+
})
176+
if (extras.phoneNumbers.lenght>0) {
177+
extras.phoneNumber = extras.phoneNumber[0]
178+
}
179+
}
190180

181+
if (decoded.requestedAttributes.ssn) {
182+
extras.ssnNumber = decoded.requestedAttributes.ssn.ssn;
183+
extras.ssnCountry = decoded.requestedAttributes.ssn.country;
184+
}
185+
186+
if (decoded.requestedAttributes.document) {
187+
extras.documentType = decoded.requestedAttributes.document.type;
188+
extras.documentCountry = decoded.requestedAttributes.document.country;
189+
extras.documentNumber = decoded.requestedAttributes.document.serialNumber;
190+
extras.documentExpiration = decoded.requestedAttributes.document.expirationDate;
191+
}
192+
193+
if (decoded.requestedAttributes.basicUserInfo) {
194+
firstname = decoded.requestedAttributes.basicUserInfo ? decoded.requestedAttributes.basicUserInfo.name : '',
195+
lastname = decoded.requestedAttributes.basicUserInfo ? decoded.requestedAttributes.basicUserInfo.surname : '',
196+
fullname = decoded.requestedAttributes.basicUserInfo ? decoded.requestedAttributes.basicUserInfo.name+' '+decoded.requestedAttributes.basicUserInfo.surname : ''
197+
}
198+
}
191199

192200
return this._createCompletionMessage(id,firstname,lastname,fullname,extras);
193201

@@ -267,7 +275,7 @@ class FrejaEID extends BaseClient {
267275
}
268276

269277
async getOrgIdList() {
270-
var result = await this._httpRequest(`${this.settings.endpoint}/organisation/management/orgId/1.0/users/getAll`,{},this.relyingPartyId.slice(1));
278+
var result = await this._httpRequest(`${this.settings.endpoint}/organisation/management/orgId/1.0/users/getAll`,{method: 'POST'},this.relyingPartyId);
271279

272280
if (result.statusCode===599) {
273281
return this._createErrorMessage('internal_error',result.statusMessage);
@@ -337,6 +345,7 @@ class FrejaEID extends BaseClient {
337345
postData = "initSignRequest="+Buffer.from(JSON.stringify({
338346
attributesToReturn: this.settings.attribute_list,
339347
minRegistrationLevel: this.settings.minimumLevel,
348+
userConfirmationMethod: this.settings.userConfirmationMethod,
340349
userInfoType: infoType.userInfoType,
341350
userInfo: infoType.userInfo,
342351
signatureType: 'SIMPLE',
@@ -349,6 +358,7 @@ class FrejaEID extends BaseClient {
349358
postData = "initAuthRequest="+Buffer.from(JSON.stringify({
350359
attributesToReturn: this.settings.attribute_list,
351360
minRegistrationLevel: this.settings.minimumLevel,
361+
userConfirmationMethod: this.settings.userConfirmationMethod,
352362
userInfoType: infoType.userInfoType,
353363
userInfo: infoType.userInfo
354364
})).toString('base64');

Diff for: clients/frejaeid/readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ var config = {
5353
},
5454
// The minimum level to accept
5555
minimumLevel: 'EXTENDED',
56+
// Level to confirm user identity, DEFAULT or DEFAULT_AND_FACE
57+
userConfirmationMethod: 'DEFAULT',
5658
// Default country when calling identification with just an SSN
5759
default_country: 'SE',
5860
// The UserInfo field

Diff for: clients/frejaeid/settings.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = function(options) {
1414
'wSYLdhe93ToPR2X1UrNXxOg1juI': fs.readFileSync(path.join(__dirname,'/cert','prod_wSYLdhe93ToPR2X1UrNXxOg1juI.jwt'))
1515
},
1616
minimumLevel: 'EXTENDED',
17+
userConfirmationMethod: 'DEFAULT',
1718
default_country: 'SE',
1819
id_type: 'SSN',
1920
attribute_list: ['EMAIL_ADDRESS','RELYING_PARTY_USER_ID','BASIC_USER_INFO','SSN','ADDRESSES','DATE_OF_BIRTH','ALL_EMAIL_ADDRESSES'],
@@ -30,6 +31,7 @@ module.exports = function(options) {
3031
'DiZbzBfysUm6-IwI-GtienEsbjc': fs.readFileSync(path.join(__dirname,'/cert','test_DiZbzBfysUm6-IwI-GtienEsbjc.jwt'))
3132
},
3233
minimumLevel: 'EXTENDED',
34+
userConfirmationMethod: 'DEFAULT',
3335
password: 'test',
3436
default_country: 'SE',
3537
id_type: 'SSN',

Diff for: package-lock.json

+30-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eid",
3-
"version": "1.1.0",
3+
"version": "1.1.2",
44
"description": "Module for simple integration to electronic identities",
55
"bundleDependencies": false,
66
"deprecated": false,

Diff for: readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![NPM version](https://img.shields.io/npm/v/eid.svg?style=flat)
22
![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)
3-
![version](https://img.shields.io/badge/version-1.1.0-green.svg)
3+
![version](https://img.shields.io/badge/version-1.1.2-green.svg)
44
![maintained](https://img.shields.io/maintenance/yes/2024.svg)
55
[![maintainer](https://img.shields.io/badge/maintainer-dsorlov-blue.svg)](https://github.com/DSorlov)
66
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://img.shields.io/github/license/DSorlov/eid)

0 commit comments

Comments
 (0)