@digipair/skill-oauth2 0.94.0-8 → 0.95.1
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/index.cjs.js +82 -0
- package/index.d.ts +1 -0
- package/index.esm.js +68 -0
- package/{dist → libs/skill-oauth2}/src/index.d.ts +0 -1
- package/{dist → libs/skill-oauth2}/src/lib/skill-oauth2.d.ts +0 -1
- package/package.json +6 -20
- package/README.md +0 -7
- package/dist/index.cjs.js +0 -26220
- package/dist/index.esm.js +0 -26208
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/lib/skill-oauth2.d.ts.map +0 -1
- package/dist/src/lib/skill-oauth2.spec.d.ts +0 -2
- package/dist/src/lib/skill-oauth2.spec.d.ts.map +0 -1
- /package/{dist/index.d.ts → index.cjs.d.ts} +0 -0
- /package/{dist/schema.fr.json → schema.fr.json} +0 -0
- /package/{dist/schema.json → schema.json} +0 -0
package/index.cjs.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var simpleOauth2 = require('simple-oauth2');
|
|
6
|
+
|
|
7
|
+
let OAuth2Service = class OAuth2Service {
|
|
8
|
+
async authorizationCodeUrl(params, _pinsSettingsList, _context) {
|
|
9
|
+
const { config } = params;
|
|
10
|
+
const client = new simpleOauth2.AuthorizationCode(config);
|
|
11
|
+
return client.authorizeURL(config);
|
|
12
|
+
}
|
|
13
|
+
async authorizationCodeAccessToken(params, _pinsSettingsList, _context) {
|
|
14
|
+
const { config, tokenParams } = params;
|
|
15
|
+
const client = new simpleOauth2.AuthorizationCode(config);
|
|
16
|
+
return client.getToken(tokenParams);
|
|
17
|
+
}
|
|
18
|
+
async authorizationCodeCreateToken(params, _pinsSettingsList, _context) {
|
|
19
|
+
const { config, accessToken } = params;
|
|
20
|
+
const client = new simpleOauth2.AuthorizationCode(config);
|
|
21
|
+
return client.createToken(accessToken);
|
|
22
|
+
}
|
|
23
|
+
async resourceOwnerPasswordAccessToken(params, _pinsSettingsList, _context) {
|
|
24
|
+
const { config, tokenParams } = params;
|
|
25
|
+
const client = new simpleOauth2.ResourceOwnerPassword(config);
|
|
26
|
+
return client.getToken(tokenParams);
|
|
27
|
+
}
|
|
28
|
+
async resourceOwnerPasswordCreateToken(params, _pinsSettingsList, _context) {
|
|
29
|
+
const { config, accessToken } = params;
|
|
30
|
+
const client = new simpleOauth2.ResourceOwnerPassword(config);
|
|
31
|
+
return client.createToken(accessToken);
|
|
32
|
+
}
|
|
33
|
+
async clientCredentialsAccessToken(params, _pinsSettingsList, _context) {
|
|
34
|
+
const { config, tokenParams } = params;
|
|
35
|
+
const client = new simpleOauth2.ClientCredentials(config);
|
|
36
|
+
return client.getToken(tokenParams);
|
|
37
|
+
}
|
|
38
|
+
async clientCredentialsCreateToken(params, _pinsSettingsList, _context) {
|
|
39
|
+
const { config, accessToken } = params;
|
|
40
|
+
const client = new simpleOauth2.ClientCredentials(config);
|
|
41
|
+
return client.createToken(accessToken);
|
|
42
|
+
}
|
|
43
|
+
async tokenExpired(params, _pinsSettingsList, _context) {
|
|
44
|
+
const { token } = params;
|
|
45
|
+
return token.expired();
|
|
46
|
+
}
|
|
47
|
+
async tokenRefresh(params, _pinsSettingsList, _context) {
|
|
48
|
+
const { token } = params;
|
|
49
|
+
return token.refresh();
|
|
50
|
+
}
|
|
51
|
+
async tokenRevoke(params, _pinsSettingsList, _context) {
|
|
52
|
+
const { token, type } = params;
|
|
53
|
+
return token.revoke(type);
|
|
54
|
+
}
|
|
55
|
+
async tokenRevokeAll(params, _pinsSettingsList, _context) {
|
|
56
|
+
const { token } = params;
|
|
57
|
+
return token.revokeAll();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const authorizationCodeUrl = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeUrl(params, pinsSettingsList, context);
|
|
61
|
+
const authorizationCodeAccessTocken = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeAccessToken(params, pinsSettingsList, context);
|
|
62
|
+
const authorizationCodeCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeCreateToken(params, pinsSettingsList, context);
|
|
63
|
+
const resourceOwnerPasswordAccessToken = (params, pinsSettingsList, context)=>new OAuth2Service().resourceOwnerPasswordAccessToken(params, pinsSettingsList, context);
|
|
64
|
+
const resourceOwnerPasswordCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().resourceOwnerPasswordCreateToken(params, pinsSettingsList, context);
|
|
65
|
+
const clientCredentialsAccessToken = (params, pinsSettingsList, context)=>new OAuth2Service().clientCredentialsAccessToken(params, pinsSettingsList, context);
|
|
66
|
+
const clientCredentialsCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().clientCredentialsCreateToken(params, pinsSettingsList, context);
|
|
67
|
+
const tokenExpired = (params, pinsSettingsList, context)=>new OAuth2Service().tokenExpired(params, pinsSettingsList, context);
|
|
68
|
+
const tokenRefresh = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRefresh(params, pinsSettingsList, context);
|
|
69
|
+
const tokenRevoke = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRevoke(params, pinsSettingsList, context);
|
|
70
|
+
const tokenRevokeAll = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRevokeAll(params, pinsSettingsList, context);
|
|
71
|
+
|
|
72
|
+
exports.authorizationCodeAccessTocken = authorizationCodeAccessTocken;
|
|
73
|
+
exports.authorizationCodeCreateToken = authorizationCodeCreateToken;
|
|
74
|
+
exports.authorizationCodeUrl = authorizationCodeUrl;
|
|
75
|
+
exports.clientCredentialsAccessToken = clientCredentialsAccessToken;
|
|
76
|
+
exports.clientCredentialsCreateToken = clientCredentialsCreateToken;
|
|
77
|
+
exports.resourceOwnerPasswordAccessToken = resourceOwnerPasswordAccessToken;
|
|
78
|
+
exports.resourceOwnerPasswordCreateToken = resourceOwnerPasswordCreateToken;
|
|
79
|
+
exports.tokenExpired = tokenExpired;
|
|
80
|
+
exports.tokenRefresh = tokenRefresh;
|
|
81
|
+
exports.tokenRevoke = tokenRevoke;
|
|
82
|
+
exports.tokenRevokeAll = tokenRevokeAll;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './libs/skill-oauth2/src/index';
|
package/index.esm.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AuthorizationCode, ResourceOwnerPassword, ClientCredentials } from 'simple-oauth2';
|
|
2
|
+
|
|
3
|
+
let OAuth2Service = class OAuth2Service {
|
|
4
|
+
async authorizationCodeUrl(params, _pinsSettingsList, _context) {
|
|
5
|
+
const { config } = params;
|
|
6
|
+
const client = new AuthorizationCode(config);
|
|
7
|
+
return client.authorizeURL(config);
|
|
8
|
+
}
|
|
9
|
+
async authorizationCodeAccessToken(params, _pinsSettingsList, _context) {
|
|
10
|
+
const { config, tokenParams } = params;
|
|
11
|
+
const client = new AuthorizationCode(config);
|
|
12
|
+
return client.getToken(tokenParams);
|
|
13
|
+
}
|
|
14
|
+
async authorizationCodeCreateToken(params, _pinsSettingsList, _context) {
|
|
15
|
+
const { config, accessToken } = params;
|
|
16
|
+
const client = new AuthorizationCode(config);
|
|
17
|
+
return client.createToken(accessToken);
|
|
18
|
+
}
|
|
19
|
+
async resourceOwnerPasswordAccessToken(params, _pinsSettingsList, _context) {
|
|
20
|
+
const { config, tokenParams } = params;
|
|
21
|
+
const client = new ResourceOwnerPassword(config);
|
|
22
|
+
return client.getToken(tokenParams);
|
|
23
|
+
}
|
|
24
|
+
async resourceOwnerPasswordCreateToken(params, _pinsSettingsList, _context) {
|
|
25
|
+
const { config, accessToken } = params;
|
|
26
|
+
const client = new ResourceOwnerPassword(config);
|
|
27
|
+
return client.createToken(accessToken);
|
|
28
|
+
}
|
|
29
|
+
async clientCredentialsAccessToken(params, _pinsSettingsList, _context) {
|
|
30
|
+
const { config, tokenParams } = params;
|
|
31
|
+
const client = new ClientCredentials(config);
|
|
32
|
+
return client.getToken(tokenParams);
|
|
33
|
+
}
|
|
34
|
+
async clientCredentialsCreateToken(params, _pinsSettingsList, _context) {
|
|
35
|
+
const { config, accessToken } = params;
|
|
36
|
+
const client = new ClientCredentials(config);
|
|
37
|
+
return client.createToken(accessToken);
|
|
38
|
+
}
|
|
39
|
+
async tokenExpired(params, _pinsSettingsList, _context) {
|
|
40
|
+
const { token } = params;
|
|
41
|
+
return token.expired();
|
|
42
|
+
}
|
|
43
|
+
async tokenRefresh(params, _pinsSettingsList, _context) {
|
|
44
|
+
const { token } = params;
|
|
45
|
+
return token.refresh();
|
|
46
|
+
}
|
|
47
|
+
async tokenRevoke(params, _pinsSettingsList, _context) {
|
|
48
|
+
const { token, type } = params;
|
|
49
|
+
return token.revoke(type);
|
|
50
|
+
}
|
|
51
|
+
async tokenRevokeAll(params, _pinsSettingsList, _context) {
|
|
52
|
+
const { token } = params;
|
|
53
|
+
return token.revokeAll();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const authorizationCodeUrl = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeUrl(params, pinsSettingsList, context);
|
|
57
|
+
const authorizationCodeAccessTocken = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeAccessToken(params, pinsSettingsList, context);
|
|
58
|
+
const authorizationCodeCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().authorizationCodeCreateToken(params, pinsSettingsList, context);
|
|
59
|
+
const resourceOwnerPasswordAccessToken = (params, pinsSettingsList, context)=>new OAuth2Service().resourceOwnerPasswordAccessToken(params, pinsSettingsList, context);
|
|
60
|
+
const resourceOwnerPasswordCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().resourceOwnerPasswordCreateToken(params, pinsSettingsList, context);
|
|
61
|
+
const clientCredentialsAccessToken = (params, pinsSettingsList, context)=>new OAuth2Service().clientCredentialsAccessToken(params, pinsSettingsList, context);
|
|
62
|
+
const clientCredentialsCreateToken = (params, pinsSettingsList, context)=>new OAuth2Service().clientCredentialsCreateToken(params, pinsSettingsList, context);
|
|
63
|
+
const tokenExpired = (params, pinsSettingsList, context)=>new OAuth2Service().tokenExpired(params, pinsSettingsList, context);
|
|
64
|
+
const tokenRefresh = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRefresh(params, pinsSettingsList, context);
|
|
65
|
+
const tokenRevoke = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRevoke(params, pinsSettingsList, context);
|
|
66
|
+
const tokenRevokeAll = (params, pinsSettingsList, context)=>new OAuth2Service().tokenRevokeAll(params, pinsSettingsList, context);
|
|
67
|
+
|
|
68
|
+
export { authorizationCodeAccessTocken, authorizationCodeCreateToken, authorizationCodeUrl, clientCredentialsAccessToken, clientCredentialsCreateToken, resourceOwnerPasswordAccessToken, resourceOwnerPasswordCreateToken, tokenExpired, tokenRefresh, tokenRevoke, tokenRevokeAll };
|
|
@@ -10,4 +10,3 @@ export declare const tokenExpired: (params: any, pinsSettingsList: PinsSettings[
|
|
|
10
10
|
export declare const tokenRefresh: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
11
11
|
export declare const tokenRevoke: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
12
12
|
export declare const tokenRevokeAll: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
13
|
-
//# sourceMappingURL=skill-oauth2.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digipair/skill-oauth2",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "./dist/index.cjs.js",
|
|
5
|
-
"module": "./dist/index.esm.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
3
|
+
"version": "0.95.1",
|
|
7
4
|
"keywords": [
|
|
8
5
|
"digipair",
|
|
9
6
|
"service",
|
|
10
7
|
"tool"
|
|
11
8
|
],
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
".": {
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"import": "./dist/index.esm.js",
|
|
17
|
-
"default": "./dist/index.cjs.js"
|
|
18
|
-
}
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"simple-oauth2": "^5.1.0"
|
|
19
11
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
],
|
|
24
|
-
"nx": {
|
|
25
|
-
"name": "skill-oauth2"
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {}
|
|
28
|
-
}
|
|
12
|
+
"main": "./index.cjs.js",
|
|
13
|
+
"module": "./index.esm.js"
|
|
14
|
+
}
|