@edirect/oidc-client 3.0.0 → 3.1.0
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/dist/connect.js +33 -21
- package/dist/connect.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/connect.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -7,32 +16,35 @@ const openid_client_1 = require("openid-client");
|
|
|
7
16
|
const http_1 = __importDefault(require("http"));
|
|
8
17
|
const https_1 = __importDefault(require("https"));
|
|
9
18
|
const error_handler_1 = __importDefault(require("./utils/error-handler"));
|
|
10
|
-
const httpAgent = new http_1.default.Agent({ keepAlive: true });
|
|
11
|
-
const httpsAgent = new https_1.default.Agent({ keepAlive: true });
|
|
12
19
|
class OidcConnect {
|
|
13
20
|
constructor() {
|
|
14
21
|
this.ErrorHandler = error_handler_1.default;
|
|
15
22
|
}
|
|
16
23
|
connect({ baseUrl, oidcPath, clientId, clientSecret, redirectUri, responseTypes, grantTypes, timeout, }) {
|
|
17
|
-
this
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
this.baseUrl = baseUrl;
|
|
26
|
+
this.redirectUri = redirectUri;
|
|
27
|
+
const oidcConfiguration = {
|
|
28
|
+
client_id: clientId,
|
|
29
|
+
client_secret: clientSecret,
|
|
30
|
+
redirect_uris: [redirectUri],
|
|
31
|
+
response_types: responseTypes,
|
|
32
|
+
grant_types: grantTypes,
|
|
33
|
+
};
|
|
34
|
+
const protocol = (baseUrl.includes('https') && 'https:') || 'http:';
|
|
35
|
+
if (openid_client_1.custom && openid_client_1.custom.setHttpOptionsDefaults) {
|
|
36
|
+
openid_client_1.custom.setHttpOptionsDefaults({
|
|
37
|
+
timeout: timeout || 60000,
|
|
38
|
+
protocol,
|
|
39
|
+
agent: {
|
|
40
|
+
http: new http_1.default.Agent({ keepAlive: true }),
|
|
41
|
+
https: baseUrl.includes('https')
|
|
42
|
+
? new https_1.default.Agent({ keepAlive: true })
|
|
43
|
+
: undefined,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const oidcIssuer = yield openid_client_1.Issuer.discover(`${baseUrl}/${oidcPath}`);
|
|
36
48
|
this.client = new oidcIssuer.Client(oidcConfiguration);
|
|
37
49
|
return this.client;
|
|
38
50
|
});
|
package/dist/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iDAAuE;AACvE,gDAAwB;AACxB,kDAA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AAC,MAAM,CAAC;QACrB,CAAC;KAAA;CACF;AAlDD,8BAkDC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kBAAe,CAAO,MAAe,EAAoB,EAAE;IACzD,MAAM,EAAE,IAAI,EAAE,GAAG,wDAAa,gBAAgB,MAAM,CAAC,SAAS,EAAE,GAAC,CAAC;IAElE,MAAM,IAAI,CAAC,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,YAAY,EAAE,MAAM,CAAC,YAAY;KAClC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edirect/oidc-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "OpenId Connect Client",
|
|
5
5
|
"author": "Bolttech <devs@bolttech.io>",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"eslint": "eslint --fix \"./src/**/*.ts\""
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"openid-client": "^
|
|
21
|
+
"openid-client": "^4.9.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^17.0.12",
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
"pre-push": "npm run build"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|