@whook/oauth2 9.0.0 → 10.0.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.
Files changed (131) hide show
  1. package/README.md +90 -68
  2. package/dist/handlers/getOAuth2Authorize.d.ts +4 -4
  3. package/dist/handlers/getOAuth2Authorize.js +122 -165
  4. package/dist/handlers/getOAuth2Authorize.js.map +1 -1
  5. package/dist/handlers/getOAuth2Authorize.test.js +117 -103
  6. package/dist/handlers/getOAuth2Authorize.test.js.map +1 -1
  7. package/dist/handlers/postAuthLogin.d.ts +1 -1
  8. package/dist/handlers/postAuthLogin.js +83 -121
  9. package/dist/handlers/postAuthLogin.js.map +1 -1
  10. package/dist/handlers/postAuthLogin.test.js +42 -44
  11. package/dist/handlers/postAuthLogin.test.js.map +1 -1
  12. package/dist/handlers/postAuthLogout.d.ts +1 -1
  13. package/dist/handlers/postAuthLogout.js +26 -42
  14. package/dist/handlers/postAuthLogout.js.map +1 -1
  15. package/dist/handlers/postAuthLogout.test.js +19 -21
  16. package/dist/handlers/postAuthLogout.test.js.map +1 -1
  17. package/dist/handlers/postAuthRefresh.d.ts +1 -1
  18. package/dist/handlers/postAuthRefresh.js +93 -132
  19. package/dist/handlers/postAuthRefresh.js.map +1 -1
  20. package/dist/handlers/postAuthRefresh.test.js +47 -49
  21. package/dist/handlers/postAuthRefresh.test.js.map +1 -1
  22. package/dist/handlers/postOAuth2Acknowledge.d.ts +5 -5
  23. package/dist/handlers/postOAuth2Acknowledge.js +119 -151
  24. package/dist/handlers/postOAuth2Acknowledge.js.map +1 -1
  25. package/dist/handlers/postOAuth2Acknowledge.test.js +139 -125
  26. package/dist/handlers/postOAuth2Acknowledge.test.js.map +1 -1
  27. package/dist/handlers/postOAuth2Token.d.ts +1 -1
  28. package/dist/handlers/postOAuth2Token.js +200 -232
  29. package/dist/handlers/postOAuth2Token.js.map +1 -1
  30. package/dist/handlers/postOAuth2Token.test.js +156 -153
  31. package/dist/handlers/postOAuth2Token.test.js.map +1 -1
  32. package/dist/index.d.ts +16 -16
  33. package/dist/index.js +14 -229
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.test.js +697 -619
  36. package/dist/index.test.js.map +1 -1
  37. package/dist/services/authCookies.d.ts +8 -4
  38. package/dist/services/authCookies.js +40 -71
  39. package/dist/services/authCookies.js.map +1 -1
  40. package/dist/services/authCookies.test.js +57 -62
  41. package/dist/services/authCookies.test.js.map +1 -1
  42. package/dist/services/oAuth2ClientCredentialsGranter.d.ts +2 -2
  43. package/dist/services/oAuth2ClientCredentialsGranter.js +34 -52
  44. package/dist/services/oAuth2ClientCredentialsGranter.js.map +1 -1
  45. package/dist/services/oAuth2CodeGranter.d.ts +1 -1
  46. package/dist/services/oAuth2CodeGranter.js +66 -109
  47. package/dist/services/oAuth2CodeGranter.js.map +1 -1
  48. package/dist/services/oAuth2CodeGranter.test.js +65 -66
  49. package/dist/services/oAuth2CodeGranter.test.js.map +1 -1
  50. package/dist/services/oAuth2Granters.js +131 -138
  51. package/dist/services/oAuth2Granters.js.map +1 -1
  52. package/dist/services/oAuth2PasswordGranter.d.ts +1 -1
  53. package/dist/services/oAuth2PasswordGranter.js +27 -52
  54. package/dist/services/oAuth2PasswordGranter.js.map +1 -1
  55. package/dist/services/oAuth2RefreshTokenGranter.d.ts +1 -1
  56. package/dist/services/oAuth2RefreshTokenGranter.js +34 -58
  57. package/dist/services/oAuth2RefreshTokenGranter.js.map +1 -1
  58. package/dist/services/oAuth2TokenGranter.d.ts +1 -1
  59. package/dist/services/oAuth2TokenGranter.js +50 -86
  60. package/dist/services/oAuth2TokenGranter.js.map +1 -1
  61. package/package.json +48 -89
  62. package/src/__snapshots__/index.test.ts.snap +23 -22
  63. package/src/handlers/__snapshots__/postOAuth2Acknowledge.test.ts.snap +1 -1
  64. package/src/handlers/getOAuth2Authorize.test.ts +49 -13
  65. package/src/handlers/getOAuth2Authorize.ts +2 -2
  66. package/src/handlers/postAuthLogin.test.ts +9 -5
  67. package/src/handlers/postAuthLogin.ts +4 -4
  68. package/src/handlers/postAuthLogout.test.ts +8 -4
  69. package/src/handlers/postAuthLogout.ts +2 -2
  70. package/src/handlers/postAuthRefresh.test.ts +10 -6
  71. package/src/handlers/postAuthRefresh.ts +4 -4
  72. package/src/handlers/postOAuth2Acknowledge.test.ts +83 -35
  73. package/src/handlers/postOAuth2Acknowledge.ts +18 -8
  74. package/src/handlers/postOAuth2Token.test.ts +77 -17
  75. package/src/handlers/postOAuth2Token.ts +3 -3
  76. package/src/index.test.ts +110 -65
  77. package/src/index.ts +21 -19
  78. package/src/services/authCookies.test.ts +2 -2
  79. package/src/services/authCookies.ts +10 -5
  80. package/src/services/oAuth2ClientCredentialsGranter.ts +3 -3
  81. package/src/services/oAuth2CodeGranter.test.ts +27 -4
  82. package/src/services/oAuth2CodeGranter.ts +2 -2
  83. package/src/services/oAuth2PasswordGranter.ts +2 -2
  84. package/src/services/oAuth2RefreshTokenGranter.ts +2 -2
  85. package/src/services/oAuth2TokenGranter.ts +1 -1
  86. package/dist/handlers/getOAuth2Authorize.mjs +0 -160
  87. package/dist/handlers/getOAuth2Authorize.mjs.map +0 -1
  88. package/dist/handlers/getOAuth2Authorize.test.mjs +0 -114
  89. package/dist/handlers/getOAuth2Authorize.test.mjs.map +0 -1
  90. package/dist/handlers/postAuthLogin.mjs +0 -109
  91. package/dist/handlers/postAuthLogin.mjs.map +0 -1
  92. package/dist/handlers/postAuthLogin.test.mjs +0 -85
  93. package/dist/handlers/postAuthLogin.test.mjs.map +0 -1
  94. package/dist/handlers/postAuthLogout.mjs +0 -33
  95. package/dist/handlers/postAuthLogout.mjs.map +0 -1
  96. package/dist/handlers/postAuthLogout.test.mjs +0 -30
  97. package/dist/handlers/postAuthLogout.test.mjs.map +0 -1
  98. package/dist/handlers/postAuthRefresh.mjs +0 -122
  99. package/dist/handlers/postAuthRefresh.mjs.map +0 -1
  100. package/dist/handlers/postAuthRefresh.test.mjs +0 -94
  101. package/dist/handlers/postAuthRefresh.test.mjs.map +0 -1
  102. package/dist/handlers/postOAuth2Acknowledge.mjs +0 -150
  103. package/dist/handlers/postOAuth2Acknowledge.mjs.map +0 -1
  104. package/dist/handlers/postOAuth2Acknowledge.test.mjs +0 -140
  105. package/dist/handlers/postOAuth2Acknowledge.test.mjs.map +0 -1
  106. package/dist/handlers/postOAuth2Token.mjs +0 -231
  107. package/dist/handlers/postOAuth2Token.mjs.map +0 -1
  108. package/dist/handlers/postOAuth2Token.test.mjs +0 -160
  109. package/dist/handlers/postOAuth2Token.test.mjs.map +0 -1
  110. package/dist/index.mjs +0 -15
  111. package/dist/index.mjs.map +0 -1
  112. package/dist/index.test.mjs +0 -747
  113. package/dist/index.test.mjs.map +0 -1
  114. package/dist/services/authCookies.mjs +0 -58
  115. package/dist/services/authCookies.mjs.map +0 -1
  116. package/dist/services/authCookies.test.mjs +0 -77
  117. package/dist/services/authCookies.test.mjs.map +0 -1
  118. package/dist/services/oAuth2ClientCredentialsGranter.mjs +0 -41
  119. package/dist/services/oAuth2ClientCredentialsGranter.mjs.map +0 -1
  120. package/dist/services/oAuth2CodeGranter.mjs +0 -98
  121. package/dist/services/oAuth2CodeGranter.mjs.map +0 -1
  122. package/dist/services/oAuth2CodeGranter.test.mjs +0 -83
  123. package/dist/services/oAuth2CodeGranter.test.mjs.map +0 -1
  124. package/dist/services/oAuth2Granters.mjs +0 -127
  125. package/dist/services/oAuth2Granters.mjs.map +0 -1
  126. package/dist/services/oAuth2PasswordGranter.mjs +0 -40
  127. package/dist/services/oAuth2PasswordGranter.mjs.map +0 -1
  128. package/dist/services/oAuth2RefreshTokenGranter.mjs +0 -47
  129. package/dist/services/oAuth2RefreshTokenGranter.mjs.map +0 -1
  130. package/dist/services/oAuth2TokenGranter.mjs +0 -78
  131. package/dist/services/oAuth2TokenGranter.mjs.map +0 -1
