@whook/oauth2 25.2.0 → 26.0.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/README.md +147 -98
- package/dist/index.d.ts +30 -11
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +1258 -399
- package/dist/index.test.js.map +1 -1
- package/dist/libs/clients.d.ts +2 -0
- package/dist/libs/clients.js +13 -0
- package/dist/libs/clients.js.map +1 -0
- package/dist/libs/errors.d.ts +113 -0
- package/dist/libs/errors.js +178 -0
- package/dist/libs/errors.js.map +1 -0
- package/dist/libs/grants.d.ts +2 -0
- package/dist/libs/grants.js +10 -0
- package/dist/libs/grants.js.map +1 -0
- package/dist/libs/redirectURI.d.ts +7 -0
- package/dist/libs/redirectURI.js +78 -0
- package/dist/libs/redirectURI.js.map +1 -0
- package/dist/libs/schemas.d.ts +23 -0
- package/dist/libs/schemas.js +25 -0
- package/dist/libs/schemas.js.map +1 -0
- package/dist/libs/scopes.d.ts +16 -0
- package/dist/libs/scopes.js +37 -0
- package/dist/libs/scopes.js.map +1 -1
- package/dist/libs/utils.d.ts +2 -0
- package/dist/libs/utils.js +17 -0
- package/dist/libs/utils.js.map +1 -0
- package/dist/libs/verifier.d.ts +7 -0
- package/dist/libs/verifier.js +37 -0
- package/dist/libs/verifier.js.map +1 -0
- package/dist/libs/verifier.test.js +21 -0
- package/dist/libs/verifier.test.js.map +1 -0
- package/dist/routes/getOAuth2Authorize.d.ts +13 -50
- package/dist/routes/getOAuth2Authorize.js +60 -86
- package/dist/routes/getOAuth2Authorize.js.map +1 -1
- package/dist/routes/getOAuth2Authorize.test.js +147 -68
- package/dist/routes/getOAuth2Authorize.test.js.map +1 -1
- package/dist/routes/getOAuth2WellKnownMetadata.d.ts +8 -8
- package/dist/routes/getOAuth2WellKnownMetadata.js +20 -9
- package/dist/routes/getOAuth2WellKnownMetadata.js.map +1 -1
- package/dist/routes/getOAuth2WellKnownMetadata.test.js +38 -37
- package/dist/routes/getOAuth2WellKnownMetadata.test.js.map +1 -1
- package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.d.ts +3 -6
- package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.js +3 -6
- package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.js.map +1 -1
- package/dist/routes/postAuthLogin.d.ts +14 -9
- package/dist/routes/postAuthLogin.js +10 -5
- package/dist/routes/postAuthLogin.js.map +1 -1
- package/dist/routes/postAuthLogin.test.js +79 -55
- package/dist/routes/postAuthLogin.test.js.map +1 -1
- package/dist/routes/postAuthLogout.d.ts +5 -2
- package/dist/routes/postAuthLogout.js +12 -7
- package/dist/routes/postAuthLogout.js.map +1 -1
- package/dist/routes/postAuthLogout.test.js +35 -17
- package/dist/routes/postAuthLogout.test.js.map +1 -1
- package/dist/routes/postAuthRefresh.d.ts +14 -9
- package/dist/routes/postAuthRefresh.js +10 -6
- package/dist/routes/postAuthRefresh.js.map +1 -1
- package/dist/routes/postAuthRefresh.test.js +90 -59
- package/dist/routes/postAuthRefresh.test.js.map +1 -1
- package/dist/routes/postOAuth2Acknowledge.d.ts +20 -10
- package/dist/routes/postOAuth2Acknowledge.js +54 -38
- package/dist/routes/postOAuth2Acknowledge.js.map +1 -1
- package/dist/routes/postOAuth2Acknowledge.test.js +137 -72
- package/dist/routes/postOAuth2Acknowledge.test.js.map +1 -1
- package/dist/routes/postOAuth2Revoke.d.ts +99 -0
- package/dist/routes/postOAuth2Revoke.js +102 -0
- package/dist/routes/postOAuth2Revoke.js.map +1 -0
- package/dist/routes/postOAuth2Revoke.test.d.ts +1 -0
- package/dist/routes/postOAuth2Revoke.test.js +161 -0
- package/dist/routes/postOAuth2Revoke.test.js.map +1 -0
- package/dist/routes/postOAuth2Token.d.ts +35 -108
- package/dist/routes/postOAuth2Token.js +53 -114
- package/dist/routes/postOAuth2Token.js.map +1 -1
- package/dist/routes/postOAuth2Token.test.js +493 -61
- package/dist/routes/postOAuth2Token.test.js.map +1 -1
- package/dist/services/authCookies.d.ts +9 -13
- package/dist/services/authCookies.js +1 -1
- package/dist/services/authCookies.js.map +1 -1
- package/dist/services/authCookies.test.js.map +1 -1
- package/dist/services/oAuth2AuthorizationCodeGranter.d.ts +129 -0
- package/dist/services/oAuth2AuthorizationCodeGranter.js +221 -0
- package/dist/services/oAuth2AuthorizationCodeGranter.js.map +1 -0
- package/dist/services/oAuth2AuthorizationCodeGranter.test.d.ts +1 -0
- package/dist/services/oAuth2AuthorizationCodeGranter.test.js +474 -0
- package/dist/services/oAuth2AuthorizationCodeGranter.test.js.map +1 -0
- package/dist/services/oAuth2ClientCredentialsGranter.d.ts +28 -12
- package/dist/services/oAuth2ClientCredentialsGranter.js +39 -21
- package/dist/services/oAuth2ClientCredentialsGranter.js.map +1 -1
- package/dist/services/oAuth2ClientCredentialsGranter.test.d.ts +1 -0
- package/dist/services/oAuth2ClientCredentialsGranter.test.js +265 -0
- package/dist/services/oAuth2ClientCredentialsGranter.test.js.map +1 -0
- package/dist/services/oAuth2Granters.d.ts +81 -86
- package/dist/services/oAuth2Granters.js +2 -67
- package/dist/services/oAuth2Granters.js.map +1 -1
- package/dist/services/oAuth2ImplicitGranter.d.ts +38 -0
- package/dist/services/oAuth2ImplicitGranter.js +72 -0
- package/dist/services/oAuth2ImplicitGranter.js.map +1 -0
- package/dist/services/oAuth2ImplicitGranter.test.d.ts +1 -0
- package/dist/services/oAuth2ImplicitGranter.test.js +727 -0
- package/dist/services/oAuth2ImplicitGranter.test.js.map +1 -0
- package/dist/services/oAuth2PasswordGranter.d.ts +43 -10
- package/dist/services/oAuth2PasswordGranter.js +53 -18
- package/dist/services/oAuth2PasswordGranter.js.map +1 -1
- package/dist/services/oAuth2PasswordGranter.test.d.ts +1 -0
- package/dist/services/oAuth2PasswordGranter.test.js +455 -0
- package/dist/services/oAuth2PasswordGranter.test.js.map +1 -0
- package/dist/services/oAuth2RefreshTokenGranter.d.ts +42 -9
- package/dist/services/oAuth2RefreshTokenGranter.js +60 -21
- package/dist/services/oAuth2RefreshTokenGranter.js.map +1 -1
- package/dist/services/oAuth2RefreshTokenGranter.test.d.ts +1 -0
- package/dist/services/oAuth2RefreshTokenGranter.test.js +403 -0
- package/dist/services/oAuth2RefreshTokenGranter.test.js.map +1 -0
- package/package.json +11 -11
- package/src/index.test.ts +1314 -404
- package/src/index.ts +46 -53
- package/src/libs/clients.ts +22 -0
- package/src/libs/errors.ts +325 -0
- package/src/libs/grants.ts +15 -0
- package/src/libs/redirectURI.ts +120 -0
- package/src/libs/schemas.ts +27 -0
- package/src/libs/scopes.ts +49 -0
- package/src/libs/utils.ts +24 -0
- package/src/libs/verifier.test.ts +37 -0
- package/src/libs/verifier.ts +57 -0
- package/src/routes/getOAuth2Authorize.test.ts +179 -96
- package/src/routes/getOAuth2Authorize.ts +97 -124
- package/src/routes/getOAuth2WellKnownMetadata.test.ts +58 -60
- package/src/routes/getOAuth2WellKnownMetadata.ts +26 -11
- package/src/routes/getOAuth2WellKnownProtectedResourceMetadata.ts +4 -6
- package/src/routes/postAuthLogin.test.ts +86 -57
- package/src/routes/postAuthLogin.ts +24 -14
- package/src/routes/postAuthLogout.test.ts +42 -18
- package/src/routes/postAuthLogout.ts +22 -8
- package/src/routes/postAuthRefresh.test.ts +98 -61
- package/src/routes/postAuthRefresh.ts +25 -13
- package/src/routes/postOAuth2Acknowledge.test.ts +169 -110
- package/src/routes/postOAuth2Acknowledge.ts +101 -61
- package/src/routes/postOAuth2Revoke.test.ts +179 -0
- package/src/routes/postOAuth2Revoke.ts +156 -0
- package/src/routes/postOAuth2Token.test.ts +570 -108
- package/src/routes/postOAuth2Token.ts +92 -136
- package/src/services/authCookies.test.ts +5 -5
- package/src/services/authCookies.ts +16 -18
- package/src/services/oAuth2AuthorizationCodeGranter.test.ts +564 -0
- package/src/services/oAuth2AuthorizationCodeGranter.ts +388 -0
- package/src/services/oAuth2ClientCredentialsGranter.test.ts +303 -0
- package/src/services/oAuth2ClientCredentialsGranter.ts +68 -43
- package/src/services/oAuth2Granters.ts +101 -195
- package/src/services/oAuth2ImplicitGranter.test.ts +811 -0
- package/src/services/oAuth2ImplicitGranter.ts +163 -0
- package/src/services/oAuth2PasswordGranter.test.ts +493 -0
- package/src/services/oAuth2PasswordGranter.ts +116 -40
- package/src/services/oAuth2RefreshTokenGranter.test.ts +441 -0
- package/src/services/oAuth2RefreshTokenGranter.ts +118 -51
- package/src/types.d.ts +1 -0
- package/dist/services/oAuth2CodeGranter.d.ts +0 -41
- package/dist/services/oAuth2CodeGranter.js +0 -105
- package/dist/services/oAuth2CodeGranter.js.map +0 -1
- package/dist/services/oAuth2CodeGranter.test.js +0 -123
- package/dist/services/oAuth2CodeGranter.test.js.map +0 -1
- package/dist/services/oAuth2TokenGranter.d.ts +0 -22
- package/dist/services/oAuth2TokenGranter.js +0 -64
- package/dist/services/oAuth2TokenGranter.js.map +0 -1
- package/src/__snapshots__/index.test.ts.snap +0 -401
- package/src/routes/__snapshots__/getOAuth2Authorize.test.ts.snap +0 -37
- package/src/routes/__snapshots__/postOAuth2Acknowledge.test.ts.snap +0 -61
- package/src/routes/__snapshots__/postOAuth2Token.test.ts.snap +0 -52
- package/src/services/__snapshots__/oAuth2CodeGranter.test.ts.snap +0 -52
- package/src/services/oAuth2CodeGranter.test.ts +0 -176
- package/src/services/oAuth2CodeGranter.ts +0 -210
- package/src/services/oAuth2TokenGranter.ts +0 -119
- /package/dist/{services/oAuth2CodeGranter.test.d.ts → libs/verifier.test.d.ts} +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { describe, test, beforeEach, jest, expect } from '@jest/globals';
|
|
2
|
+
import { YError } from 'yerror';
|
|
3
|
+
import initPostOAuth2Revoke from './postOAuth2Revoke.js';
|
|
4
|
+
describe('postOAuth2Revoke', () => {
|
|
5
|
+
const oAuth2RevokeToken = {
|
|
6
|
+
revoke: jest.fn(),
|
|
7
|
+
};
|
|
8
|
+
const log = jest.fn();
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
oAuth2RevokeToken.revoke.mockReset();
|
|
11
|
+
log.mockReset();
|
|
12
|
+
});
|
|
13
|
+
test('should revoke a token', async () => {
|
|
14
|
+
oAuth2RevokeToken.revoke.mockResolvedValueOnce();
|
|
15
|
+
const postOAuth2Revoke = await initPostOAuth2Revoke({
|
|
16
|
+
oAuth2RevokeToken,
|
|
17
|
+
log,
|
|
18
|
+
});
|
|
19
|
+
const response = await postOAuth2Revoke({
|
|
20
|
+
body: {
|
|
21
|
+
token: 'a_token',
|
|
22
|
+
token_type_hint: 'refresh_token',
|
|
23
|
+
},
|
|
24
|
+
authenticationData: {
|
|
25
|
+
clientId: 'a_client',
|
|
26
|
+
userId: 'a_user',
|
|
27
|
+
scopes: ['oauth'],
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
expect({
|
|
31
|
+
response,
|
|
32
|
+
oAuth2RevokeTokenRevokeCalls: oAuth2RevokeToken.revoke.mock.calls,
|
|
33
|
+
logCalls: log.mock.calls,
|
|
34
|
+
}).toMatchInlineSnapshot(`
|
|
35
|
+
{
|
|
36
|
+
"logCalls": [],
|
|
37
|
+
"oAuth2RevokeTokenRevokeCalls": [
|
|
38
|
+
[
|
|
39
|
+
"refresh_token",
|
|
40
|
+
"a_token",
|
|
41
|
+
{
|
|
42
|
+
"clientId": "a_client",
|
|
43
|
+
"scopes": [
|
|
44
|
+
"oauth",
|
|
45
|
+
],
|
|
46
|
+
"userId": "a_user",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
],
|
|
50
|
+
"response": {
|
|
51
|
+
"status": 200,
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
`);
|
|
55
|
+
});
|
|
56
|
+
test('should revoke a token with no type provided', async () => {
|
|
57
|
+
oAuth2RevokeToken.revoke.mockResolvedValueOnce();
|
|
58
|
+
const postOAuth2Revoke = await initPostOAuth2Revoke({
|
|
59
|
+
oAuth2RevokeToken,
|
|
60
|
+
log,
|
|
61
|
+
});
|
|
62
|
+
const response = await postOAuth2Revoke({
|
|
63
|
+
body: {
|
|
64
|
+
token: 'a_token',
|
|
65
|
+
},
|
|
66
|
+
authenticationData: {
|
|
67
|
+
clientId: 'a_client',
|
|
68
|
+
userId: 'a_user',
|
|
69
|
+
scopes: ['oauth'],
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
expect({
|
|
73
|
+
response,
|
|
74
|
+
oAuth2RevokeTokenRevokeCalls: oAuth2RevokeToken.revoke.mock.calls,
|
|
75
|
+
logCalls: log.mock.calls,
|
|
76
|
+
}).toMatchInlineSnapshot(`
|
|
77
|
+
{
|
|
78
|
+
"logCalls": [],
|
|
79
|
+
"oAuth2RevokeTokenRevokeCalls": [
|
|
80
|
+
[
|
|
81
|
+
"access_token",
|
|
82
|
+
"a_token",
|
|
83
|
+
{
|
|
84
|
+
"clientId": "a_client",
|
|
85
|
+
"scopes": [
|
|
86
|
+
"oauth",
|
|
87
|
+
],
|
|
88
|
+
"userId": "a_user",
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
"refresh_token",
|
|
93
|
+
"a_token",
|
|
94
|
+
{
|
|
95
|
+
"clientId": "a_client",
|
|
96
|
+
"scopes": [
|
|
97
|
+
"oauth",
|
|
98
|
+
],
|
|
99
|
+
"userId": "a_user",
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
],
|
|
103
|
+
"response": {
|
|
104
|
+
"status": 200,
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
`);
|
|
108
|
+
});
|
|
109
|
+
test('should ignore already invalid tokens', async () => {
|
|
110
|
+
oAuth2RevokeToken.revoke.mockRejectedValueOnce(new YError('E_BAD_TOKEN'));
|
|
111
|
+
const postOAuth2Revoke = await initPostOAuth2Revoke({
|
|
112
|
+
oAuth2RevokeToken,
|
|
113
|
+
log,
|
|
114
|
+
});
|
|
115
|
+
const response = await postOAuth2Revoke({
|
|
116
|
+
body: {
|
|
117
|
+
token: 'already_invalid',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
expect({
|
|
121
|
+
response,
|
|
122
|
+
oAuth2RevokeTokenRevokeCalls: oAuth2RevokeToken.revoke.mock.calls,
|
|
123
|
+
logCalls: log.mock.calls,
|
|
124
|
+
}).toMatchInlineSnapshot(`
|
|
125
|
+
{
|
|
126
|
+
"logCalls": [],
|
|
127
|
+
"oAuth2RevokeTokenRevokeCalls": [
|
|
128
|
+
[
|
|
129
|
+
"access_token",
|
|
130
|
+
"already_invalid",
|
|
131
|
+
undefined,
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
"refresh_token",
|
|
135
|
+
"already_invalid",
|
|
136
|
+
undefined,
|
|
137
|
+
],
|
|
138
|
+
],
|
|
139
|
+
"response": {
|
|
140
|
+
"status": 200,
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
`);
|
|
144
|
+
});
|
|
145
|
+
test('should bubble up unexpected errors', async () => {
|
|
146
|
+
oAuth2RevokeToken.revoke.mockRejectedValueOnce(new YError('E_OAUTH2_UNEXPECTED_ERROR'));
|
|
147
|
+
const postOAuth2Revoke = await initPostOAuth2Revoke({
|
|
148
|
+
oAuth2RevokeToken,
|
|
149
|
+
log,
|
|
150
|
+
});
|
|
151
|
+
await expect(postOAuth2Revoke({
|
|
152
|
+
body: {
|
|
153
|
+
token: 'a_token',
|
|
154
|
+
},
|
|
155
|
+
})).rejects.toMatchObject({
|
|
156
|
+
code: 'E_OAUTH2_UNEXPECTED_ERROR',
|
|
157
|
+
});
|
|
158
|
+
expect(log.mock.calls.length).toBe(2);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
//# sourceMappingURL=postOAuth2Revoke.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postOAuth2Revoke.test.js","sourceRoot":"","sources":["../../src/routes/postOAuth2Revoke.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAA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AE;QACpD,iBAAiB,CAAC,MAAM,CAAC,qBAAqB,CAC5C,IAAI,MAAM,CAAC,2BAA2B,CAAC,CACxC,CAAC;QACF,MAAM,gBAAgB,GAAG,MAAM,oBAAoB,CAAC;YAClD,iBAAiB;YACjB,GAAG;SACJ,CAAC,CAAC;QAEH,MAAM,MAAM,CACV,gBAAgB,CAAC;YACf,IAAI,EAAE;gBACJ,KAAK,EAAE,SAAS;aACjB;SACF,CAAC,CACH,CAAC,OAAO,CAAC,aAAa,CAAC;YACtB,IAAI,EAAE,2BAA2B;SAClC,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,104 +1,13 @@
|
|
|
1
1
|
import { type LogService, type TimeService } from 'common-services';
|
|
2
|
-
import { type
|
|
2
|
+
import { type WhookOAuth2GranterDefinitions, type WhookOAuth2GranterService, type WhookOAuth2Options } from '../services/oAuth2Granters.js';
|
|
3
3
|
import { type WhookAuthenticationData } from '@whook/authorization';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export declare const authorizationCodeTokenRequestBodySchema: {
|
|
14
|
-
readonly name: "AuthorizationCodeRequestBody";
|
|
15
|
-
readonly schema: {
|
|
16
|
-
readonly type: "object";
|
|
17
|
-
readonly description: "Authorization code grant, see https://tools.ietf.org/html/rfc6749#section-4.1";
|
|
18
|
-
readonly required: ["grant_type"];
|
|
19
|
-
readonly properties: {
|
|
20
|
-
readonly grant_type: {
|
|
21
|
-
readonly type: "string";
|
|
22
|
-
readonly enum: ["authorization_code"];
|
|
23
|
-
};
|
|
24
|
-
readonly code: {
|
|
25
|
-
readonly type: "string";
|
|
26
|
-
};
|
|
27
|
-
readonly client_id: {
|
|
28
|
-
readonly type: "string";
|
|
29
|
-
};
|
|
30
|
-
readonly redirect_uri: {
|
|
31
|
-
readonly type: "string";
|
|
32
|
-
readonly pattern: "^https?://";
|
|
33
|
-
readonly format: "uri";
|
|
34
|
-
};
|
|
35
|
-
readonly code_verifier: import("ya-json-schema-types").ExpressiveJSONSchema;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export declare const passwordTokenRequestBodySchema: {
|
|
40
|
-
readonly name: "PasswordRequestBody";
|
|
41
|
-
readonly schema: {
|
|
42
|
-
readonly type: "object";
|
|
43
|
-
readonly description: "Resource owner password credentials grant, see https://tools.ietf.org/html/rfc6749#section-4.3";
|
|
44
|
-
readonly required: ["grant_type", "username", "password"];
|
|
45
|
-
readonly properties: {
|
|
46
|
-
readonly grant_type: {
|
|
47
|
-
readonly type: "string";
|
|
48
|
-
readonly enum: ["password"];
|
|
49
|
-
};
|
|
50
|
-
readonly username: {
|
|
51
|
-
readonly type: "string";
|
|
52
|
-
};
|
|
53
|
-
readonly password: {
|
|
54
|
-
readonly type: "string";
|
|
55
|
-
};
|
|
56
|
-
readonly scope: {
|
|
57
|
-
readonly type: "string";
|
|
58
|
-
readonly description: "See https://tools.ietf.org/html/rfc6749#section-3.3";
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
export declare const clientCredentialsTokenRequestBodySchema: {
|
|
64
|
-
readonly name: "ClientCredentialsRequestBody";
|
|
65
|
-
readonly schema: {
|
|
66
|
-
readonly type: "object";
|
|
67
|
-
readonly description: "Client credentials grant, see https://tools.ietf.org/html/rfc6749#section-4.4";
|
|
68
|
-
readonly required: ["grant_type"];
|
|
69
|
-
readonly properties: {
|
|
70
|
-
readonly grant_type: {
|
|
71
|
-
readonly type: "string";
|
|
72
|
-
readonly enum: ["client_credentials"];
|
|
73
|
-
};
|
|
74
|
-
readonly scope: {
|
|
75
|
-
readonly type: "string";
|
|
76
|
-
readonly description: "See https://tools.ietf.org/html/rfc6749#section-3.3";
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
export declare const refreshTokenRequestBodySchema: {
|
|
82
|
-
readonly name: "RefreshTokenRequestBody";
|
|
83
|
-
readonly schema: {
|
|
84
|
-
readonly type: "object";
|
|
85
|
-
readonly description: "Token refresh grant type, see https://tools.ietf.org/html/rfc6749#section-6 .";
|
|
86
|
-
readonly required: ["grant_type", "refresh_token"];
|
|
87
|
-
readonly properties: {
|
|
88
|
-
readonly grant_type: {
|
|
89
|
-
readonly type: "string";
|
|
90
|
-
readonly enum: ["refresh_token"];
|
|
91
|
-
};
|
|
92
|
-
readonly refresh_token: {
|
|
93
|
-
readonly type: "string";
|
|
94
|
-
};
|
|
95
|
-
readonly scope: {
|
|
96
|
-
readonly type: "string";
|
|
97
|
-
readonly description: "See https://tools.ietf.org/html/rfc6749#section-3.3";
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
};
|
|
4
|
+
import { type WhookOAuth2AccessTokenService } from '../services/oAuth2ImplicitGranter.js';
|
|
5
|
+
import { refreshTokenRequestBodySchema, type WhookOAuth2RefreshTokenService } from '../services/oAuth2RefreshTokenGranter.js';
|
|
6
|
+
import { authorizationCodeTokenRequestBodySchema, codeVerifierSchema } from '../services/oAuth2AuthorizationCodeGranter.js';
|
|
7
|
+
import { passwordTokenRequestBodySchema } from '../services/oAuth2PasswordGranter.js';
|
|
8
|
+
import { clientCredentialsTokenRequestBodySchema } from '../services/oAuth2ClientCredentialsGranter.js';
|
|
9
|
+
import { scopeSchema } from '../libs/schemas.js';
|
|
10
|
+
export { passwordTokenRequestBodySchema, refreshTokenRequestBodySchema, clientCredentialsTokenRequestBodySchema, authorizationCodeTokenRequestBodySchema, codeVerifierSchema, scopeSchema, };
|
|
102
11
|
export declare const tokenBodySchema: {
|
|
103
12
|
readonly name: "TokenRequestBody";
|
|
104
13
|
readonly schema: {
|
|
@@ -145,10 +54,23 @@ export declare const definition: {
|
|
|
145
54
|
readonly description: "The lifetime in seconds of the access token";
|
|
146
55
|
readonly type: "number";
|
|
147
56
|
};
|
|
57
|
+
readonly expiration_date: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly format: "date-time";
|
|
60
|
+
};
|
|
148
61
|
readonly refresh_token: {
|
|
149
62
|
readonly description: "See https://tools.ietf.org/html/rfc6749#section-6";
|
|
150
63
|
readonly type: "string";
|
|
151
64
|
};
|
|
65
|
+
readonly refresh_token_expires_in: {
|
|
66
|
+
readonly description: "The lifetime in seconds of the refresh token";
|
|
67
|
+
readonly type: "number";
|
|
68
|
+
};
|
|
69
|
+
readonly refresh_token_expiration_date: {
|
|
70
|
+
readonly type: "string";
|
|
71
|
+
readonly format: "date-time";
|
|
72
|
+
};
|
|
73
|
+
readonly scope: import("ya-json-schema-types").ExpressiveJSONSchema;
|
|
152
74
|
};
|
|
153
75
|
};
|
|
154
76
|
};
|
|
@@ -181,28 +103,33 @@ export declare const definition: {
|
|
|
181
103
|
};
|
|
182
104
|
};
|
|
183
105
|
declare const _default: import("knifecycle").ServiceInitializer<{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
106
|
+
OAUTH2: WhookOAuth2Options;
|
|
107
|
+
oAuth2Granters: WhookOAuth2GranterService<WhookOAuth2GranterDefinitions>[];
|
|
108
|
+
oAuth2AccessToken: WhookOAuth2AccessTokenService;
|
|
109
|
+
oAuth2RefreshToken: WhookOAuth2RefreshTokenService;
|
|
187
110
|
log: LogService;
|
|
188
111
|
time: TimeService;
|
|
189
|
-
}, ({ body: { grant_type: grantType, ...grantParameters }, authenticationData, }: {
|
|
112
|
+
}, ({ body: { grant_type: grantType, scope: demandedScope, ...grantParameters }, authenticationData: optionalAuthenticationData, }: {
|
|
190
113
|
body: {
|
|
191
114
|
grant_type: string;
|
|
192
115
|
[name: string]: unknown;
|
|
193
116
|
};
|
|
194
|
-
authenticationData
|
|
117
|
+
authenticationData?: WhookAuthenticationData;
|
|
195
118
|
}) => Promise<{
|
|
196
119
|
status: number;
|
|
197
|
-
headers: {
|
|
120
|
+
headers: {
|
|
121
|
+
'Cache-Control': string;
|
|
122
|
+
Pragma: string;
|
|
123
|
+
};
|
|
198
124
|
body: {
|
|
125
|
+
scope: string;
|
|
126
|
+
refresh_token?: string | undefined;
|
|
127
|
+
refresh_token_expires_in?: number | undefined;
|
|
128
|
+
refresh_token_expiration_date?: string | undefined;
|
|
199
129
|
access_token: string;
|
|
200
130
|
token_type: string;
|
|
201
131
|
expires_in: number;
|
|
202
132
|
expiration_date: string;
|
|
203
|
-
refresh_token: string;
|
|
204
|
-
refresh_token_expires_in: number;
|
|
205
|
-
refresh_token_expiration_date: string;
|
|
206
133
|
};
|
|
207
134
|
}>>;
|
|
208
135
|
export default _default;
|
|
@@ -1,109 +1,18 @@
|
|
|
1
1
|
import { autoService, location } from 'knifecycle';
|
|
2
|
-
import { camelCaseObjectProperties } from './getOAuth2Authorize.js';
|
|
3
2
|
import { YError, printStackTrace } from 'yerror';
|
|
4
3
|
import { noop, refersTo, } from '@whook/whook';
|
|
4
|
+
import { filterScopes, parseOAuth2Scope, stringifyScopes, } from '../libs/scopes.js';
|
|
5
|
+
import { refreshTokenRequestBodySchema, } from '../services/oAuth2RefreshTokenGranter.js';
|
|
6
|
+
import { authorizationCodeTokenRequestBodySchema, codeVerifierSchema, } from '../services/oAuth2AuthorizationCodeGranter.js';
|
|
7
|
+
import { passwordTokenRequestBodySchema } from '../services/oAuth2PasswordGranter.js';
|
|
8
|
+
import { clientCredentialsTokenRequestBodySchema } from '../services/oAuth2ClientCredentialsGranter.js';
|
|
9
|
+
import { scopeSchema } from '../libs/schemas.js';
|
|
10
|
+
import { camelCaseObjectProperties } from '../libs/utils.js';
|
|
11
|
+
export { passwordTokenRequestBodySchema, refreshTokenRequestBodySchema, clientCredentialsTokenRequestBodySchema, authorizationCodeTokenRequestBodySchema, codeVerifierSchema, scopeSchema, };
|
|
5
12
|
/* Architecture Note #2: OAuth2 acknowledge
|
|
6
13
|
This endpoint is to be used by the authentication server page
|
|
7
|
-
to
|
|
14
|
+
to acknowledge that the user accepted the client request.
|
|
8
15
|
*/
|
|
9
|
-
export const codeVerifierSchema = {
|
|
10
|
-
name: 'CodeVerifier',
|
|
11
|
-
schema: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
minLength: 43,
|
|
14
|
-
maxLength: 128,
|
|
15
|
-
pattern: '^[A-Za-z0-9._~-]+$',
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
export const authorizationCodeTokenRequestBodySchema = {
|
|
19
|
-
name: 'AuthorizationCodeRequestBody',
|
|
20
|
-
schema: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
description: 'Authorization code grant, see https://tools.ietf.org/html/rfc6749#section-4.1',
|
|
23
|
-
required: ['grant_type'],
|
|
24
|
-
properties: {
|
|
25
|
-
grant_type: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
enum: ['authorization_code'],
|
|
28
|
-
},
|
|
29
|
-
code: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
},
|
|
32
|
-
client_id: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
},
|
|
35
|
-
redirect_uri: {
|
|
36
|
-
type: 'string',
|
|
37
|
-
pattern: '^https?://',
|
|
38
|
-
format: 'uri',
|
|
39
|
-
},
|
|
40
|
-
code_verifier: refersTo(codeVerifierSchema),
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
export const passwordTokenRequestBodySchema = {
|
|
45
|
-
name: 'PasswordRequestBody',
|
|
46
|
-
schema: {
|
|
47
|
-
type: 'object',
|
|
48
|
-
description: 'Resource owner password credentials grant, see https://tools.ietf.org/html/rfc6749#section-4.3',
|
|
49
|
-
required: ['grant_type', 'username', 'password'],
|
|
50
|
-
properties: {
|
|
51
|
-
grant_type: {
|
|
52
|
-
type: 'string',
|
|
53
|
-
enum: ['password'],
|
|
54
|
-
},
|
|
55
|
-
username: {
|
|
56
|
-
type: 'string',
|
|
57
|
-
},
|
|
58
|
-
password: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
},
|
|
61
|
-
scope: {
|
|
62
|
-
type: 'string',
|
|
63
|
-
description: 'See https://tools.ietf.org/html/rfc6749#section-3.3',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
export const clientCredentialsTokenRequestBodySchema = {
|
|
69
|
-
name: 'ClientCredentialsRequestBody',
|
|
70
|
-
schema: {
|
|
71
|
-
type: 'object',
|
|
72
|
-
description: 'Client credentials grant, see https://tools.ietf.org/html/rfc6749#section-4.4',
|
|
73
|
-
required: ['grant_type'],
|
|
74
|
-
properties: {
|
|
75
|
-
grant_type: {
|
|
76
|
-
type: 'string',
|
|
77
|
-
enum: ['client_credentials'],
|
|
78
|
-
},
|
|
79
|
-
scope: {
|
|
80
|
-
type: 'string',
|
|
81
|
-
description: 'See https://tools.ietf.org/html/rfc6749#section-3.3',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
export const refreshTokenRequestBodySchema = {
|
|
87
|
-
name: 'RefreshTokenRequestBody',
|
|
88
|
-
schema: {
|
|
89
|
-
type: 'object',
|
|
90
|
-
description: 'Token refresh grant type, see https://tools.ietf.org/html/rfc6749#section-6 .',
|
|
91
|
-
required: ['grant_type', 'refresh_token'],
|
|
92
|
-
properties: {
|
|
93
|
-
grant_type: {
|
|
94
|
-
type: 'string',
|
|
95
|
-
enum: ['refresh_token'],
|
|
96
|
-
},
|
|
97
|
-
refresh_token: {
|
|
98
|
-
type: 'string',
|
|
99
|
-
},
|
|
100
|
-
scope: {
|
|
101
|
-
type: 'string',
|
|
102
|
-
description: 'See https://tools.ietf.org/html/rfc6749#section-3.3',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
16
|
export const tokenBodySchema = {
|
|
108
17
|
name: 'TokenRequestBody',
|
|
109
18
|
schema: {
|
|
@@ -154,10 +63,23 @@ export const definition = {
|
|
|
154
63
|
description: 'The lifetime in seconds of the access token',
|
|
155
64
|
type: 'number',
|
|
156
65
|
},
|
|
66
|
+
expiration_date: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
format: 'date-time',
|
|
69
|
+
},
|
|
157
70
|
refresh_token: {
|
|
158
71
|
description: 'See https://tools.ietf.org/html/rfc6749#section-6',
|
|
159
72
|
type: 'string',
|
|
160
73
|
},
|
|
74
|
+
refresh_token_expires_in: {
|
|
75
|
+
description: 'The lifetime in seconds of the refresh token',
|
|
76
|
+
type: 'number',
|
|
77
|
+
},
|
|
78
|
+
refresh_token_expiration_date: {
|
|
79
|
+
type: 'string',
|
|
80
|
+
format: 'date-time',
|
|
81
|
+
},
|
|
82
|
+
scope: refersTo(scopeSchema),
|
|
161
83
|
},
|
|
162
84
|
},
|
|
163
85
|
},
|
|
@@ -192,38 +114,55 @@ export const definition = {
|
|
|
192
114
|
},
|
|
193
115
|
},
|
|
194
116
|
};
|
|
195
|
-
async function initPostOAuth2Token({ oAuth2Granters, oAuth2AccessToken, oAuth2RefreshToken, time = Date.now.bind(Date), log = noop, }) {
|
|
196
|
-
return async ({ body: { grant_type: grantType, ...grantParameters }, authenticationData, }) => {
|
|
117
|
+
async function initPostOAuth2Token({ OAUTH2, oAuth2Granters, oAuth2AccessToken, oAuth2RefreshToken, time = Date.now.bind(Date), log = noop, }) {
|
|
118
|
+
return async ({ body: { grant_type: grantType, scope: demandedScope, ...grantParameters }, authenticationData: optionalAuthenticationData, }) => {
|
|
197
119
|
try {
|
|
198
|
-
const granter = oAuth2Granters.find((granter) => granter.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
throw new YError('E_UNKNOWN_AUTHENTICATOR_TYPE', [grantType]);
|
|
120
|
+
const granter = oAuth2Granters.find((granter) => granter.grantType && granter.grantType === grantType);
|
|
121
|
+
if (!granter || !granter.authenticate) {
|
|
122
|
+
throw new YError('E_OAUTH2_UNKNOWN_GRANT_TYPE', [grantType]);
|
|
202
123
|
}
|
|
203
|
-
const newAuthenticationData = await granter.
|
|
124
|
+
const newAuthenticationData = await granter.authenticate({
|
|
125
|
+
...camelCaseObjectProperties(grantParameters),
|
|
126
|
+
demandedScopes: typeof demandedScope === 'string'
|
|
127
|
+
? filterScopes(parseOAuth2Scope(demandedScope), OAUTH2.allowedScopes, !!OAUTH2.strictScopesChecks)
|
|
128
|
+
: [],
|
|
129
|
+
}, optionalAuthenticationData);
|
|
204
130
|
const [{ token: accessToken, expiresAt: accessTokenExpiresAt }, { token: refreshToken, expiresAt: refreshTokenExpiresAt },] = await Promise.all([
|
|
205
|
-
oAuth2AccessToken.create(
|
|
206
|
-
|
|
131
|
+
oAuth2AccessToken.create(newAuthenticationData),
|
|
132
|
+
granter.issuesRefreshToken
|
|
133
|
+
? oAuth2RefreshToken.create(newAuthenticationData)
|
|
134
|
+
: Promise.resolve({
|
|
135
|
+
token: undefined,
|
|
136
|
+
expiresAt: undefined,
|
|
137
|
+
}),
|
|
207
138
|
]);
|
|
208
139
|
const currentTime = time();
|
|
209
140
|
return {
|
|
210
141
|
status: 200,
|
|
211
|
-
headers: {
|
|
142
|
+
headers: {
|
|
143
|
+
'Cache-Control': 'no-store',
|
|
144
|
+
Pragma: 'no-cache',
|
|
145
|
+
},
|
|
212
146
|
body: {
|
|
213
147
|
access_token: accessToken,
|
|
214
148
|
token_type: 'bearer',
|
|
215
149
|
expires_in: Math.ceil((accessTokenExpiresAt - currentTime) / 1000),
|
|
216
150
|
expiration_date: new Date(accessTokenExpiresAt).toISOString(),
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
151
|
+
...(refreshToken
|
|
152
|
+
? {
|
|
153
|
+
refresh_token: refreshToken,
|
|
154
|
+
refresh_token_expires_in: Math.ceil((refreshTokenExpiresAt - currentTime) / 1000),
|
|
155
|
+
refresh_token_expiration_date: new Date(refreshTokenExpiresAt).toISOString(),
|
|
156
|
+
}
|
|
157
|
+
: {}),
|
|
158
|
+
scope: stringifyScopes(newAuthenticationData.scopes),
|
|
220
159
|
},
|
|
221
160
|
};
|
|
222
161
|
}
|
|
223
162
|
catch (err) {
|
|
224
163
|
log('debug', '👫 - OAuth2 token issuing error', err.code);
|
|
225
164
|
log('error-stack', printStackTrace(err));
|
|
226
|
-
throw YError.cast(err, '
|
|
165
|
+
throw YError.cast(err, 'E_OAUTH2_UNEXPECTED_ERROR');
|
|
227
166
|
}
|
|
228
167
|
};
|
|
229
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postOAuth2Token.js","sourceRoot":"","sources":["../../src/routes/postOAuth2Token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"postOAuth2Token.js","sourceRoot":"","sources":["../../src/routes/postOAuth2Token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EACL,IAAI,EACJ,QAAQ,GAGT,MAAM,cAAc,CAAC;AAOtB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,6BAA6B,GAE9B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,uCAAuC,EACvC,kBAAkB,GACnB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,uCAAuC,EAAE,MAAM,+CAA+C,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CA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