Skip to content

Commit 9d0efcf

Browse files
authored
Merge pull request #10 from DSorlov/dev
0.1.7
2 parents 982fa98 + 0871762 commit 9d0efcf

13 files changed

+349
-11
lines changed

Diff for: changelog.md

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog][keep-a-changelog]
66
## [Unreleased]
77
- Nothing right now
88

9+
## [0.1.7] (2020-09-02)
10+
11+
### Added
12+
- Added IDKollen API provider (idkbankid)
13+
14+
### Fixed
15+
- Added error handling on internal errors when following requests, should create more stable library (all modules).
16+
- Verified API and updated settings for Funktionstjänster (CGI) Freja eID module (ftfrejaeid)
17+
918
## [0.1.5] (2020-09-01)
1019

1120
### Fixed
@@ -63,6 +72,7 @@ The format is based on [Keep a Changelog][keep-a-changelog]
6372

6473
[keep-a-changelog]: http://keepachangelog.com/en/1.0.0/
6574
[Unreleased]: https://github.com/DSorlov/eid-provider/compare/master...dev
75+
[0.1.7]: https://github.com/DSorlov/eid-provider/releases/tag/v0.1.7
6676
[0.1.5]: https://github.com/DSorlov/eid-provider/releases/tag/v0.1.5
6777
[0.1.4]: https://github.com/DSorlov/eid-provider/releases/tag/v0.1.4
6878
[0.1.3]: https://github.com/DSorlov/eid-provider/releases/tag/v0.1.3

