@whook/oauth2 9.0.1 → 10.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.
Files changed (131) hide show
  1. package/README.md +20 -15
  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 +15 -15
  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 +1 -0
  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 +46 -88
  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 +15 -15
  78. package/src/services/authCookies.test.ts +2 -2
  79. package/src/services/authCookies.ts +2 -1
  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,153 +1,156 @@
1
- "use strict";
2
-
3
- var _postOAuth2Token = _interopRequireDefault(require("./postOAuth2Token"));
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
- const log = jest.fn();
11
- const time = jest.fn();
12
- const oAuth2AccessToken = {
13
- create: jest.fn(),
14
- check: jest.fn()
15
- };
16
- const oAuth2RefreshToken = {
17
- create: jest.fn(),
18
- check: jest.fn()
19
- };
20
- const codeGranter = {
21
- type: 'code',
22
- authorizer: {
23
- responseType: 'code',
24
- authorize: jest.fn()
25
- },
26
- acknowledger: {
27
- acknowledgmentType: 'code',
28
- acknowledge: jest.fn()
29
- },
30
- authenticator: {
31
- grantType: 'authorization_code',
32
- authenticate: jest.fn()
33
- }
34
- };
35
- const passwordGranter = {
36
- type: 'password',
37
- authenticator: {
38
- grantType: 'password',
39
- authenticate: jest.fn()
40
- }
41
- };
42
- const clientCredentialsGranter = {
43
- type: 'client_credentials',
44
- authenticator: {
45
- grantType: 'client_credentials',
46
- authenticate: jest.fn()
47
- }
48
- };
49
- const tokenGranter = {
50
- type: 'token',
51
- authorizer: {
52
- responseType: 'token',
53
- authorize: jest.fn()
54
- },
55
- acknowledger: {
56
- acknowledgmentType: 'token',
57
- acknowledge: jest.fn()
58
- }
59
- };
60
- const refreshTokenGranter = {
61
- type: 'refresh',
62
- authenticator: {
63
- grantType: 'refresh',
64
- authenticate: jest.fn()
65
- }
66
- };
67
- const oAuth2Granters = [codeGranter, tokenGranter, passwordGranter, refreshTokenGranter, clientCredentialsGranter];
68
- beforeEach(() => {
69
- log.mockReset();
70
- time.mockReset();
71
- oAuth2AccessToken.create.mockReset();
72
- oAuth2AccessToken.check.mockReset();
73
- oAuth2RefreshToken.create.mockReset();
74
- oAuth2RefreshToken.check.mockReset();
75
- codeGranter.authorizer.authorize.mockReset();
76
- codeGranter.acknowledger.acknowledge.mockReset();
77
- codeGranter.authenticator.authenticate.mockReset();
78
- tokenGranter.authorizer.authorize.mockReset();
79
- tokenGranter.acknowledger.acknowledge.mockReset();
80
- passwordGranter.authenticator.authenticate.mockReset();
81
- refreshTokenGranter.authenticator.authenticate.mockReset();
82
- clientCredentialsGranter.authenticator.authenticate.mockReset();
83
- });
84
- test('should create a token', async () => {
85
- time.mockReturnValue(new Date('2010-03-06T00:00:00Z').getTime());
86
- oAuth2AccessToken.create.mockResolvedValueOnce({
87
- token: 'an_access_token',
88
- expiresAt: Date.parse('2010-03-07T00:00:00Z')
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
- expect({
117
- response,
118
- oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,
119
- oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,
120
- logCalls: log.mock.calls.filter(([type]) => !type.endsWith('stack'))
121
- }).toMatchSnapshot();
122
- });
123
- test('should fail with a bad grant type', async () => {
124
- const postOAuth2Token = await (0, _postOAuth2Token.default)({
125
- oAuth2Granters,
126
- oAuth2AccessToken,
127
- oAuth2RefreshToken,
128
- time,
129
- log
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
- try {
133
- await postOAuth2Token({
134
- authenticationData: {
135
- applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
136
- scope: 'user'
137
- },
138
- body: {
139
- grant_type: 'yolo',
140
- code: '007',
141
- client_id: 'abbacaca-abba-caca-abba-cacaabbacaca',
142
- redirect_uri: 'http://lol'
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
- throw new _yerror.default('E_UNEXPECTED_SUCCESS');
146
- } catch (err) {
147
- expect({
148
- errorCode: err.code,
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
- expect({
159
- oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,
160
- oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,
161
- logCalls: log.mock.calls.filter(([type]) => !type.endsWith('stack'))
162
- }).toMatchSnapshot();
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","names":["describe","log","jest","fn","time","oAuth2AccessToken","create","check","oAuth2RefreshToken","codeGranter","type","authorizer","responseType","authorize","acknowledger","acknowledgmentType","acknowledge","authenticator","grantType","authenticate","passwordGranter","clientCredentialsGranter","tokenGranter","refreshTokenGranter","oAuth2Granters","beforeEach","mockReset","test","mockReturnValue","Date","getTime","mockResolvedValueOnce","token","expiresAt","parse","applicationId","postOAuth2Token","initPostOAuth2Token","response","authenticationData","scope","body","grant_type","code","client_id","redirect_uri","expect","oAuth2AccessTokenCreateCalls","mock","calls","oAuth2RefreshTokenCreateCalls","logCalls","filter","endsWith","toMatchSnapshot","YError","err","errorCode","errorParams","params","toMatchInlineSnapshot"],"sources":["../../src/handlers/postOAuth2Token.test.ts"],"sourcesContent":["import initPostOAuth2Token from './postOAuth2Token';\nimport YError from 'yerror';\nimport type { OAuth2GranterService } from '..';\n\ndescribe('postOAuth2Token', () => {\n const log = jest.fn();\n const time = jest.fn();\n const oAuth2AccessToken = { create: jest.fn(), check: jest.fn() };\n const oAuth2RefreshToken = { create: jest.fn(), check: jest.fn() };\n const codeGranter = {\n type: 'code',\n authorizer: { responseType: 'code', authorize: jest.fn() },\n acknowledger: { acknowledgmentType: 'code', acknowledge: jest.fn() },\n authenticator: {\n grantType: 'authorization_code',\n authenticate: jest.fn(),\n },\n };\n const passwordGranter = {\n type: 'password',\n authenticator: {\n grantType: 'password',\n authenticate: jest.fn(),\n },\n };\n const clientCredentialsGranter = {\n type: 'client_credentials',\n authenticator: {\n grantType: 'client_credentials',\n authenticate: jest.fn(),\n },\n };\n const tokenGranter = {\n type: 'token',\n authorizer: { responseType: 'token', authorize: jest.fn() },\n acknowledger: { acknowledgmentType: 'token', acknowledge: jest.fn() },\n };\n const refreshTokenGranter = {\n type: 'refresh',\n authenticator: {\n grantType: 'refresh',\n authenticate: jest.fn(),\n },\n };\n const oAuth2Granters: OAuth2GranterService[] = [\n codeGranter,\n tokenGranter,\n passwordGranter,\n refreshTokenGranter,\n clientCredentialsGranter,\n ];\n\n beforeEach(() => {\n log.mockReset();\n time.mockReset();\n oAuth2AccessToken.create.mockReset();\n oAuth2AccessToken.check.mockReset();\n oAuth2RefreshToken.create.mockReset();\n oAuth2RefreshToken.check.mockReset();\n codeGranter.authorizer.authorize.mockReset();\n codeGranter.acknowledger.acknowledge.mockReset();\n codeGranter.authenticator.authenticate.mockReset();\n tokenGranter.authorizer.authorize.mockReset();\n tokenGranter.acknowledger.acknowledge.mockReset();\n passwordGranter.authenticator.authenticate.mockReset();\n refreshTokenGranter.authenticator.authenticate.mockReset();\n clientCredentialsGranter.authenticator.authenticate.mockReset();\n });\n\n test('should create a token', async () => {\n time.mockReturnValue(new Date('2010-03-06T00:00:00Z').getTime());\n oAuth2AccessToken.create.mockResolvedValueOnce({\n token: 'an_access_token',\n expiresAt: Date.parse('2010-03-07T00:00:00Z'),\n });\n oAuth2RefreshToken.create.mockResolvedValueOnce({\n token: 'a_refresh_token',\n expiresAt: Date.parse('2180-03-06T00:00:00Z'),\n });\n codeGranter.authorizer.authorize.mockResolvedValueOnce({\n applicationId: '',\n });\n\n const postOAuth2Token = await initPostOAuth2Token({\n oAuth2Granters,\n oAuth2AccessToken,\n oAuth2RefreshToken,\n time,\n log,\n });\n const response = await postOAuth2Token({\n authenticationData: {\n applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',\n scope: 'user',\n },\n body: {\n grant_type: 'authorization_code',\n code: '007',\n client_id: 'abbacaca-abba-caca-abba-cacaabbacaca',\n redirect_uri: 'http://lol',\n },\n });\n expect({\n response,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n logCalls: log.mock.calls.filter(([type]) => !type.endsWith('stack')),\n }).toMatchSnapshot();\n });\n\n test('should fail with a bad grant type', async () => {\n const postOAuth2Token = await initPostOAuth2Token({\n oAuth2Granters,\n oAuth2AccessToken,\n oAuth2RefreshToken,\n time,\n log,\n });\n\n try {\n await postOAuth2Token({\n authenticationData: {\n applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',\n scope: 'user',\n },\n body: {\n grant_type: 'yolo',\n code: '007',\n client_id: 'abbacaca-abba-caca-abba-cacaabbacaca',\n redirect_uri: 'http://lol',\n },\n });\n throw new YError('E_UNEXPECTED_SUCCESS');\n } catch (err) {\n expect({\n errorCode: (err as YError).code,\n errorParams: (err as YError).params,\n }).toMatchInlineSnapshot(`\n Object {\n \"errorCode\": \"E_UNKNOWN_AUTHENTICATOR_TYPE\",\n \"errorParams\": Array [\n \"yolo\",\n ],\n }\n `);\n expect({\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n logCalls: log.mock.calls.filter(([type]) => !type.endsWith('stack')),\n }).toMatchSnapshot();\n }\n });\n});\n"],"mappings":";;AAAA;;AACA;;;;AAGAA,QAAQ,CAAC,iBAAD,EAAoB,MAAM;EAChC,MAAMC,GAAG,GAAGC,IAAI,CAACC,EAAL,EAAZ;EACA,MAAMC,IAAI,GAAGF,IAAI,CAACC,EAAL,EAAb;EACA,MAAME,iBAAiB,GAAG;IAAEC,MAAM,EAAEJ,IAAI,CAACC,EAAL,EAAV;IAAqBI,KAAK,EAAEL,IAAI,CAACC,EAAL;EAA5B,CAA1B;EACA,MAAMK,kBAAkB,GAAG;IAAEF,MAAM,EAAEJ,IAAI,CAACC,EAAL,EAAV;IAAqBI,KAAK,EAAEL,IAAI,CAACC,EAAL;EAA5B,CAA3B;EACA,MAAMM,WAAW,GAAG;IAClBC,IAAI,EAAE,MADY;IAElBC,UAAU,EAAE;MAAEC,YAAY,EAAE,MAAhB;MAAwBC,SAAS,EAAEX,IAAI,CAACC,EAAL;IAAnC,CAFM;IAGlBW,YAAY,EAAE;MAAEC,kBAAkB,EAAE,MAAtB;MAA8BC,WAAW,EAAEd,IAAI,CAACC,EAAL;IAA3C,CAHI;IAIlBc,aAAa,EAAE;MACbC,SAAS,EAAE,oBADE;MAEbC,YAAY,EAAEjB,IAAI,CAACC,EAAL;IAFD;EAJG,C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C;gBACL,4BAA4B,EAAE,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, };