@@ -1,51 +1,47 @@
1
- "use strict";
2
-
3
- var _postAuthRefresh = _interopRequireDefault(require("./postAuthRefresh"));
4
-
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
1
+ import { jest } from '@jest/globals';
2
+ import initPostAuthRefresh from './postAuthRefresh.js';
7
3
  describe('postAuthRefresh', () => {
8
- test('should work', async () => {
9
- const authCookies = {
10
- parse: jest.fn(),
11
- build: jest.fn()
12
- };
13
- const postOAuth2Token = jest.fn();
14
- const postAuthRefresh = await (0, _postAuthRefresh.default)({
15
- ROOT_AUTHENTICATION_DATA: {
16
- scope: 'user',
17
- applicationId: 'root_app_id'
18
- },
19
- authCookies,
20
- postOAuth2Token
21
- });
22
- authCookies.parse.mockReturnValueOnce({
23
- access_token: 'an_access_token',
24
- refresh_token: 'a_refresh_token'
25
- });
26
- authCookies.build.mockReturnValueOnce('the_build_cookies');
27
- postOAuth2Token.mockResolvedValueOnce({
28
- status: 200,
29
- body: {
30
- access_token: 'an_access_token',
31
- expiration_date: '2020-02-02T20:22:02Z',
32
- expires_in: 3600,
33
- token_type: 'bearer'
34
- }
35
- });
36
- const response = await postAuthRefresh({
37
- cookie: 'a_given_cookie',
38
- body: {
39
- remember: false,
40
- scope: 'user'
41
- }
42
- });
43
- expect({
44
- response,
45
- authCookiesParseCalls: authCookies.parse.mock.calls,
46
- authCookiesBuildCalls: authCookies.build.mock.calls,
47
- postOAuth2TokenCalls: postOAuth2Token.mock.calls
48
- }).toMatchInlineSnapshot(`
4
+ test('should work', async () => {
5
+ const authCookies = {
6
+ parse: jest.fn(),
7
+ build: jest.fn(),
8
+ };
9
+ const postOAuth2Token = jest.fn();
10
+ const postAuthRefresh = await initPostAuthRefresh({
11
+ ROOT_AUTHENTICATION_DATA: {
12
+ scope: 'user',
13
+ applicationId: 'root_app_id',
14
+ },
15
+ authCookies,
16
+ postOAuth2Token,
17
+ });
18
+ authCookies.parse.mockReturnValueOnce({
19
+ access_token: 'an_access_token',
20
+ refresh_token: 'a_refresh_token',
21
+ });
22
+ authCookies.build.mockReturnValueOnce(['the_build_cookies']);
23
+ postOAuth2Token.mockResolvedValueOnce({
24
+ status: 200,
25
+ body: {
26
+ access_token: 'an_access_token',
27
+ expiration_date: '2020-02-02T20:22:02Z',
28
+ expires_in: 3600,
29
+ token_type: 'bearer',
30
+ },
31
+ });
32
+ const response = await postAuthRefresh({
33
+ cookie: 'a_given_cookie',
34
+ body: {
35
+ remember: false,
36
+ scope: 'user',
37
+ },
38
+ });
39
+ expect({
40
+ response,
41
+ authCookiesParseCalls: authCookies.parse.mock.calls,
42
+ authCookiesBuildCalls: authCookies.build.mock.calls,
43
+ postOAuth2TokenCalls: postOAuth2Token.mock.calls,
44
+ }).toMatchInlineSnapshot(`
49
45
  Object {
50
46
  "authCookiesBuildCalls": Array [
51
47
  Array [
@@ -88,12 +84,14 @@ describe('postAuthRefresh', () => {
88
84
  "token_type": "bearer",
89
85
  },
90
86
  "headers": Object {
91
- "Set-Cookie": "the_build_cookies",
87
+ "Set-Cookie": Array [
88
+ "the_build_cookies",
89
+ ],
92
90
  },
93
91
  "status": 200,
94
92
  },
95
93
  }
96
94
  `);
97
- });
95
+ });
98
96
  });
99
97
  //# sourceMappingURL=postAuthRefresh.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postAuthRefresh.test.js","names":["describe","test","authCookies","parse","jest","fn","build","postOAuth2Token","postAuthRefresh","initPostAuthRefresh","ROOT_AUTHENTICATION_DATA","scope","applicationId","mockReturnValueOnce","access_token","refresh_token","mockResolvedValueOnce","status","body","expiration_date","expires_in","token_type","response","cookie","remember","expect","authCookiesParseCalls","mock","calls","authCookiesBuildCalls","postOAuth2TokenCalls","toMatchInlineSnapshot"],"sources":["../../src/handlers/postAuthRefresh.test.ts"],"sourcesContent":["import initPostAuthRefresh from './postAuthRefresh';\n\ndescribe('postAuthRefresh', () => {\n test('should work', async () => {\n const authCookies = {\n parse: jest.fn(),\n build: jest.fn(),\n };\n const postOAuth2Token = jest.fn();\n const postAuthRefresh = await initPostAuthRefresh({\n ROOT_AUTHENTICATION_DATA: {\n scope: 'user',\n applicationId: 'root_app_id',\n },\n authCookies,\n postOAuth2Token,\n });\n\n authCookies.parse.mockReturnValueOnce({\n access_token: 'an_access_token',\n refresh_token: 'a_refresh_token',\n });\n authCookies.build.mockReturnValueOnce('the_build_cookies');\n postOAuth2Token.mockResolvedValueOnce({\n status: 200,\n body: {\n access_token: 'an_access_token',\n expiration_date: '2020-02-02T20:22:02Z',\n expires_in: 3600,\n token_type: 'bearer',\n },\n });\n\n const response = await postAuthRefresh({\n cookie: 'a_given_cookie',\n body: {\n remember: false,\n scope: 'user',\n },\n });\n\n expect({\n response,\n authCookiesParseCalls: authCookies.parse.mock.calls,\n authCookiesBuildCalls: authCookies.build.mock.calls,\n postOAuth2TokenCalls: postOAuth2Token.mock.calls,\n }).toMatchInlineSnapshot(`\n Object {\n \"authCookiesBuildCalls\": Array [\n Array [\n Object {\n \"access_token\": \"an_access_token\",\n \"expiration_date\": \"2020-02-02T20:22:02Z\",\n \"expires_in\": 3600,\n \"token_type\": \"bearer\",\n },\n Object {\n \"session\": true,\n },\n ],\n ],\n \"authCookiesParseCalls\": Array [\n Array [\n \"a_given_cookie\",\n ],\n ],\n \"postOAuth2TokenCalls\": Array [\n Array [\n Object {\n \"authenticationData\": Object {\n \"applicationId\": \"root_app_id\",\n \"scope\": \"user\",\n },\n \"body\": Object {\n \"grant_type\": \"refresh_token\",\n \"refresh_token\": \"a_refresh_token\",\n \"scope\": \"user\",\n },\n },\n ],\n ],\n \"response\": Object {\n \"body\": Object {\n \"access_token\": \"an_access_token\",\n \"expiration_date\": \"2020-02-02T20:22:02Z\",\n \"expires_in\": 3600,\n \"token_type\": \"bearer\",\n },\n \"headers\": Object {\n \"Set-Cookie\": \"the_build_cookies\",\n },\n \"status\": 200,\n },\n }\n `);\n });\n});\n"],"mappings":";;AAAA;;;;AAEAA,QAAQ,CAAC,iBAAD,EAAoB,MAAM;EAChCC,IAAI,CAAC,aAAD,EAAgB,YAAY;IAC9B,MAAMC,WAAW,GAAG;MAClBC,KAAK,EAAEC,IAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KArDI;EAsDD,CA5FG,CAAJ;AA6FD,CA9FO,CAAR"}
1
+ {"version":3,"file":"postAuthRefresh.test.js","sourceRoot":"","sources":["../../src/handlers/postAuthRefresh.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,mBAAmB,MAAM,sBAAsB,CAAC;AAGvD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,WAAW,GAAG;YAClB,KAAK,EAAE,IAAI,CAAC,EAAE,EAA+B;YAC7C,KAAK,EAAE,IAAI,CAAC,EAAE,EAA+B;SAC9C,CAAC;QACF,MAAM,eAAe,GAAG,IAAI,CAAC,EAAE,EAAO,CAAC;QACvC,MAAM,eAAe,GAAG,MAAM,mBAAmB,CAAC;YAChD,wBAAwB,EAAE;gBACxB,KAAK,EAAE,MAAM;gBACb,aAAa,EAAE,aAAa;aAC7B;YACD,WAAW;YACX,eAAe;SAChB,CAAC,CAAC;QAEH,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC;YACpC,YAAY,EAAE,iBAAiB;YAC/B,aAAa,EAAE,iBAAiB;SACjC,CAAC,CAAC;QACH,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAC7D,eAAe,CAAC,qBAAqB,CAAC;YACpC,MAAM,EAAE,GAAG;YACX,IAAI,EAAE;gBACJ,YAAY,EAAE,iBAAiB;gBAC/B,eAAe,EAAE,sBAAsB;gBACvC,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,QAAQ;aACrB;SACF,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC;YACrC,MAAM,EAAE,gBAAgB;YACxB,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;gBACf,KAAK,EAAE,MAAM;aACd;SACF,CAAC,CAAC;QAEH,MAAM,CAAC;YACL,QAAQ;YACR,qBAAqB,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK;YACnD,qBAAqB,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK;YACnD,oBAAoB,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK;SACjD,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkDxB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import type { WhookAPIHandlerDefinition, WhookErrorsDescriptors } from '@whook/whook';
2
- import type { CheckApplicationService, OAuth2GranterService } from '../services/oAuth2Granters';
2
+ import type { CheckApplicationService, OAuth2GranterService } from '../services/oAuth2Granters.js';
3
3
  import type { LogService } from 'common-services';
4
4
  import type { BaseAuthenticationData } from '@whook/authorization';
5
5
  export declare const definition: WhookAPIHandlerDefinition;
6
- export declare type HandlerDependencies = {
6
+ export declare type HandlerDependencies<AUTHENTICATION_DATA extends BaseAuthenticationData<string, string>> = {
7
7
  ERRORS_DESCRIPTORS: WhookErrorsDescriptors;
8
- oAuth2Granters: OAuth2GranterService[];
8
+ oAuth2Granters: OAuth2GranterService<Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, AUTHENTICATION_DATA>[];
9
9
  checkApplication: CheckApplicationService;
10
10
  log: LogService;
11
11
  };
@@ -21,9 +21,9 @@ declare type HandlerParameters<AUTHENTICATION_DATA> = {
21
21
  [name: string]: unknown;
22
22
  };
23
23
  };
24
- declare const _default: <AUTHENTICATION_DATA extends BaseAuthenticationData<string, string> = BaseAuthenticationData<string, string>>(dependencies: HandlerDependencies) => (parameters: HandlerParameters<AUTHENTICATION_DATA>) => ReturnType<typeof postOAuth2Acknowledge>;
24
+ declare const _default: <AUTHENTICATION_DATA extends BaseAuthenticationData<string, string> = BaseAuthenticationData<string, string>>(dependencies: HandlerDependencies<AUTHENTICATION_DATA>) => (parameters: HandlerParameters<AUTHENTICATION_DATA>) => ReturnType<typeof postOAuth2Acknowledge>;
25
25
  export default _default;
26
- declare function postOAuth2Acknowledge<AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData>({ ERRORS_DESCRIPTORS, oAuth2Granters, checkApplication, log, }: HandlerDependencies, { authenticationData, body: { responseType, clientId, redirectURI, scope: demandedScope, state, acknowledged, ...additionalParameters }, }: HandlerParameters<AUTHENTICATION_DATA>): Promise<{
26
+ declare function postOAuth2Acknowledge<AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData>({ ERRORS_DESCRIPTORS, oAuth2Granters, checkApplication, log, }: HandlerDependencies<AUTHENTICATION_DATA>, { authenticationData, body: { responseType, clientId, redirectURI, scope: demandedScope, state, acknowledged, ...additionalParameters }, }: HandlerParameters<AUTHENTICATION_DATA>): Promise<{
27
27
  status: number;
28
28
  headers: {
29
29
  location: string;
@@ -1,165 +1,133 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.definition = exports.default = void 0;
7
-
8
- var _knifecycle = require("knifecycle");
9
-
10
- var _yerror = _interopRequireDefault(require("yerror"));
11
-
12
- var _getOAuth2Authorize = require("./getOAuth2Authorize");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
1
+ import { autoHandler } from 'knifecycle';
2
+ import { YError } from 'yerror';
3
+ import { setURLError } from './getOAuth2Authorize.js';
16
4
  /* Architecture Note #2: OAuth2 acknowledge
17
5
  This endpoint is to be used by the authentication SSR frontend
18
6
  to acknowlege that the user accepted the client request in it.
19
7
  */
20
- const definition = {
21
- method: 'post',
22
- path: '/oauth2/acknowledge',
23
- operation: {
24
- operationId: 'postOAuth2Acknowledge',
25
- summary: `Implements the logic that allow the authentication frontend
8
+ export const definition = {
9
+ method: 'post',
10
+ path: '/oauth2/acknowledge',
11
+ operation: {
12
+ operationId: 'postOAuth2Acknowledge',
13
+ summary: `Implements the logic that allow the authentication frontend
26
14
  to get the [Redirection Endpoint](https://tools.ietf.org/html/rfc6749#section-3.1.2).`,
27
- tags: ['oauth2'],
28
- 'x-whook': {
29
- private: true
15
+ tags: ['oauth2'],
16
+ 'x-whook': {
17
+ private: true,
18
+ },
19
+ requestBody: {
20
+ required: true,
21
+ content: {
22
+ 'application/json': {
23
+ schema: {
24
+ type: 'object',
25
+ required: [
26
+ 'responseType',
27
+ 'clientId',
28
+ 'redirectURI',
29
+ 'scope',
30
+ 'state',
31
+ 'acknowledged',
32
+ ],
33
+ properties: {
34
+ responseType: {
35
+ type: 'string',
36
+ },
37
+ clientId: {
38
+ type: 'string',
39
+ },
40
+ redirectURI: {
41
+ type: 'string',
42
+ pattern: '^https?://',
43
+ format: 'uri',
44
+ },
45
+ scope: {
46
+ type: 'string',
47
+ description: 'See https://tools.ietf.org/html/rfc6749#section-3.3',
48
+ },
49
+ state: {
50
+ type: 'string',
51
+ },
52
+ acknowledged: {
53
+ type: 'boolean',
54
+ description: 'Wether the user acknowledged the delegation or not.',
55
+ },
56
+ },
57
+ },
58
+ },
59
+ },
60
+ },
61
+ responses: {
62
+ '201': {
63
+ description: 'Redirection endpoint URI computed.',
64
+ content: {
65
+ 'application/json': {
66
+ schema: {
67
+ type: 'object',
68
+ required: ['redirectURI'],
69
+ properties: {
70
+ redirectURI: {
71
+ type: 'string',
72
+ pattern: '^https?://',
73
+ format: 'uri',
74
+ },
75
+ },
76
+ },
77
+ },
78
+ },
79
+ },
80
+ },
30
81
  },
31
- requestBody: {
32
- required: true,
33
- content: {
34
- 'application/json': {
35
- schema: {
36
- type: 'object',
37
- required: ['responseType', 'clientId', 'redirectURI', 'scope', 'state', 'acknowledged'],
38
- properties: {
39
- responseType: {
40
- type: 'string'
41
- },
42
- clientId: {
43
- type: 'string'
44
- },
45
- redirectURI: {
46
- type: 'string',
47
- pattern: '^https?://',
48
- format: 'uri'
49
- },
50
- scope: {
51
- type: 'string',
52
- description: 'See https://tools.ietf.org/html/rfc6749#section-3.3'
53
- },
54
- state: {
55
- type: 'string'
56
- },
57
- acknowledged: {
58
- type: 'boolean',
59
- description: 'Wether the user acknowledged the delegation or not.'
60
- }
61
- }
62
- }
63
- }
64
- }
65
- },
66
- responses: {
67
- '201': {
68
- description: 'Redirection endpoint URI computed.',
69
- content: {
70
- 'application/json': {
71
- schema: {
72
- type: 'object',
73
- required: ['redirectURI'],
74
- properties: {
75
- redirectURI: {
76
- type: 'string',
77
- pattern: '^https?://',
78
- format: 'uri'
79
- }
80
- }
81
- }
82
- }
83
- }
84
- }
85
- }
86
- }
87
82
  };
88
- exports.definition = definition;
89
-
90
- var _default = (0, _knifecycle.handler)(postOAuth2Acknowledge, "postOAuth2Acknowledge", ["ERRORS_DESCRIPTORS", "oAuth2Granters", "checkApplication", "log"]);
91
-
92
- exports.default = _default;
93
-
94
- async function postOAuth2Acknowledge({
95
- ERRORS_DESCRIPTORS,
96
- oAuth2Granters,
97
- checkApplication,
98
- log
99
- }, {
100
- authenticationData,
101
- body: {
102
- responseType,
103
- clientId,
104
- redirectURI,
105
- scope: demandedScope,
106
- state,
107
- acknowledged = false,
108
- ...additionalParameters
109
- }
110
- }) {
111
- if (!authenticationData) {
112
- throw new _yerror.default('E_UNAUTHORIZED');
113
- } // Here we check the applicationId has the right to authenticate a user
114
- // with the special type 'root'
115
-
116
-
117
- await checkApplication({
118
- applicationId: authenticationData.applicationId,
119
- type: 'root',
120
- scope: ''
121
- });
122
- const url = new URL(redirectURI);
123
-
124
- try {
125
- if (!acknowledged) {
126
- throw new _yerror.default('E_ACCESS_DENIED', clientId);
83
+ export default autoHandler(postOAuth2Acknowledge);
84
+ async function postOAuth2Acknowledge({ ERRORS_DESCRIPTORS, oAuth2Granters, checkApplication, log, }, { authenticationData, body: { responseType, clientId, redirectURI, scope: demandedScope, state, acknowledged = false, ...additionalParameters }, }) {
85
+ if (!authenticationData) {
86
+ throw new YError('E_UNAUTHORIZED');
127
87
  }
128
-
129
- const granter = oAuth2Granters.find(granter => granter.acknowledger && granter.acknowledger.acknowledgmentType === responseType);
130
-
131
- if (!granter || !granter.acknowledger) {
132
- throw new _yerror.default('E_UNKNOWN_ACKNOWLEDGOR_TYPE', responseType);
88
+ // Here we check the applicationId has the right to authenticate a user
89
+ // with the special type 'root'
90
+ await checkApplication({
91
+ applicationId: authenticationData.applicationId,
92
+ type: 'root',
93
+ scope: '',
94
+ });
95
+ const url = new URL(redirectURI);
96
+ try {
97
+ if (!acknowledged) {
98
+ throw new YError('E_ACCESS_DENIED', clientId);
99
+ }
100
+ const granter = oAuth2Granters.find((granter) => granter.acknowledger &&
101
+ granter.acknowledger.acknowledgmentType === responseType);
102
+ if (!granter || !granter.acknowledger) {
103
+ throw new YError('E_UNKNOWN_ACKNOWLEDGOR_TYPE', responseType);
104
+ }
105
+ const { applicationId, scope, ...additionalProperties } = await granter.acknowledger.acknowledge(authenticationData, {
106
+ clientId,
107
+ redirectURI,
108
+ scope: demandedScope,
109
+ }, additionalParameters);
110
+ url.searchParams.set('client_id', applicationId);
111
+ url.searchParams.set('scope', scope);
112
+ url.searchParams.set('state', state);
113
+ Object.keys(additionalProperties).forEach((key) => url.searchParams.set(snakeCase(key), additionalProperties[key]));
133
114
  }
134
-
135
- const {
136
- applicationId,
137
- scope,
138
- ...additionalProperties
139
- } = await granter.acknowledger.acknowledge(authenticationData, {
140
- clientId,
141
- redirectURI,
142
- scope: demandedScope
143
- }, additionalParameters);
144
- url.searchParams.set('client_id', applicationId);
145
- url.searchParams.set('scope', scope);
146
- url.searchParams.set('state', state);
147
- Object.keys(additionalProperties).forEach(key => url.searchParams.set(snakeCase(key), additionalProperties[key]));
148
- } catch (err) {
149
- log('debug', '👫 - OAuth2 acknowledge error', err.code);
150
- log('debug-stack', err.stack || 'no_stack_trace');
151
- (0, _getOAuth2Authorize.setURLError)(url, err, ERRORS_DESCRIPTORS[err.code] || ERRORS_DESCRIPTORS.E_OAUTH2);
152
- }
153
-
154
- return {
155
- status: 302,
156
- headers: {
157
- location: url.href
115
+ catch (err) {
116
+ log('debug', '👫 - OAuth2 acknowledge error', err.code);
117
+ log('debug-stack', err.stack || 'no_stack_trace');
118
+ setURLError(url, err, ERRORS_DESCRIPTORS[err.code] || ERRORS_DESCRIPTORS.E_OAUTH2);
158
119
  }
159
- };
120
+ return {
121
+ status: 302,
122
+ headers: {
123
+ location: url.href,
124
+ },
125
+ };
160
126
  }
161
-
162
127
  function snakeCase(s) {
163
- return s.split(/(?=(?<![A-Z])[A-Z])|[^a-zA-Z]+/).map(s => s.toLowerCase()).join('_');
128
+ return s
129
+ .split(/(?=(?<![A-Z])[A-Z])|[^a-zA-Z]+/)
130
+ .map((s) => s.toLowerCase())
131
+ .join('_');
164
132
  }
165
133
  //# sourceMappingURL=postOAuth2Acknowledge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postOAuth2Acknowledge.js","names":["definition","method","path","operation","operationId","summary","tags","private","requestBody","required","content","schema","type","properties","responseType","clientId","redirectURI","pattern","format","scope","description","state","acknowledged","responses","autoHandler","postOAuth2Acknowledge","ERRORS_DESCRIPTORS","oAuth2Granters","checkApplication","log","authenticationData","body","demandedScope","additionalParameters","YError","applicationId","url","URL","granter","find","acknowledger","acknowledgmentType","additionalProperties","acknowledge","searchParams","set","Object","keys","forEach","key","snakeCase","err","code","stack","setURLError","E_OAUTH2","status","headers","location","href","s","split","map","toLowerCase","join"],"sources":["../../src/handlers/postOAuth2Acknowledge.ts"],"sourcesContent":["import { autoHandler } from 'knifecycle';\nimport YError from 'yerror';\nimport { setURLError } from './getOAuth2Authorize';\nimport type {\n WhookAPIHandlerDefinition,\n WhookErrorsDescriptors,\n} from '@whook/whook';\nimport type {\n CheckApplicationService,\n OAuth2GranterService,\n} from '../services/oAuth2Granters';\nimport type { LogService } from 'common-services';\nimport type { BaseAuthenticationData } from '@whook/authorization';\n\n/* Architecture Note #2: OAuth2 acknowledge\nThis endpoint is to be used by the authentication SSR frontend\n to acknowlege that the user accepted the client request in it.\n*/\n\nexport const definition: WhookAPIHandlerDefinition = {\n method: 'post',\n path: '/oauth2/acknowledge',\n operation: {\n operationId: 'postOAuth2Acknowledge',\n summary: `Implements the logic that allow the authentication frontend\n to get the [Redirection Endpoint](https://tools.ietf.org/html/rfc6749#section-3.1.2).`,\n tags: ['oauth2'],\n 'x-whook': {\n private: true,\n },\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n required: [\n 'responseType',\n 'clientId',\n 'redirectURI',\n 'scope',\n 'state',\n 'acknowledged',\n ],\n properties: {\n responseType: {\n type: 'string',\n },\n clientId: {\n type: 'string',\n },\n redirectURI: {\n type: 'string',\n pattern: '^https?://',\n format: 'uri',\n },\n scope: {\n type: 'string',\n description:\n 'See https://tools.ietf.org/html/rfc6749#section-3.3',\n },\n state: {\n type: 'string',\n },\n acknowledged: {\n type: 'boolean',\n description:\n 'Wether the user acknowledged the delegation or not.',\n },\n },\n },\n },\n },\n },\n responses: {\n '201': {\n description: 'Redirection endpoint URI computed.',\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n required: ['redirectURI'],\n properties: {\n redirectURI: {\n type: 'string',\n pattern: '^https?://',\n format: 'uri',\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nexport type HandlerDependencies = {\n ERRORS_DESCRIPTORS: WhookErrorsDescriptors;\n oAuth2Granters: OAuth2GranterService[];\n checkApplication: CheckApplicationService;\n log: LogService;\n};\ntype HandlerParameters<AUTHENTICATION_DATA> = {\n authenticationData: AUTHENTICATION_DATA;\n body: {\n responseType: string;\n clientId: string;\n redirectURI: string;\n scope: string;\n state: string;\n acknowledged: boolean;\n [name: string]: unknown;\n };\n};\n\nexport default autoHandler(postOAuth2Acknowledge) as unknown as <\n AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData,\n>(\n dependencies: HandlerDependencies,\n) => (\n parameters: HandlerParameters<AUTHENTICATION_DATA>,\n) => ReturnType<typeof postOAuth2Acknowledge>;\n\nasync function postOAuth2Acknowledge<\n AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData,\n>(\n {\n ERRORS_DESCRIPTORS,\n oAuth2Granters,\n checkApplication,\n log,\n }: HandlerDependencies,\n {\n authenticationData,\n body: {\n responseType,\n clientId,\n redirectURI,\n scope: demandedScope,\n state,\n acknowledged = false,\n ...additionalParameters\n },\n }: HandlerParameters<AUTHENTICATION_DATA>,\n) {\n if (!authenticationData) {\n throw new YError('E_UNAUTHORIZED');\n }\n\n // Here we check the applicationId has the right to authenticate a user\n // with the special type 'root'\n await checkApplication({\n applicationId: authenticationData.applicationId,\n type: 'root',\n scope: '',\n });\n\n const url = new URL(redirectURI);\n\n try {\n if (!acknowledged) {\n throw new YError('E_ACCESS_DENIED', clientId);\n }\n\n const granter = oAuth2Granters.find(\n (granter) =>\n granter.acknowledger &&\n granter.acknowledger.acknowledgmentType === responseType,\n );\n\n if (!granter || !granter.acknowledger) {\n throw new YError('E_UNKNOWN_ACKNOWLEDGOR_TYPE', responseType);\n }\n\n const { applicationId, scope, ...additionalProperties } =\n await granter.acknowledger.acknowledge(\n authenticationData,\n {\n clientId,\n redirectURI,\n scope: demandedScope,\n },\n additionalParameters,\n );\n\n url.searchParams.set('client_id', applicationId);\n url.searchParams.set('scope', scope);\n url.searchParams.set('state', state);\n Object.keys(additionalProperties).forEach((key) =>\n url.searchParams.set(snakeCase(key), additionalProperties[key] as string),\n );\n } catch (err) {\n log('debug', '👫 - OAuth2 acknowledge error', (err as YError).code);\n log('debug-stack', (err as Error).stack || 'no_stack_trace');\n\n setURLError(\n url,\n err as YError,\n ERRORS_DESCRIPTORS[(err as YError).code] || ERRORS_DESCRIPTORS.E_OAUTH2,\n );\n }\n\n return {\n status: 302,\n headers: {\n location: url.href,\n },\n };\n}\n\nfunction snakeCase(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