Diff for: docs/idkbankid.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## BankID (bankid)
2+
3+
### Description
4+
This module lets you communicate and use the IDKollen V2 API.
5+
6+
To use IDKollen API (both test and production) you will need to contact
7+
IDKollen to obtain a key. See (https://idkollen.se/)[https://idkollen.se/]
8+
9+
Due to the API beeing a call-back API a postback endpoint is created
10+
for each request using https://webhook.site/ and a temporary endpoint,
11+
the endpoint deletes once there response is received. You do not need
12+
Webhook Premium, but if you are using it you can make sure your urls
13+
and data are deleted as appropiate and that no limts are imposed.
14+
15+
### Inputs and outputs
16+
17+
**Alternative inputs**
18+
19+
Also accepts objects with `ssn` (Social Security Number) property.
20+
21+
**Extra fields on completion**
22+
* `autostart_token` the token used for autostart
23+
* `autostart_url` code for invoking authorization
24+
25+
### Default Configuration
26+
>**Default production configuration (settings.production)**
27+
```
28+
endpoint: 'https://api.idkollen.se/v2',
29+
key: '',
30+
webhookkey: ''
31+
```
32+
>**Default testing configuration (settings.testing)**
33+
```
34+
endpoint: 'https://stgapi.idkollen.se/v2',
35+
key: '',
36+
webhookkey: ''
37+
```

Diff for: modules/bankid.js

+4
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ async function followRequest(self,initresp, initcallback=undefined, statuscallba
152152
// Retreive current status
153153
const [error, pollresp] = await to(pollStatus(initresp.id,self));
154154

155+
if (error) {
156+
return {status: 'error', code: 'system_error', description: 'Internal module error', details: error.message}
157+
}
158+
155159
// Check if we we have a definite answer
156160
if (pollresp.status==='completed'||pollresp.status==='error') { return pollresp; }
157161

Diff for: modules/frejaeid.js

+4
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ async function followRequest(self, pollMethod, initresp, initcallback=undefined,
269269

270270
const [error, pollresp] = pollMethod=='auth' ? await to(self.pollAuthStatus(initresp.id,self)) : await to(self.pollSignStatus(initresp.id,self))
271271

272+
if (error) {
273+
return {status: 'error', code: 'system_error', description: 'Internal module error', details: error.message}
274+
}
275+
272276
// Check if we we have a definite answer
273277
if (pollresp.status==='completed'||pollresp.status==='error') { return pollresp; }
274278

Diff for: modules/frejaorgid.js

+4
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ async function followRequest(self, pollMethod, initresp, initcallback=undefined,
321321
if (pollMethod=='sign') [error, pollresp] = await to(self.pollSignStatus(initresp.id,self));
322322
if (pollMethod=='add') [error, pollresp] = await to(self.pollAddOrgIdStatus(initresp.id,self));
323323

324+
if (error) {
325+
return {status: 'error', code: 'system_error', description: 'Internal module error', details: error.message}
326+
}
327+
324328
// Check if we we have a definite answer
325329
if (pollresp.status==='completed'||pollresp.status==='error'||pollresp.status==='created') { return pollresp; }
326330

Diff for: modules/ftbankid.js

+4
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ async function followRequest(self,initresp, initcallback=undefined, statuscallba
184184
// Retreive current status
185185
const [error, pollresp] = await to(pollStatus(initresp.id,self));
186186

187+
if (error) {
188+
return {status: 'error', code: 'system_error', description: 'Internal module error', details: error.message}
189+
}
190+
187191
// Check if we we have a definite answer
188192
if (pollresp.status==='completed'||pollresp.status==='error') { return pollresp; }
189193

Diff for: modules/ftfrejaeid.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ function createClient(self,uri,method,options) {
8787

8888
async function pollStatus(id,self=this) {
8989

90-
if (id.length!=73) {
90+
if (id.length!=102) {
9191
return {status: 'error', code: 'request_id_invalid', description: 'The supplied request cannot be found'};
9292
}
9393

94-
var orderRef = id.substring(37,73);
94+
var orderRef = id.substring(37,102);
9595
var transactionId = id.substring(0,36);
9696

9797
var [error,result] = await to(createClient(self,'GrpServicePortType/CollectRequest', 'Collect', {
@@ -138,11 +138,10 @@ async function pollStatus(id,self=this) {
138138
ssn: result.userInfo.subjectIdentifier,
139139
firstname: result.userInfo.givenName,
140140
surname: result.userInfo.sn,
141-
fullname: result.userInfo.displayName
141+
fullname: result.userInfo.givenName + ' ' + result.userInfo.sn
142142
},
143143
extra: {
144-
signature: result.validationInfo.signature,
145-
ocspResponse: result.validationInfo.ocspResponse}
144+
signature: result.validationInfo.signature}
146145
};
147146
default:
148147
return {status: 'error', code: 'api_error', description: 'A communications error occured', details: result.data};
@@ -183,6 +182,10 @@ async function followRequest(self,initresp, initcallback=undefined, statuscallba
183182
// Retreive current status
184183
const [error, pollresp] = await to(pollStatus(initresp.id,self));
185184

185+
if (error) {
186+
return {status: 'error', code: 'system_error', description: 'Internal module error', details: error.message}
187+
}
188+
186189
// Check if we we have a definite answer
187190
if (pollresp.status==='completed'||pollresp.status==='error') { return pollresp; }
188191

Diff for: modules/gbankid.js

+4
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ async function followRequest(self,initresp, initcallback=undefined, statuscallba
152152
// Retreive current status
153153
const [error, pollresp] = await to(self.pollAuthStatus(initresp.id));
154154

155+
if (error) {
156+
return {status: 'error', code: 'system_error', description: 'Internal module error', details: error.message}
157+
}
158+
155159
// Check if we we have a definite answer
156160
if (pollresp.status==='completed'||pollresp.status==='error') { return pollresp; }
157161

Diff for: modules/gfrejaeid.js

+4
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ async function followRequest(self, initresp, initcallback=undefined, statuscallb
8282
// Retreive current status
8383
const [error, pollresp] = await to(pollStatus(initresp.id,self));
8484

85+
if (error) {
86+
return {status: 'error', code: 'system_error', description: 'Internal module error', details: error.message}
87+
}
88+
8589
// Check if we we have a definite answer
8690
if (pollresp.status==='completed'||pollresp.status==='error') { return pollresp; }
8791

Diff for: modules/ghsaid.js

+4
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ async function followRequest(self,initresp, initcallback=undefined, statuscallba
148148
// Retreive current status
149149
const [error, pollresp] = await to(self.pollAuthStatus(initresp.id));
150150

151+
if (error) {
152+
return {status: 'error', code: 'system_error', description: 'Internal module error', details: error.message}
153+
}
154+
151155
// Check if we we have a definite answer
152156
if (pollresp.status==='completed'||pollresp.status==='error') { return pollresp; }
153157

0 commit comments

Comments
 (0)