@whook/oauth2 9.0.1 → 10.0.2
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 +20 -15
- package/dist/handlers/getOAuth2Authorize.d.ts +4 -4
- package/dist/handlers/getOAuth2Authorize.js +122 -165
- package/dist/handlers/getOAuth2Authorize.js.map +1 -1
- package/dist/handlers/getOAuth2Authorize.test.js +117 -103
- package/dist/handlers/getOAuth2Authorize.test.js.map +1 -1
- package/dist/handlers/postAuthLogin.d.ts +1 -1
- package/dist/handlers/postAuthLogin.js +83 -121
- package/dist/handlers/postAuthLogin.js.map +1 -1
- package/dist/handlers/postAuthLogin.test.js +42 -44
- package/dist/handlers/postAuthLogin.test.js.map +1 -1
- package/dist/handlers/postAuthLogout.d.ts +1 -1
- package/dist/handlers/postAuthLogout.js +26 -42
- package/dist/handlers/postAuthLogout.js.map +1 -1
- package/dist/handlers/postAuthLogout.test.js +19 -21
- package/dist/handlers/postAuthLogout.test.js.map +1 -1
- package/dist/handlers/postAuthRefresh.d.ts +1 -1
- package/dist/handlers/postAuthRefresh.js +93 -132
- package/dist/handlers/postAuthRefresh.js.map +1 -1
- package/dist/handlers/postAuthRefresh.test.js +47 -49
- package/dist/handlers/postAuthRefresh.test.js.map +1 -1
- package/dist/handlers/postOAuth2Acknowledge.d.ts +5 -5
- package/dist/handlers/postOAuth2Acknowledge.js +119 -151
- package/dist/handlers/postOAuth2Acknowledge.js.map +1 -1
- package/dist/handlers/postOAuth2Acknowledge.test.js +139 -125
- package/dist/handlers/postOAuth2Acknowledge.test.js.map +1 -1
- package/dist/handlers/postOAuth2Token.d.ts +1 -1
- package/dist/handlers/postOAuth2Token.js +200 -232
- package/dist/handlers/postOAuth2Token.js.map +1 -1
- package/dist/handlers/postOAuth2Token.test.js +156 -153
- package/dist/handlers/postOAuth2Token.test.js.map +1 -1
- package/dist/index.d.ts +15 -15
- package/dist/index.js +14 -229
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +697 -619
- package/dist/index.test.js.map +1 -1
- package/dist/services/authCookies.d.ts +1 -0
- package/dist/services/authCookies.js +40 -71
- package/dist/services/authCookies.js.map +1 -1
- package/dist/services/authCookies.test.js +57 -62
- package/dist/services/authCookies.test.js.map +1 -1
- package/dist/services/oAuth2ClientCredentialsGranter.d.ts +2 -2
- package/dist/services/oAuth2ClientCredentialsGranter.js +34 -52
- package/dist/services/oAuth2ClientCredentialsGranter.js.map +1 -1
- package/dist/services/oAuth2CodeGranter.d.ts +1 -1
- package/dist/services/oAuth2CodeGranter.js +66 -109
- package/dist/services/oAuth2CodeGranter.js.map +1 -1
- package/dist/services/oAuth2CodeGranter.test.js +65 -66
- package/dist/services/oAuth2CodeGranter.test.js.map +1 -1
- package/dist/services/oAuth2Granters.js +131 -138
- package/dist/services/oAuth2Granters.js.map +1 -1
- package/dist/services/oAuth2PasswordGranter.d.ts +1 -1
- package/dist/services/oAuth2PasswordGranter.js +27 -52
- package/dist/services/oAuth2PasswordGranter.js.map +1 -1
- package/dist/services/oAuth2RefreshTokenGranter.d.ts +1 -1
- package/dist/services/oAuth2RefreshTokenGranter.js +34 -58
- package/dist/services/oAuth2RefreshTokenGranter.js.map +1 -1
- package/dist/services/oAuth2TokenGranter.d.ts +1 -1
- package/dist/services/oAuth2TokenGranter.js +50 -86
- package/dist/services/oAuth2TokenGranter.js.map +1 -1
- package/package.json +46 -88
- package/src/__snapshots__/index.test.ts.snap +23 -22
- package/src/handlers/__snapshots__/postOAuth2Acknowledge.test.ts.snap +1 -1
- package/src/handlers/getOAuth2Authorize.test.ts +49 -13
- package/src/handlers/getOAuth2Authorize.ts +2 -2
- package/src/handlers/postAuthLogin.test.ts +9 -5
- package/src/handlers/postAuthLogin.ts +4 -4
- package/src/handlers/postAuthLogout.test.ts +8 -4
- package/src/handlers/postAuthLogout.ts +2 -2
- package/src/handlers/postAuthRefresh.test.ts +10 -6
- package/src/handlers/postAuthRefresh.ts +4 -4
- package/src/handlers/postOAuth2Acknowledge.test.ts +83 -35
- package/src/handlers/postOAuth2Acknowledge.ts +18 -8
- package/src/handlers/postOAuth2Token.test.ts +77 -17
- package/src/handlers/postOAuth2Token.ts +3 -3
- package/src/index.test.ts +110 -65
- package/src/index.ts +15 -15
- package/src/services/authCookies.test.ts +2 -2
- package/src/services/authCookies.ts +2 -1
- package/src/services/oAuth2ClientCredentialsGranter.ts +3 -3
- package/src/services/oAuth2CodeGranter.test.ts +27 -4
- package/src/services/oAuth2CodeGranter.ts +2 -2
- package/src/services/oAuth2PasswordGranter.ts +2 -2
- package/src/services/oAuth2RefreshTokenGranter.ts +2 -2
- package/src/services/oAuth2TokenGranter.ts +1 -1
- package/dist/handlers/getOAuth2Authorize.mjs +0 -160
- package/dist/handlers/getOAuth2Authorize.mjs.map +0 -1
- package/dist/handlers/getOAuth2Authorize.test.mjs +0 -114
- package/dist/handlers/getOAuth2Authorize.test.mjs.map +0 -1
- package/dist/handlers/postAuthLogin.mjs +0 -109
- package/dist/handlers/postAuthLogin.mjs.map +0 -1
- package/dist/handlers/postAuthLogin.test.mjs +0 -85
- package/dist/handlers/postAuthLogin.test.mjs.map +0 -1
- package/dist/handlers/postAuthLogout.mjs +0 -33
- package/dist/handlers/postAuthLogout.mjs.map +0 -1
- package/dist/handlers/postAuthLogout.test.mjs +0 -30
- package/dist/handlers/postAuthLogout.test.mjs.map +0 -1
- package/dist/handlers/postAuthRefresh.mjs +0 -122
- package/dist/handlers/postAuthRefresh.mjs.map +0 -1
- package/dist/handlers/postAuthRefresh.test.mjs +0 -94
- package/dist/handlers/postAuthRefresh.test.mjs.map +0 -1
- package/dist/handlers/postOAuth2Acknowledge.mjs +0 -150
- package/dist/handlers/postOAuth2Acknowledge.mjs.map +0 -1
- package/dist/handlers/postOAuth2Acknowledge.test.mjs +0 -140
- package/dist/handlers/postOAuth2Acknowledge.test.mjs.map +0 -1
- package/dist/handlers/postOAuth2Token.mjs +0 -231
- package/dist/handlers/postOAuth2Token.mjs.map +0 -1
- package/dist/handlers/postOAuth2Token.test.mjs +0 -160
- package/dist/handlers/postOAuth2Token.test.mjs.map +0 -1
- package/dist/index.mjs +0 -15
- package/dist/index.mjs.map +0 -1
- package/dist/index.test.mjs +0 -747
- package/dist/index.test.mjs.map +0 -1
- package/dist/services/authCookies.mjs +0 -58
- package/dist/services/authCookies.mjs.map +0 -1
- package/dist/services/authCookies.test.mjs +0 -77
- package/dist/services/authCookies.test.mjs.map +0 -1
- package/dist/services/oAuth2ClientCredentialsGranter.mjs +0 -41
- package/dist/services/oAuth2ClientCredentialsGranter.mjs.map +0 -1
- package/dist/services/oAuth2CodeGranter.mjs +0 -98
- package/dist/services/oAuth2CodeGranter.mjs.map +0 -1
- package/dist/services/oAuth2CodeGranter.test.mjs +0 -83
- package/dist/services/oAuth2CodeGranter.test.mjs.map +0 -1
- package/dist/services/oAuth2Granters.mjs +0 -127
- package/dist/services/oAuth2Granters.mjs.map +0 -1
- package/dist/services/oAuth2PasswordGranter.mjs +0 -40
- package/dist/services/oAuth2PasswordGranter.mjs.map +0 -1
- package/dist/services/oAuth2RefreshTokenGranter.mjs +0 -47
- package/dist/services/oAuth2RefreshTokenGranter.mjs.map +0 -1
- package/dist/services/oAuth2TokenGranter.mjs +0 -78
- package/dist/services/oAuth2TokenGranter.mjs.map +0 -1
|
@@ -1,153 +1,156 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _yerror = _interopRequireDefault(require("yerror"));
|
|
6
|
-
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
-
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import initPostOAuth2Token from './postOAuth2Token.js';
|
|
3
|
+
import { YError } from 'yerror';
|
|
9
4
|
describe('postOAuth2Token', () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
oAuth2RefreshToken.create.mockResolvedValueOnce({
|
|
91
|
-
token: 'a_refresh_token',
|
|
92
|
-
expiresAt: Date.parse('2180-03-06T00:00:00Z')
|
|
93
|
-
});
|
|
94
|
-
codeGranter.authorizer.authorize.mockResolvedValueOnce({
|
|
95
|
-
applicationId: ''
|
|
96
|
-
});
|
|
97
|
-
const postOAuth2Token = await (0, _postOAuth2Token.default)({
|
|
98
|
-
oAuth2Granters,
|
|
99
|
-
oAuth2AccessToken,
|
|
100
|
-
oAuth2RefreshToken,
|
|
101
|
-
time,
|
|
102
|
-
log
|
|
103
|
-
});
|
|
104
|
-
const response = await postOAuth2Token({
|
|
105
|
-
authenticationData: {
|
|
106
|
-
applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
|
|
107
|
-
scope: 'user'
|
|
108
|
-
},
|
|
109
|
-
body: {
|
|
110
|
-
grant_type: 'authorization_code',
|
|
111
|
-
code: '007',
|
|
112
|
-
client_id: 'abbacaca-abba-caca-abba-cacaabbacaca',
|
|
113
|
-
redirect_uri: 'http://lol'
|
|
114
|
-
}
|
|
5
|
+
const log = jest.fn();
|
|
6
|
+
const time = jest.fn();
|
|
7
|
+
const oAuth2AccessToken = {
|
|
8
|
+
create: jest.fn(),
|
|
9
|
+
check: jest.fn(),
|
|
10
|
+
};
|
|
11
|
+
const oAuth2RefreshToken = {
|
|
12
|
+
create: jest.fn(),
|
|
13
|
+
check: jest.fn(),
|
|
14
|
+
};
|
|
15
|
+
const codeGranter = {
|
|
16
|
+
type: 'code',
|
|
17
|
+
authorizer: {
|
|
18
|
+
responseType: 'code',
|
|
19
|
+
authorize: jest.fn(),
|
|
20
|
+
},
|
|
21
|
+
acknowledger: {
|
|
22
|
+
acknowledgmentType: 'code',
|
|
23
|
+
acknowledge: jest.fn(),
|
|
24
|
+
},
|
|
25
|
+
authenticator: {
|
|
26
|
+
grantType: 'authorization_code',
|
|
27
|
+
authenticate: jest.fn(),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const passwordGranter = {
|
|
31
|
+
type: 'password',
|
|
32
|
+
authenticator: {
|
|
33
|
+
grantType: 'password',
|
|
34
|
+
authenticate: jest.fn(),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const clientCredentialsGranter = {
|
|
38
|
+
type: 'client_credentials',
|
|
39
|
+
authenticator: {
|
|
40
|
+
grantType: 'client_credentials',
|
|
41
|
+
authenticate: jest.fn(),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const tokenGranter = {
|
|
45
|
+
type: 'token',
|
|
46
|
+
authorizer: {
|
|
47
|
+
responseType: 'token',
|
|
48
|
+
authorize: jest.fn(),
|
|
49
|
+
},
|
|
50
|
+
acknowledger: {
|
|
51
|
+
acknowledgmentType: 'token',
|
|
52
|
+
acknowledge: jest.fn(),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const refreshTokenGranter = {
|
|
56
|
+
type: 'refresh',
|
|
57
|
+
authenticator: {
|
|
58
|
+
grantType: 'refresh',
|
|
59
|
+
authenticate: jest.fn(),
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const oAuth2Granters = [
|
|
63
|
+
codeGranter,
|
|
64
|
+
tokenGranter,
|
|
65
|
+
passwordGranter,
|
|
66
|
+
refreshTokenGranter,
|
|
67
|
+
clientCredentialsGranter,
|
|
68
|
+
];
|
|
69
|
+
beforeEach(() => {
|
|
70
|
+
log.mockReset();
|
|
71
|
+
time.mockReset();
|
|
72
|
+
oAuth2AccessToken.create.mockReset();
|
|
73
|
+
oAuth2AccessToken.check.mockReset();
|
|
74
|
+
oAuth2RefreshToken.create.mockReset();
|
|
75
|
+
oAuth2RefreshToken.check.mockReset();
|
|
76
|
+
codeGranter.authorizer.authorize.mockReset();
|
|
77
|
+
codeGranter.acknowledger.acknowledge.mockReset();
|
|
78
|
+
codeGranter.authenticator.authenticate.mockReset();
|
|
79
|
+
tokenGranter.authorizer.authorize.mockReset();
|
|
80
|
+
tokenGranter.acknowledger.acknowledge.mockReset();
|
|
81
|
+
passwordGranter.authenticator.authenticate.mockReset();
|
|
82
|
+
refreshTokenGranter.authenticator.authenticate.mockReset();
|
|
83
|
+
clientCredentialsGranter.authenticator.authenticate.mockReset();
|
|
115
84
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
85
|
+
test('should create a token', async () => {
|
|
86
|
+
time.mockReturnValue(new Date('2010-03-06T00:00:00Z').getTime());
|
|
87
|
+
oAuth2AccessToken.create.mockResolvedValueOnce({
|
|
88
|
+
token: 'an_access_token',
|
|
89
|
+
expiresAt: Date.parse('2010-03-07T00:00:00Z'),
|
|
90
|
+
});
|
|
91
|
+
oAuth2RefreshToken.create.mockResolvedValueOnce({
|
|
92
|
+
token: 'a_refresh_token',
|
|
93
|
+
expiresAt: Date.parse('2180-03-06T00:00:00Z'),
|
|
94
|
+
});
|
|
95
|
+
codeGranter.authorizer.authorize.mockResolvedValueOnce({
|
|
96
|
+
applicationId: '',
|
|
97
|
+
redirectURI: 'http://lol',
|
|
98
|
+
scope: 'user,admin',
|
|
99
|
+
});
|
|
100
|
+
const postOAuth2Token = await initPostOAuth2Token({
|
|
101
|
+
oAuth2Granters,
|
|
102
|
+
oAuth2AccessToken,
|
|
103
|
+
oAuth2RefreshToken,
|
|
104
|
+
time,
|
|
105
|
+
log,
|
|
106
|
+
});
|
|
107
|
+
const response = await postOAuth2Token({
|
|
108
|
+
authenticationData: {
|
|
109
|
+
applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
|
|
110
|
+
scope: 'user',
|
|
111
|
+
},
|
|
112
|
+
body: {
|
|
113
|
+
grant_type: 'authorization_code',
|
|
114
|
+
code: '007',
|
|
115
|
+
client_id: 'abbacaca-abba-caca-abba-cacaabbacaca',
|
|
116
|
+
redirect_uri: 'http://lol',
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
expect({
|
|
120
|
+
response,
|
|
121
|
+
oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,
|
|
122
|
+
oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,
|
|
123
|
+
logCalls: log.mock.calls.filter(([type]) => !type.endsWith('stack')),
|
|
124
|
+
}).toMatchSnapshot();
|
|
130
125
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
126
|
+
test('should fail with a bad grant type', async () => {
|
|
127
|
+
const postOAuth2Token = await initPostOAuth2Token({
|
|
128
|
+
oAuth2Granters,
|
|
129
|
+
oAuth2AccessToken,
|
|
130
|
+
oAuth2RefreshToken,
|
|
131
|
+
time,
|
|
132
|
+
log,
|
|
133
|
+
});
|
|
134
|
+
try {
|
|
135
|
+
await postOAuth2Token({
|
|
136
|
+
authenticationData: {
|
|
137
|
+
applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
|
|
138
|
+
scope: 'user',
|
|
139
|
+
},
|
|
140
|
+
body: {
|
|
141
|
+
grant_type: 'yolo',
|
|
142
|
+
code: '007',
|
|
143
|
+
client_id: 'abbacaca-abba-caca-abba-cacaabbacaca',
|
|
144
|
+
redirect_uri: 'http://lol',
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
throw new YError('E_UNEXPECTED_SUCCESS');
|
|
143
148
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
errorParams: err.params
|
|
150
|
-
}).toMatchInlineSnapshot(`
|
|
149
|
+
catch (err) {
|
|
150
|
+
expect({
|
|
151
|
+
errorCode: err.code,
|
|
152
|
+
errorParams: err.params,
|
|
153
|
+
}).toMatchInlineSnapshot(`
|
|
151
154
|
Object {
|
|
152
155
|
"errorCode": "E_UNKNOWN_AUTHENTICATOR_TYPE",
|
|
153
156
|
"errorParams": Array [
|
|
@@ -155,12 +158,12 @@ describe('postOAuth2Token', () => {
|
|
|
155
158
|
],
|
|
156
159
|
}
|
|
157
160
|
`);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
expect({
|
|
162
|
+
oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,
|
|
163
|
+
oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,
|
|
164
|
+
logCalls: log.mock.calls.filter(([type]) => !type.endsWith('stack')),
|
|
165
|
+
}).toMatchSnapshot();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
165
168
|
});
|
|
166
169
|
//# sourceMappingURL=postOAuth2Token.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postOAuth2Token.test.js","
|
|
1
|
+
{"version":3,"file":"postOAuth2Token.test.js","sourceRoot":"","sources":["../../src/handlers/postOAuth2Token.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,mBAAmB,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAYhC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,EAAc,CAAC;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,EAAe,CAAC;IACpC,MAAM,iBAAiB,GAAG;QACxB,MAAM,EAAE,IAAI,CAAC,EAAE,EAAsC;QACrD,KAAK,EAAE,IAAI,CAAC,EAAE,EAAqC;KACpD,CAAC;IACF,MAAM,kBAAkB,GAAG;QACzB,MAAM,EAAE,IAAI,CAAC,EAAE,EAAuC;QACtD,KAAK,EAAE,IAAI,CAAC,EAAE,EAAsC;KACrD,CAAC;IACF,MAAM,WAAW,GAAG;QAClB,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE;YACV,YAAY,EAAE,MAAM;YACpB,SAAS,EACP,IAAI,CAAC,EAAE,EAEJ;SACN;QACD,YAAY,EAAE;YACZ,kBAAkB,EAAE,MAAM;YAC1B,WAAW,EACT,IAAI,CAAC,EAAE,EAEJ;SACN;QACD,aAAa,EAAE;YACb,SAAS,EAAE,oBAAoB;YAC/B,YAAY,EACV,IAAI,CAA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iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;gBACjE,6BAA6B,EAAE,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;gBACnE,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;aACrE,CAAC,CAAC,eAAe,EAAE,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import initGetOAuth2Authorize, { definition as getOAuth2AuthorizeDefinition, responseTypeParameter as getOAuth2AuthorizeResponseTypeParameter, clientIdParameter as getOAuth2AuthorizeClientIdParameter, redirectURIParameter as getOAuth2AuthorizeRedirectURIParameter, scopeParameter as getOAuth2AuthorizeScopeParameter, stateParameter as getOAuth2AuthorizeStateParameter } from './handlers/getOAuth2Authorize';
|
|
2
|
-
import initPostOAuth2Acknowledge, { definition as postOAuth2AcknowledgeDefinition } from './handlers/postOAuth2Acknowledge';
|
|
3
|
-
import initPostOAuth2Token, { definition as postOAuth2TokenDefinition, authorizationCodeTokenRequestBodySchema as postOAuth2TokenAuthorizationCodeTokenRequestBodySchema, passwordTokenRequestBodySchema as postOAuth2TokenPasswordTokenRequestBodySchema, clientCredentialsTokenRequestBodySchema as postOAuth2TokenClientCredentialsTokenRequestBodySchema, refreshTokenRequestBodySchema as postOAuth2TokenRefreshTokenRequestBodySchema, tokenBodySchema as postOAuth2TokenTokenBodySchema } from './handlers/postOAuth2Token';
|
|
4
|
-
import initOAuth2Granters, { OAUTH2_ERRORS_DESCRIPTORS } from './services/oAuth2Granters';
|
|
5
|
-
import initOAuth2ClientCredentialsGranter from './services/oAuth2ClientCredentialsGranter';
|
|
6
|
-
import initOAuth2CodeGranter from './services/oAuth2CodeGranter';
|
|
7
|
-
import initOAuth2PasswordGranter from './services/oAuth2PasswordGranter';
|
|
8
|
-
import initOAuth2RefreshTokenGranter from './services/oAuth2RefreshTokenGranter';
|
|
9
|
-
import initOAuth2TokenGranter from './services/oAuth2TokenGranter';
|
|
10
|
-
import type { OAuth2CodeService, OAuth2PasswordService, OAuth2AccessTokenService, OAuth2RefreshTokenService, CheckApplicationService, OAuth2GranterService, OAuth2Options, OAuth2Config } from './services/oAuth2Granters';
|
|
11
|
-
import initPostAuthLogin, { definition as postAuthLoginDefinition } from './handlers/postAuthLogin';
|
|
12
|
-
import initPostAuthLogout, { definition as postAuthLogoutDefinition } from './handlers/postAuthLogout';
|
|
13
|
-
import initPostAuthRefresh, { authCookieHeaderParameter, definition as postAuthRefreshDefinition } from './handlers/postAuthRefresh';
|
|
14
|
-
import initAuthCookiesService, { AUTH_API_PREFIX } from './services/authCookies';
|
|
15
|
-
import type { AuthCookiesEnv, AuthCookiesConfig, AuthCookiesService, AuthCookiesData, AuthHandlersConfig } from './services/authCookies';
|
|
1
|
+
import initGetOAuth2Authorize, { definition as getOAuth2AuthorizeDefinition, responseTypeParameter as getOAuth2AuthorizeResponseTypeParameter, clientIdParameter as getOAuth2AuthorizeClientIdParameter, redirectURIParameter as getOAuth2AuthorizeRedirectURIParameter, scopeParameter as getOAuth2AuthorizeScopeParameter, stateParameter as getOAuth2AuthorizeStateParameter } from './handlers/getOAuth2Authorize.js';
|
|
2
|
+
import initPostOAuth2Acknowledge, { definition as postOAuth2AcknowledgeDefinition } from './handlers/postOAuth2Acknowledge.js';
|
|
3
|
+
import initPostOAuth2Token, { definition as postOAuth2TokenDefinition, authorizationCodeTokenRequestBodySchema as postOAuth2TokenAuthorizationCodeTokenRequestBodySchema, passwordTokenRequestBodySchema as postOAuth2TokenPasswordTokenRequestBodySchema, clientCredentialsTokenRequestBodySchema as postOAuth2TokenClientCredentialsTokenRequestBodySchema, refreshTokenRequestBodySchema as postOAuth2TokenRefreshTokenRequestBodySchema, tokenBodySchema as postOAuth2TokenTokenBodySchema } from './handlers/postOAuth2Token.js';
|
|
4
|
+
import initOAuth2Granters, { OAUTH2_ERRORS_DESCRIPTORS } from './services/oAuth2Granters.js';
|
|
5
|
+
import initOAuth2ClientCredentialsGranter from './services/oAuth2ClientCredentialsGranter.js';
|
|
6
|
+
import initOAuth2CodeGranter from './services/oAuth2CodeGranter.js';
|
|
7
|
+
import initOAuth2PasswordGranter from './services/oAuth2PasswordGranter.js';
|
|
8
|
+
import initOAuth2RefreshTokenGranter from './services/oAuth2RefreshTokenGranter.js';
|
|
9
|
+
import initOAuth2TokenGranter from './services/oAuth2TokenGranter.js';
|
|
10
|
+
import type { OAuth2CodeService, OAuth2PasswordService, OAuth2AccessTokenService, OAuth2RefreshTokenService, CheckApplicationService, OAuth2GranterService, OAuth2Options, OAuth2Config } from './services/oAuth2Granters.js';
|
|
11
|
+
import initPostAuthLogin, { definition as postAuthLoginDefinition } from './handlers/postAuthLogin.js';
|
|
12
|
+
import initPostAuthLogout, { definition as postAuthLogoutDefinition } from './handlers/postAuthLogout.js';
|
|
13
|
+
import initPostAuthRefresh, { authCookieHeaderParameter, definition as postAuthRefreshDefinition } from './handlers/postAuthRefresh.js';
|
|
14
|
+
import initAuthCookiesService, { AUTH_API_PREFIX } from './services/authCookies.js';
|
|
15
|
+
import type { AuthCookiesEnv, AuthCookiesConfig, AuthCookiesService, AuthCookiesData, AuthHandlersConfig } from './services/authCookies.js';
|
|
16
16
|
export type { OAuth2CodeService, OAuth2PasswordService, OAuth2AccessTokenService, OAuth2RefreshTokenService, CheckApplicationService, OAuth2GranterService, OAuth2Options, OAuth2Config, AuthCookiesEnv, AuthCookiesConfig, AuthCookiesService, AuthCookiesData, AuthHandlersConfig, };
|
|
17
17
|
export { initGetOAuth2Authorize, getOAuth2AuthorizeDefinition, getOAuth2AuthorizeResponseTypeParameter, getOAuth2AuthorizeClientIdParameter, getOAuth2AuthorizeRedirectURIParameter, getOAuth2AuthorizeScopeParameter, getOAuth2AuthorizeStateParameter, initPostOAuth2Acknowledge, postOAuth2AcknowledgeDefinition, initPostOAuth2Token, postOAuth2TokenDefinition, postOAuth2TokenAuthorizationCodeTokenRequestBodySchema, postOAuth2TokenPasswordTokenRequestBodySchema, postOAuth2TokenClientCredentialsTokenRequestBodySchema, postOAuth2TokenRefreshTokenRequestBodySchema, postOAuth2TokenTokenBodySchema, OAUTH2_ERRORS_DESCRIPTORS, initOAuth2Granters, initOAuth2ClientCredentialsGranter, initOAuth2CodeGranter, initOAuth2PasswordGranter, initOAuth2RefreshTokenGranter, initOAuth2TokenGranter, AUTH_API_PREFIX, authCookieHeaderParameter, initPostAuthLogin, postAuthLoginDefinition, initPostAuthLogout, postAuthLogoutDefinition, initPostAuthRefresh, postAuthRefreshDefinition, initAuthCookiesService, };
|