@edirect/oidc-client 3.2.4 → 11.0.28
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/README.md +39 -39
- package/dist/README.md +39 -0
- package/dist/package.json +23 -0
- package/dist/src/connect.d.ts +11 -0
- package/dist/src/connect.d.ts.map +1 -0
- package/dist/src/connect.js +33 -0
- package/dist/{grant-type → src/grant-type}/client_credentials.d.ts +16 -16
- package/dist/src/grant-type/client_credentials.d.ts.map +1 -0
- package/dist/src/grant-type/client_credentials.js +55 -0
- package/dist/{grant-type → src/grant-type}/password.d.ts +16 -14
- package/dist/src/grant-type/password.d.ts.map +1 -0
- package/dist/src/grant-type/password.js +92 -0
- package/dist/{grant-type → src/grant-type}/sso.d.ts +16 -14
- package/dist/src/grant-type/sso.d.ts.map +1 -0
- package/dist/src/grant-type/sso.js +92 -0
- package/dist/{index.d.ts → src/index.d.ts} +4 -3
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +20 -0
- package/dist/{token.d.ts → src/token.d.ts} +7 -6
- package/dist/src/token.d.ts.map +1 -0
- package/dist/{token.js → src/token.js} +22 -23
- package/dist/{types → src/types}/connect.type.d.ts +12 -12
- package/dist/src/types/connect.type.d.ts.map +1 -0
- package/dist/{types → src/types}/connect.type.js +2 -3
- package/dist/src/types/error-handler.type.d.ts +6 -0
- package/dist/src/types/error-handler.type.d.ts.map +1 -0
- package/dist/{types → src/types}/error-handler.type.js +2 -3
- package/dist/{types → src/types}/token-set.type.d.ts +22 -21
- package/dist/src/types/token-set.type.d.ts.map +1 -0
- package/dist/{types → src/types}/token-set.type.js +2 -3
- package/dist/{utils → src/utils}/error-handler.d.ts +6 -5
- package/dist/src/utils/error-handler.d.ts.map +1 -0
- package/dist/{utils → src/utils}/error-handler.js +12 -13
- package/dist/{utils → src/utils}/parse-token.d.ts +4 -3
- package/dist/src/utils/parse-token.d.ts.map +1 -0
- package/dist/{utils → src/utils}/parse-token.js +25 -26
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +40 -39
- package/.editorconfig +0 -14
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -46
- package/.husky/pre-commit +0 -4
- package/.husky/pre-push +0 -4
- package/.prettierrc.js +0 -6
- package/dist/connect.d.ts +0 -11
- package/dist/connect.js +0 -55
- package/dist/connect.js.map +0 -1
- package/dist/grant-type/client_credentials.js +0 -58
- package/dist/grant-type/client_credentials.js.map +0 -1
- package/dist/grant-type/password.js +0 -58
- package/dist/grant-type/password.js.map +0 -1
- package/dist/grant-type/sso.js +0 -65
- package/dist/grant-type/sso.js.map +0 -1
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -1
- package/dist/token.js.map +0 -1
- package/dist/types/connect.type.js.map +0 -1
- package/dist/types/error-handler.type.d.ts +0 -5
- package/dist/types/error-handler.type.js.map +0 -1
- package/dist/types/token-set.type.js.map +0 -1
- package/dist/utils/error-handler.js.map +0 -1
- package/dist/utils/parse-token.js.map +0 -1
package/dist/grant-type/sso.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.oidc = void 0;
|
|
16
|
-
const connect_1 = __importDefault(require("../connect"));
|
|
17
|
-
const parse_token_1 = __importDefault(require("../utils/parse-token"));
|
|
18
|
-
const grantType = 'sso';
|
|
19
|
-
class OidcClient extends connect_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
this.errorHandler = this.ErrorHandler(grantType);
|
|
23
|
-
}
|
|
24
|
-
connect({ baseUrl, oidcPath, clientId, clientSecret, redirectUri, }) {
|
|
25
|
-
return super.connect({
|
|
26
|
-
baseUrl,
|
|
27
|
-
oidcPath,
|
|
28
|
-
clientId,
|
|
29
|
-
clientSecret,
|
|
30
|
-
redirectUri,
|
|
31
|
-
responseTypes: ['none'],
|
|
32
|
-
grantTypes: ['sso', 'refresh_token'],
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
getAccessToken(data) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
try {
|
|
38
|
-
const params = Object.assign({ grant_type: 'sso' }, data);
|
|
39
|
-
return this.client
|
|
40
|
-
.grant(params)
|
|
41
|
-
.then((tokenSet) => (0, parse_token_1.default)(tokenSet))
|
|
42
|
-
.catch(this.errorHandler);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
getRefreshToken(tokenSet) {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
try {
|
|
52
|
-
const refreshTokenSet = yield this.client
|
|
53
|
-
.refresh(tokenSet.refreshToken)
|
|
54
|
-
.then((tokenSet) => (0, parse_token_1.default)(tokenSet))
|
|
55
|
-
.catch(this.errorHandler);
|
|
56
|
-
return refreshTokenSet;
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.oidc = new OidcClient();
|
|
65
|
-
//# sourceMappingURL=sso.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sso.js","sourceRoot":"","sources":["../../src/grant-type/sso.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,yDAAqC;AAIrC,uEAA8C;AAE9C,MAAM,SAAS,GAAG,KAAK,CAAC;AAExB,MAAM,UAAW,SAAQ,iBAAW;IAGlC;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,GACH;QACR,OAAO,KAAK,CAAC,OAAO,CAAC;YACnB,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,YAAY;YACZ,WAAW;YACX,aAAa,EAAE,CAAC,MAAM,CAAC;YACvB,UAAU,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC;SACrC,CAAC,CAAC;IACL,CAAC;IAEK,cAAc,CAClB,IAA6B;;YAE7B,IAAI;gBACF,MAAM,MAAM,mBACV,UAAU,EAAE,KAAK,IACd,IAAI,CACR,CAAC;gBAEF,OAAO,IAAI,CAAC,MAAM;qBACf,KAAK,CAAC,MAAM,CAAC;qBACb,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,QAA+B,CAAC,CAAC;qBAC/D,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAC7B;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,IAAI,CAAC;aACb;QACH,CAAC;KAAA;IAEK,eAAe,CAAC,QAAkB;;YACtC,IAAI;gBACF,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,MAAM;qBACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;qBAC9B,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,QAA+B,CAAC,CAAC;qBAC/D,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAE5B,OAAO,eAAe,CAAC;aACxB;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,IAAI,CAAC;aACb;QACH,CAAC;KAAA;CACF;AAEY,QAAA,IAAI,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const client_credentials_1 = require("./grant-type/client_credentials");
|
|
13
|
-
const password_1 = require("./grant-type/password");
|
|
14
|
-
const sso_1 = require("./grant-type/sso");
|
|
15
|
-
const clients = {
|
|
16
|
-
client_credentials: client_credentials_1.oidc,
|
|
17
|
-
password: password_1.oidc,
|
|
18
|
-
sso: sso_1.oidc,
|
|
19
|
-
};
|
|
20
|
-
exports.default = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
const oidc = clients[params.grantType];
|
|
22
|
-
yield oidc.connect({
|
|
23
|
-
baseUrl: params.baseUrl,
|
|
24
|
-
oidcPath: params.oidcPath,
|
|
25
|
-
clientId: params.clientId,
|
|
26
|
-
clientSecret: params.clientSecret,
|
|
27
|
-
});
|
|
28
|
-
return oidc;
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,wEAA6E;AAC7E,oDAAyD;AACzD,0CAA+C;AAE/C,MAAM,OAAO,GAAgC;IAC3C,kBAAkB,EAAlB,yBAAkB;IAClB,QAAQ,EAAR,eAAQ;IACR,GAAG,EAAH,UAAG;CACJ,CAAC;AAEF,kBAAe,CAAO,MAAe,EAAoB,EAAE;IACzD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,SAAmB,CAAC,CAAC;IAEjD,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/dist/token.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":";;;;;AACA,sEAA6C;AAE7C,MAAqB,KAAK;IAGxB,QAAQ,CAAC,KAAe,EAAE,MAAM,GAAG,KAAK;QACtC,IAAI,CAAC,KAAK,GAAG,IAAA,qBAAU,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ,CAAC,MAAM,GAAG,KAAK;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAE7B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAChE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAEpD,IAAI,SAAS,GAAG,EAAE,IAAI,GAAG;YAAE,OAAO,IAAI,CAAC;QAEvC,OAAO,CAAC,MAAM,IAAI,IAAA,qBAAU,EAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;IAClE,CAAC;CACF;AAnBD,wBAmBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect.type.js","sourceRoot":"","sources":["../../src/types/connect.type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.type.js","sourceRoot":"","sources":["../../src/types/error-handler.type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-set.type.js","sourceRoot":"","sources":["../../src/types/token-set.type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":";;AAAA,kBAAe,CAAC,SAAiB,EAAE,EAAE,CACnC,CAAC,KAA8C,EAAE,EAAE;IACjD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE3C,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG,EAAE;QACvB,MAAM,IAAI,KAAK,CACb,IAAI,SAAS,YAAY,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAC/D,CAAC;KACH;IAED,IAAI,OAAO,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,IAAI,SAAS,YAAY,OAAO,EAAE,CAAC,CAAC;KACrD;IAED,MAAM,KAAK,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-token.js","sourceRoot":"","sources":["../../src/utils/parse-token.ts"],"names":[],"mappings":";;AAMA,MAAM,WAAW,GAAuD;IACtE,WAAW,EAAE,cAAc;IAC3B,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;IACvB,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,eAAe;IAC7B,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,eAAe;IAC7B,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,kBAAe,CAAC,QAAkB,EAAE,MAAM,GAAG,KAAK,EAAY,EAAE;IAC9D,MAAM,cAAc,GAAG,EAAqC,CAAC;IAE7D,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAC7C,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,IAAI,WAAW,CAAC,SAAiC,CAAC,CAAC;YACrE,SAAS,CAAyB,CAAC;QACrC,MAAM,KAAK,GACT,CAAC,MAAM,IAAI,QAAQ,CAAC,SAAiC,CAAC,CAAC;YACvD,QAAQ,CAAC,WAAW,CAAC,SAAiC,CAAC,CAAC,CAAC;QAE3D,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SAC7B;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,cAA0B,CAAC;AACpC,CAAC,CAAC"}
|