@whook/oauth2 9.0.1 → 10.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +0,0 @@
1
- {"version":3,"file":"index.test.mjs","names":["runServer","prepareServer","prepareEnvironment","basePrepareEnvironment","DEFAULT_ERRORS_DESCRIPTORS","AUTHORIZATION_ERRORS_DESCRIPTORS","wrapHandlerWithAuthorization","constant","initializer","axios","YError","BEARER","BEARER_MECHANISM","BASIC","BASIC_MECHANISM","initGetOAuth2Authorize","getOAuth2AuthorizeDefinition","getOAuth2AuthorizeResponseTypeParameter","getOAuth2AuthorizeClientIdParameter","getOAuth2AuthorizeRedirectURIParameter","getOAuth2AuthorizeScopeParameter","getOAuth2AuthorizeStateParameter","initPostOAuth2Acknowledge","postOAuth2AcknowledgeDefinition","initPostOAuth2Token","postOAuth2TokenDefinition","OAUTH2_ERRORS_DESCRIPTORS","initOAuth2CodeGranter","initOAuth2PasswordGranter","initOAuth2RefreshTokenGranter","initOAuth2Granters","initOAuth2ClientCredentialsGranter","initOAuth2TokenGranter","postOAuth2TokenAuthorizationCodeTokenRequestBodySchema","postOAuth2TokenPasswordTokenRequestBodySchema","postOAuth2TokenClientCredentialsTokenRequestBodySchema","postOAuth2TokenTokenBodySchema","postOAuth2TokenRefreshTokenRequestBodySchema","describe","BASE_PATH","PORT","HOST","logger","output","jest","fn","error","debug","time","$autoload","API","openapi","info","version","title","description","paths","path","method","operation","security","bearerAuth","basicAuth","components","securitySchemes","type","scheme","parameters","reduce","parametersHash","name","parameter","schemas","schemasHash","schema","OAUTH2","authenticateURL","authentication","check","checkApplication","oAuth2AccessToken","create","oAuth2RefreshToken","oAuth2ClientCredentials","oAuth2Code","oAuth2Password","$instance","$","register","singleton","inject","services","forEach","handlerInitializer","mockImplementation","serviceName","process","env","ISOLATED_ENV","beforeAll","_instance","afterAll","destroy","beforeEach","mockReset","mockClear","mock","it","mockReturnValue","Date","parse","mockRejectedValueOnce","mockResolvedValueOnce","applicationId","scope","undefined","userId","token","expiresAt","status","headers","data","url","authorization","Buffer","from","toString","grant_type","username","password","validateStatus","expect","date","toMatchInlineSnapshot","checkApplicationCalls","calls","authenticationCheckCalls","oAuth2AccessTokenCreateCalls","oAuth2AccessTokenCheckCalls","oAuth2RefreshTokenCreateCalls","oAuth2RefreshTokenCheckCalls","oAuth2ClientCredentialsCheckCalls","oAuth2CodeCheckCalls","oAuth2CodeCreateCalls","oAuth2PasswordCheckCalls","toMatchSnapshot","refresh_token","redirectURI","params","response_type","client_id","redirect_uri","state","maxRedirects","responseType","clientId","acknowledged","code"],"sources":["../src/index.test.ts"],"sourcesContent":["import {\n runServer,\n prepareServer,\n prepareEnvironment as basePrepareEnvironment,\n DEFAULT_ERRORS_DESCRIPTORS,\n} from '@whook/whook';\nimport {\n AUTHORIZATION_ERRORS_DESCRIPTORS,\n wrapHandlerWithAuthorization,\n} from '@whook/authorization';\nimport { constant, initializer } from 'knifecycle';\nimport axios from 'axios';\nimport YError from 'yerror';\nimport {\n BEARER as BEARER_MECHANISM,\n BASIC as BASIC_MECHANISM,\n} from 'http-auth-utils';\nimport {\n initGetOAuth2Authorize,\n getOAuth2AuthorizeDefinition,\n getOAuth2AuthorizeResponseTypeParameter,\n getOAuth2AuthorizeClientIdParameter,\n getOAuth2AuthorizeRedirectURIParameter,\n getOAuth2AuthorizeScopeParameter,\n getOAuth2AuthorizeStateParameter,\n initPostOAuth2Acknowledge,\n postOAuth2AcknowledgeDefinition,\n initPostOAuth2Token,\n postOAuth2TokenDefinition,\n OAUTH2_ERRORS_DESCRIPTORS,\n initOAuth2CodeGranter,\n initOAuth2PasswordGranter,\n initOAuth2RefreshTokenGranter,\n initOAuth2Granters,\n initOAuth2ClientCredentialsGranter,\n initOAuth2TokenGranter,\n postOAuth2TokenAuthorizationCodeTokenRequestBodySchema,\n postOAuth2TokenPasswordTokenRequestBodySchema,\n postOAuth2TokenClientCredentialsTokenRequestBodySchema,\n postOAuth2TokenTokenBodySchema,\n postOAuth2TokenRefreshTokenRequestBodySchema,\n} from '.';\nimport type { OAuth2Options } from '.';\nimport type { Knifecycle } from 'knifecycle';\nimport type { OpenAPIV3 } from 'openapi-types';\n\ndescribe('OAuth2 server', () => {\n const BASE_PATH = '/v1';\n const PORT = 4444;\n const HOST = 'localhost';\n const logger = {\n output: jest.fn(),\n error: jest.fn(),\n debug: jest.fn(),\n };\n const time = jest.fn();\n const $autoload = jest.fn();\n\n const API: OpenAPIV3.Document = {\n openapi: '3.0.2',\n info: {\n version: '1.0.0',\n title: 'Sample OpenAPI',\n description: 'A sample OpenAPI file for testing purpose.',\n },\n paths: {\n [getOAuth2AuthorizeDefinition.path]: {\n [getOAuth2AuthorizeDefinition.method]:\n getOAuth2AuthorizeDefinition.operation,\n },\n [postOAuth2AcknowledgeDefinition.path]: {\n [postOAuth2AcknowledgeDefinition.method]: {\n ...postOAuth2AcknowledgeDefinition.operation,\n security: [\n {\n bearerAuth: ['user'],\n },\n ],\n },\n },\n [postOAuth2TokenDefinition.path]: {\n [postOAuth2TokenDefinition.method]: {\n ...postOAuth2TokenDefinition.operation,\n security: [\n {\n basicAuth: ['oauth'],\n },\n ],\n },\n },\n },\n components: {\n securitySchemes: {\n bearerAuth: {\n type: 'http',\n description: 'Bearer authentication with a user API token',\n scheme: 'bearer',\n },\n basicAuth: {\n type: 'http',\n description: 'Basic authentication of an API client',\n scheme: 'basic',\n },\n },\n parameters: [\n getOAuth2AuthorizeResponseTypeParameter,\n getOAuth2AuthorizeClientIdParameter,\n getOAuth2AuthorizeRedirectURIParameter,\n getOAuth2AuthorizeScopeParameter,\n getOAuth2AuthorizeStateParameter,\n ].reduce(\n (parametersHash, { name, parameter }) => ({\n ...parametersHash,\n [name]: parameter,\n }),\n {},\n ),\n schemas: [\n postOAuth2TokenAuthorizationCodeTokenRequestBodySchema,\n postOAuth2TokenPasswordTokenRequestBodySchema,\n postOAuth2TokenClientCredentialsTokenRequestBodySchema,\n postOAuth2TokenRefreshTokenRequestBodySchema,\n postOAuth2TokenTokenBodySchema,\n ].reduce(\n (schemasHash, { name, schema }) => ({\n ...schemasHash,\n [name]: schema,\n }),\n {},\n ),\n },\n };\n const OAUTH2: OAuth2Options = {\n authenticateURL: 'https://auth.example.com/sign_in',\n };\n const authentication = { check: jest.fn() };\n const checkApplication = jest.fn();\n const oAuth2AccessToken = { create: jest.fn(), check: jest.fn() };\n const oAuth2RefreshToken = { create: jest.fn(), check: jest.fn() };\n const oAuth2ClientCredentials = { check: jest.fn() };\n const oAuth2Code = { create: jest.fn(), check: jest.fn() };\n const oAuth2Password = { check: jest.fn() };\n\n let $instance;\n\n async function prepareEnvironment() {\n const $ = await basePrepareEnvironment();\n\n $.register(\n initializer(\n {\n name: '$autoload',\n type: 'service',\n singleton: true,\n },\n async () => $autoload,\n ),\n );\n $.register(constant('BASE_PATH', BASE_PATH));\n $.register(constant('API', API));\n $.register(constant('ENV', {}));\n $.register(constant('NODE_ENV', 'test'));\n $.register(constant('PORT', PORT));\n $.register(constant('HOST', HOST));\n $.register(constant('DEBUG_NODE_ENVS', []));\n $.register(constant('NODE_ENVS', ['test']));\n $.register(constant('MECHANISMS', [BEARER_MECHANISM, BASIC_MECHANISM]));\n $.register(constant('logger', logger));\n $.register(constant('time', time));\n\n // OAuth2 Specifics\n $.register(constant('OAUTH2', OAUTH2));\n $.register(\n constant('ERRORS_DESCRIPTORS', {\n ...DEFAULT_ERRORS_DESCRIPTORS,\n ...AUTHORIZATION_ERRORS_DESCRIPTORS,\n ...OAUTH2_ERRORS_DESCRIPTORS,\n }),\n );\n $.register(\n initializer(\n {\n name: 'HANDLERS',\n type: 'service',\n inject: [\n 'getOAuth2Authorize',\n 'postOAuth2Acknowledge',\n 'postOAuth2Token',\n ],\n singleton: true,\n },\n async (services) => services,\n ),\n );\n $.register(constant('authentication', authentication));\n $.register(constant('checkApplication', checkApplication));\n $.register(constant('oAuth2AccessToken', oAuth2AccessToken));\n $.register(constant('oAuth2RefreshToken', oAuth2RefreshToken));\n $.register(constant('oAuth2ClientCredentials', oAuth2ClientCredentials));\n $.register(constant('oAuth2Code', oAuth2Code));\n $.register(constant('oAuth2Password', oAuth2Password));\n [\n initGetOAuth2Authorize,\n wrapHandlerWithAuthorization(initPostOAuth2Acknowledge as any),\n wrapHandlerWithAuthorization(initPostOAuth2Token as any),\n initOAuth2Granters,\n initOAuth2ClientCredentialsGranter,\n initOAuth2CodeGranter,\n initOAuth2PasswordGranter,\n initOAuth2RefreshTokenGranter,\n initOAuth2TokenGranter,\n ].forEach((handlerInitializer) => $.register(handlerInitializer));\n\n return $;\n }\n\n $autoload.mockImplementation(async (serviceName) => {\n throw new YError('E_UNMATCHED_DEPENDENCY', serviceName);\n });\n process.env.ISOLATED_ENV = '1';\n\n beforeAll(async () => {\n const { $instance: _instance } = await runServer<{\n $instance: Knifecycle;\n }>(prepareEnvironment, prepareServer, [\n '$instance',\n 'httpServer',\n 'process',\n ]);\n $instance = _instance;\n });\n\n afterAll(async () => {\n await $instance.destroy();\n });\n\n beforeEach(() => {\n logger.output.mockReset();\n logger.error.mockReset();\n logger.debug.mockReset();\n time.mockReset();\n $autoload.mockClear();\n [\n oAuth2AccessToken.create,\n oAuth2AccessToken.check,\n oAuth2RefreshToken.create,\n oAuth2RefreshToken.check,\n oAuth2ClientCredentials.check,\n oAuth2Code.check,\n oAuth2Code.create,\n oAuth2Password.check,\n checkApplication,\n authentication.check,\n ].forEach((mock) => mock.mockReset());\n });\n\n describe('with the password flow', () => {\n it('should produce new tokens', async () => {\n time.mockReturnValue(Date.parse('2010-03-06T00:00:00Z'));\n [\n oAuth2AccessToken.check,\n oAuth2RefreshToken.check,\n oAuth2ClientCredentials.check,\n oAuth2Code.check,\n oAuth2Code.create,\n oAuth2RefreshToken.check,\n ].forEach((mock) =>\n mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),\n );\n authentication.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,oauth',\n });\n checkApplication.mockResolvedValueOnce(undefined);\n oAuth2Password.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,auth',\n authentication: {\n userId: 1,\n },\n });\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\n const { status, headers, data } = await axios({\n method: 'post',\n url: `http://${HOST}:${PORT}${BASE_PATH}${postOAuth2TokenDefinition.path}`,\n headers: {\n authorization: `basic ${Buffer.from('ali:open_sesame').toString(\n 'base64',\n )}`,\n },\n data: {\n grant_type: 'password',\n username: 'me@example.com',\n password: 'udelawli',\n scope: 'user',\n },\n validateStatus: () => true,\n });\n\n expect({\n status,\n headers: {\n ...headers,\n // Erasing the Date header that may be added by Axios :/\n date: undefined,\n },\n data,\n }).toMatchInlineSnapshot(`\n Object {\n \"data\": Object {\n \"access_token\": \"an_access_token\",\n \"expiration_date\": \"2010-03-07T00:00:00.000Z\",\n \"expires_in\": 86400,\n \"refresh_token\": \"a_refresh_token\",\n \"refresh_token_expiration_date\": \"2180-03-06T00:00:00.000Z\",\n \"refresh_token_expires_in\": 5364748800,\n \"token_type\": \"bearer\",\n },\n \"headers\": Object {\n \"connection\": \"close\",\n \"content-type\": \"application/json\",\n \"date\": undefined,\n \"transaction-id\": \"0\",\n \"transfer-encoding\": \"chunked\",\n \"x-authenticated\": \"{\\\\\"applicationId\\\\\":\\\\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\\\\",\\\\\"scope\\\\\":\\\\\"user,oauth\\\\\"}\",\n },\n \"status\": 200,\n }\n `);\n expect({\n checkApplicationCalls: checkApplication.mock.calls,\n authenticationCheckCalls: authentication.check.mock.calls,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2AccessTokenCheckCalls: oAuth2AccessToken.check.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n oAuth2RefreshTokenCheckCalls: oAuth2RefreshToken.check.mock.calls,\n oAuth2ClientCredentialsCheckCalls:\n oAuth2ClientCredentials.check.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2PasswordCheckCalls: oAuth2Password.check.mock.calls,\n }).toMatchSnapshot();\n });\n });\n\n describe('with the refresh token flow', () => {\n it('should produce new tokens', async () => {\n time.mockReturnValue(Date.parse('2010-03-06T00:00:00Z'));\n [\n oAuth2AccessToken.check,\n oAuth2ClientCredentials.check,\n oAuth2Code.check,\n oAuth2Code.create,\n oAuth2Password.check,\n ].forEach((mock) =>\n mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),\n );\n authentication.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,oauth',\n });\n checkApplication.mockResolvedValueOnce(undefined);\n oAuth2RefreshToken.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,auth',\n authentication: {\n userId: 1,\n },\n });\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\n const { status, headers, data } = await axios({\n method: 'post',\n url: `http://${HOST}:${PORT}${BASE_PATH}${postOAuth2TokenDefinition.path}`,\n headers: {\n authorization: `basic ${Buffer.from('ali:open_sesame').toString(\n 'base64',\n )}`,\n },\n data: {\n grant_type: 'refresh_token',\n refresh_token: 'a_refresh_token',\n scope: 'user',\n },\n validateStatus: () => true,\n });\n\n expect({\n status,\n headers: {\n ...headers,\n // Erasing the Date header that may be added by Axios :/\n date: undefined,\n },\n data,\n }).toMatchInlineSnapshot(`\n Object {\n \"data\": Object {\n \"access_token\": \"an_access_token\",\n \"expiration_date\": \"2010-03-07T00:00:00.000Z\",\n \"expires_in\": 86400,\n \"refresh_token\": \"a_refresh_token\",\n \"refresh_token_expiration_date\": \"2180-03-06T00:00:00.000Z\",\n \"refresh_token_expires_in\": 5364748800,\n \"token_type\": \"bearer\",\n },\n \"headers\": Object {\n \"connection\": \"close\",\n \"content-type\": \"application/json\",\n \"date\": undefined,\n \"transaction-id\": \"1\",\n \"transfer-encoding\": \"chunked\",\n \"x-authenticated\": \"{\\\\\"applicationId\\\\\":\\\\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\\\\",\\\\\"scope\\\\\":\\\\\"user,oauth\\\\\"}\",\n },\n \"status\": 200,\n }\n `);\n expect({\n checkApplicationCalls: checkApplication.mock.calls,\n authenticationCheckCalls: authentication.check.mock.calls,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2AccessTokenCheckCalls: oAuth2AccessToken.check.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n oAuth2RefreshTokenCheckCalls: oAuth2RefreshToken.check.mock.calls,\n oAuth2ClientCredentialsCheckCalls:\n oAuth2ClientCredentials.check.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2PasswordCheckCalls: oAuth2Password.check.mock.calls,\n }).toMatchSnapshot();\n });\n });\n\n describe('with the client credentials flow', () => {\n it('should produce new tokens', async () => {\n time.mockReturnValue(Date.parse('2010-03-06T00:00:00Z'));\n [\n oAuth2AccessToken.check,\n oAuth2RefreshToken.check,\n oAuth2Code.check,\n oAuth2Code.create,\n oAuth2Password.check,\n ].forEach((mock) =>\n mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),\n );\n authentication.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,oauth',\n });\n checkApplication.mockResolvedValueOnce(undefined);\n oAuth2ClientCredentials.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,auth',\n authentication: {\n userId: 1,\n },\n });\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\n const { status, headers, data } = await axios({\n method: 'post',\n url: `http://${HOST}:${PORT}${BASE_PATH}${postOAuth2TokenDefinition.path}`,\n headers: {\n authorization: `basic ${Buffer.from('ali:open_sesame').toString(\n 'base64',\n )}`,\n },\n data: {\n grant_type: 'client_credentials',\n scope: 'user',\n },\n validateStatus: () => true,\n });\n\n expect({\n status,\n headers: {\n ...headers,\n // Erasing the Date header that may be added by Axios :/\n date: undefined,\n },\n data,\n }).toMatchInlineSnapshot(`\n Object {\n \"data\": Object {\n \"access_token\": \"an_access_token\",\n \"expiration_date\": \"2010-03-07T00:00:00.000Z\",\n \"expires_in\": 86400,\n \"refresh_token\": \"a_refresh_token\",\n \"refresh_token_expiration_date\": \"2180-03-06T00:00:00.000Z\",\n \"refresh_token_expires_in\": 5364748800,\n \"token_type\": \"bearer\",\n },\n \"headers\": Object {\n \"connection\": \"close\",\n \"content-type\": \"application/json\",\n \"date\": undefined,\n \"transaction-id\": \"2\",\n \"transfer-encoding\": \"chunked\",\n \"x-authenticated\": \"{\\\\\"applicationId\\\\\":\\\\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\\\\",\\\\\"scope\\\\\":\\\\\"user,oauth\\\\\"}\",\n },\n \"status\": 200,\n }\n `);\n expect({\n checkApplicationCalls: checkApplication.mock.calls,\n authenticationCheckCalls: authentication.check.mock.calls,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2AccessTokenCheckCalls: oAuth2AccessToken.check.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n oAuth2RefreshTokenCheckCalls: oAuth2RefreshToken.check.mock.calls,\n oAuth2ClientCredentialsCheckCalls:\n oAuth2ClientCredentials.check.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2PasswordCheckCalls: oAuth2Password.check.mock.calls,\n }).toMatchSnapshot();\n });\n });\n\n describe('with the code flow', () => {\n it('should build the authorization redirection', async () => {\n time.mockReturnValue(Date.parse('2010-03-06T00:00:00Z'));\n [\n authentication.check,\n oAuth2AccessToken.check,\n oAuth2AccessToken.create,\n oAuth2RefreshToken.check,\n oAuth2RefreshToken.create,\n oAuth2Code.check,\n oAuth2Code.create,\n oAuth2ClientCredentials.check,\n oAuth2Password.check,\n ].forEach((mock) =>\n mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),\n );\n checkApplication.mockResolvedValueOnce({\n redirectURI:\n 'https://example.com/oauth2/callback?a_param=a_param_value',\n });\n\n const { status, headers, data } = await axios({\n method: 'get',\n url: `http://${HOST}:${PORT}${BASE_PATH}${getOAuth2AuthorizeDefinition.path}`,\n params: {\n response_type: 'code',\n client_id: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n redirect_uri:\n 'https://example.com/oauth2/callback?a_param=a_param_value',\n scope: 'user',\n state: 'xyz',\n },\n maxRedirects: 0,\n validateStatus: () => true,\n });\n\n expect({\n status,\n headers: {\n ...headers,\n // Erasing the Date header that may be added by Axios :/\n date: undefined,\n },\n data,\n }).toMatchInlineSnapshot(`\n Object {\n \"data\": \"\",\n \"headers\": Object {\n \"connection\": \"close\",\n \"date\": undefined,\n \"location\": \"https://auth.example.com/sign_in?type=code&redirect_uri=https%3A%2F%2Fexample.com%2Foauth2%2Fcallback%3Fa_param%3Da_param_value&scope=user&client_id=acdc41ce-acdc-41ce-acdc-41ceacdc41ce&state=xyz\",\n \"transaction-id\": \"3\",\n \"transfer-encoding\": \"chunked\",\n },\n \"status\": 302,\n }\n `);\n expect({\n checkApplicationCalls: checkApplication.mock.calls,\n authenticationCheckCalls: authentication.check.mock.calls,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2AccessTokenCheckCalls: oAuth2AccessToken.check.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n oAuth2RefreshTokenCheckCalls: oAuth2RefreshToken.check.mock.calls,\n oAuth2ClientCredentialsCheckCalls:\n oAuth2ClientCredentials.check.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2PasswordCheckCalls: oAuth2Password.check.mock.calls,\n }).toMatchSnapshot();\n });\n\n it('should redirect with a code', async () => {\n time.mockReturnValue(Date.parse('2010-03-06T00:00:00Z'));\n [\n oAuth2AccessToken.check,\n oAuth2AccessToken.create,\n oAuth2RefreshToken.check,\n oAuth2RefreshToken.create,\n oAuth2Code.check,\n oAuth2ClientCredentials.check,\n oAuth2Password.check,\n ].forEach((mock) =>\n mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),\n );\n authentication.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,oauth',\n });\n oAuth2Code.create.mockResolvedValueOnce('a_code');\n checkApplication.mockResolvedValueOnce(undefined);\n checkApplication.mockResolvedValueOnce({\n redirectURI: 'http://redirect.example.com/yolo',\n });\n\n const { status, headers, data } = await axios({\n method: 'post',\n url: `http://${HOST}:${PORT}${BASE_PATH}${postOAuth2AcknowledgeDefinition.path}`,\n headers: {\n authorization: 'Bearer yolo',\n },\n data: {\n responseType: 'code',\n clientId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n redirectURI: 'http://redirect.example.com/yolo?a_param=a_value',\n scope: 'user',\n state: 'xyz',\n acknowledged: true,\n },\n maxRedirects: 0,\n validateStatus: () => true,\n });\n\n expect({\n status,\n headers: {\n ...headers,\n // Erasing the Date header that may be added by Axios :/\n date: undefined,\n },\n data,\n }).toMatchInlineSnapshot(`\n Object {\n \"data\": \"\",\n \"headers\": Object {\n \"connection\": \"close\",\n \"date\": undefined,\n \"location\": \"http://redirect.example.com/yolo?a_param=a_value&client_id=acdc41ce-acdc-41ce-acdc-41ceacdc41ce&scope=user&state=xyz&redirect_uri=http%3A%2F%2Fredirect.example.com%2Fyolo%3Fa_param%3Da_value&code=a_code\",\n \"transaction-id\": \"4\",\n \"transfer-encoding\": \"chunked\",\n \"x-authenticated\": \"{\\\\\"applicationId\\\\\":\\\\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\\\\",\\\\\"scope\\\\\":\\\\\"user,oauth\\\\\"}\",\n },\n \"status\": 302,\n }\n `);\n expect({\n checkApplicationCalls: checkApplication.mock.calls,\n authenticationCheckCalls: authentication.check.mock.calls,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2AccessTokenCheckCalls: oAuth2AccessToken.check.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n oAuth2RefreshTokenCheckCalls: oAuth2RefreshToken.check.mock.calls,\n oAuth2ClientCredentialsCheckCalls:\n oAuth2ClientCredentials.check.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2PasswordCheckCalls: oAuth2Password.check.mock.calls,\n }).toMatchSnapshot();\n });\n\n it('should produce new tokens', async () => {\n time.mockReturnValue(Date.parse('2010-03-06T00:00:00Z'));\n [\n oAuth2AccessToken.check,\n oAuth2RefreshToken.check,\n oAuth2ClientCredentials.check,\n oAuth2Password.check,\n ].forEach((mock) =>\n mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),\n );\n authentication.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,oauth',\n });\n checkApplication.mockResolvedValueOnce(undefined);\n oAuth2Code.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,auth',\n userId: 1,\n });\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\n const { status, headers, data } = await axios({\n method: 'post',\n url: `http://${HOST}:${PORT}${BASE_PATH}${postOAuth2TokenDefinition.path}`,\n headers: {\n authorization: `basic ${Buffer.from('ali:open_sesame').toString(\n 'base64',\n )}`,\n },\n data: {\n grant_type: 'authorization_code',\n code: 'a_grant_code',\n redirect_uri: 'http://redirect.example.com/yolo',\n },\n validateStatus: () => true,\n });\n\n expect({\n status,\n headers: {\n ...headers,\n // Erasing the Date header that may be added by Axios :/\n date: undefined,\n },\n data,\n }).toMatchInlineSnapshot(`\n Object {\n \"data\": Object {\n \"access_token\": \"an_access_token\",\n \"expiration_date\": \"2010-03-07T00:00:00.000Z\",\n \"expires_in\": 86400,\n \"refresh_token\": \"a_refresh_token\",\n \"refresh_token_expiration_date\": \"2180-03-06T00:00:00.000Z\",\n \"refresh_token_expires_in\": 5364748800,\n \"token_type\": \"bearer\",\n },\n \"headers\": Object {\n \"connection\": \"close\",\n \"content-type\": \"application/json\",\n \"date\": undefined,\n \"transaction-id\": \"5\",\n \"transfer-encoding\": \"chunked\",\n \"x-authenticated\": \"{\\\\\"applicationId\\\\\":\\\\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\\\\",\\\\\"scope\\\\\":\\\\\"user,oauth\\\\\"}\",\n },\n \"status\": 200,\n }\n `);\n expect({\n checkApplicationCalls: checkApplication.mock.calls,\n authenticationCheckCalls: authentication.check.mock.calls,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2AccessTokenCheckCalls: oAuth2AccessToken.check.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n oAuth2RefreshTokenCheckCalls: oAuth2RefreshToken.check.mock.calls,\n oAuth2ClientCredentialsCheckCalls:\n oAuth2ClientCredentials.check.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2PasswordCheckCalls: oAuth2Password.check.mock.calls,\n }).toMatchSnapshot();\n });\n });\n\n describe('with the implicit flow', () => {\n it('should build the authorization redirection', async () => {\n time.mockReturnValue(Date.parse('2010-03-06T00:00:00Z'));\n [\n authentication.check,\n oAuth2AccessToken.check,\n oAuth2AccessToken.create,\n oAuth2RefreshToken.check,\n oAuth2RefreshToken.create,\n oAuth2Code.check,\n oAuth2Code.create,\n oAuth2ClientCredentials.check,\n oAuth2Password.check,\n ].forEach((mock) =>\n mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),\n );\n checkApplication.mockResolvedValueOnce({\n redirectURI: 'http://redirect.example.com/yolo',\n });\n\n const { status, headers, data } = await axios({\n method: 'get',\n url: `http://${HOST}:${PORT}${BASE_PATH}${getOAuth2AuthorizeDefinition.path}`,\n params: {\n response_type: 'token',\n client_id: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n redirect_uri: 'http://redirect.example.com/yolo',\n scope: 'user',\n state: 'xyz',\n },\n maxRedirects: 0,\n validateStatus: () => true,\n });\n\n expect({\n status,\n headers: {\n ...headers,\n // Erasing the Date header that may be added by Axios :/\n date: undefined,\n },\n data,\n }).toMatchInlineSnapshot(`\n Object {\n \"data\": \"\",\n \"headers\": Object {\n \"connection\": \"close\",\n \"date\": undefined,\n \"location\": \"https://auth.example.com/sign_in?type=token&redirect_uri=http%3A%2F%2Fredirect.example.com%2Fyolo&scope=user&client_id=acdc41ce-acdc-41ce-acdc-41ceacdc41ce&state=xyz\",\n \"transaction-id\": \"6\",\n \"transfer-encoding\": \"chunked\",\n },\n \"status\": 302,\n }\n `);\n expect({\n checkApplicationCalls: checkApplication.mock.calls,\n authenticationCheckCalls: authentication.check.mock.calls,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2AccessTokenCheckCalls: oAuth2AccessToken.check.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n oAuth2RefreshTokenCheckCalls: oAuth2RefreshToken.check.mock.calls,\n oAuth2ClientCredentialsCheckCalls:\n oAuth2ClientCredentials.check.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2PasswordCheckCalls: oAuth2Password.check.mock.calls,\n }).toMatchSnapshot();\n });\n\n it('should redirect with a token', async () => {\n time.mockReturnValue(Date.parse('2010-03-06T00:00:00Z'));\n [\n oAuth2AccessToken.check,\n oAuth2RefreshToken.check,\n oAuth2RefreshToken.create,\n oAuth2Code.check,\n oAuth2Code.create,\n oAuth2ClientCredentials.check,\n oAuth2Password.check,\n ].forEach((mock) =>\n mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),\n );\n authentication.check.mockResolvedValueOnce({\n applicationId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n scope: 'user,oauth',\n });\n oAuth2AccessToken.create.mockResolvedValueOnce({\n token: 'an_access_token',\n expiresAt: Date.parse('2010-03-07T00:00:00Z'),\n });\n checkApplication.mockResolvedValueOnce(undefined);\n checkApplication.mockResolvedValueOnce({\n redirectURI: 'http://redirect.example.com/yolo',\n });\n\n const { status, headers, data } = await axios({\n method: 'post',\n url: `http://${HOST}:${PORT}${BASE_PATH}${postOAuth2AcknowledgeDefinition.path}`,\n headers: {\n authorization: 'Bearer yolo',\n },\n data: {\n responseType: 'token',\n clientId: 'acdc41ce-acdc-41ce-acdc-41ceacdc41ce',\n redirectURI: 'http://redirect.example.com/yolo?a_param=a_value',\n scope: 'user',\n state: 'xyz',\n acknowledged: true,\n },\n maxRedirects: 0,\n validateStatus: () => true,\n });\n\n expect({\n status,\n headers: {\n ...headers,\n // Erasing the Date header that may be added by Axios :/\n date: undefined,\n },\n data,\n }).toMatchInlineSnapshot(`\n Object {\n \"data\": \"\",\n \"headers\": Object {\n \"connection\": \"close\",\n \"date\": undefined,\n \"location\": \"http://redirect.example.com/yolo?a_param=a_value&client_id=acdc41ce-acdc-41ce-acdc-41ceacdc41ce&scope=user&state=xyz&redirect_uri=http%3A%2F%2Fredirect.example.com%2Fyolo&access_token=an_access_token&token_type=bearer&expires_in=86400\",\n \"transaction-id\": \"7\",\n \"transfer-encoding\": \"chunked\",\n \"x-authenticated\": \"{\\\\\"applicationId\\\\\":\\\\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\\\\",\\\\\"scope\\\\\":\\\\\"user,oauth\\\\\"}\",\n },\n \"status\": 302,\n }\n `);\n expect({\n checkApplicationCalls: checkApplication.mock.calls,\n authenticationCheckCalls: authentication.check.mock.calls,\n oAuth2AccessTokenCreateCalls: oAuth2AccessToken.create.mock.calls,\n oAuth2AccessTokenCheckCalls: oAuth2AccessToken.check.mock.calls,\n oAuth2RefreshTokenCreateCalls: oAuth2RefreshToken.create.mock.calls,\n oAuth2RefreshTokenCheckCalls: oAuth2RefreshToken.check.mock.calls,\n oAuth2ClientCredentialsCheckCalls:\n oAuth2ClientCredentials.check.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2PasswordCheckCalls: oAuth2Password.check.mock.calls,\n }).toMatchSnapshot();\n });\n });\n});\n"],"mappings":"AAAA,SACEA,SADF,EAEEC,aAFF,EAGEC,kBAAkB,IAAIC,sBAHxB,EAIEC,0BAJF,QAKO,cALP;AAMA,SACEC,gCADF,EAEEC,4BA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MADK;QAELC,OAAO,EAAE,EACP,GAAGA,OADI;UAEP;UACAY,IAAI,EAAEjB;QAHC,CAFJ;QAOLM;MAPK,CAAD,CAAN,CAQGY,qBARH,CAQ0B;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OArBM;MAsBAF,MAAM,CAAC;QACLG,qBAAqB,EAAEvD,gBAAgB,CAAC2B,IAAjB,CAAsB6B,KADxC;QAELC,wBAAwB,EAAE3D,cAAc,CAACC,KAAf,CAAqB4B,IAArB,CAA0B6B,KAF/C;QAGLE,4BAA4B,EAAEzD,iBAAiB,CAACC,MAAlB,CAAyByB,IAAzB,CAA8B6B,KAHvD;QAILG,2BAA2B,EAAE1D,iBAAiB,CAACF,KAAlB,CAAwB4B,IAAxB,CAA6B6B,KAJrD;QAKLI,6BAA6B,EAAEzD,kBAAkB,CAACD,MAAnB,CAA0ByB,IAA1B,CAA+B6B,KALzD;QAMLK,4BAA4B,EAAE1D,kBAAkB,CAACJ,KAAnB,CAAyB4B,IAAzB,CAA8B6B,KANvD;QAOLM,iCAAiC,EAC/B1D,uBAAuB,CAACL,KAAxB,CAA8B4B,IAA9B,CAAmC6B,KARhC;QASLO,oBAAoB,EAAE1D,UAAU,CAACN,KAAX,CAAiB4B,IAAjB,CAAsB6B,KATvC;QAULQ,qBAAqB,EAAE3D,UAAU,CAACH,MAAX,CAAkByB,IAAlB,CAAuB6B,KAVzC;QAWLS,wBAAwB,EAAE3D,cAAc,CAACP,KAAf,CAAqB4B,IAArB,CAA0B6B;MAX/C,CAAD,CAAN,CAYGU,eAZH;IAaD,CA/EC,CAAF;EAgFD,CAtJO,CAAR;AAuJD,CAx3BO,CAAR"}
@@ -1,58 +0,0 @@
1
- import ms from 'ms';
2
- import cookie from 'cookie';
3
- import { service as _service } from 'knifecycle';
4
- export const AUTH_API_PREFIX = '/auth';
5
- export default _service(initAuthCookies, "authCookies", ["?ENV", "COOKIES", "?BASE_PATH"]);
6
-
7
- async function initAuthCookies({
8
- ENV = {},
9
- COOKIES,
10
- BASE_PATH = ''
11
- }) {
12
- function build(data = {}, {
13
- session = true
14
- } = {}) {
15
- return [cookie.serialize('access_token', data.access_token || '', {
16
- path: BASE_PATH + AUTH_API_PREFIX,
17
- httpOnly: true,
18
- domain: ENV.DEV_MODE ? undefined : COOKIES.domain,
19
- secure: !ENV.DEV_MODE,
20
- ...(ENV.DEV_MODE ? {} : {
21
- sameSite: true
22
- }),
23
- ...(data.access_token ? {} : {
24
- maxAge: 0
25
- })
26
- }), cookie.serialize('refresh_token', data.refresh_token || '', {
27
- path: BASE_PATH + AUTH_API_PREFIX,
28
- httpOnly: true,
29
- domain: ENV.DEV_MODE ? undefined : COOKIES.domain,
30
- secure: !ENV.DEV_MODE,
31
- ...(ENV.DEV_MODE ? {} : {
32
- sameSite: true
33
- }),
34
- ...(session ? {} : {
35
- maxAge: Math.round(ms('100y') / 1000)
36
- })
37
- })];
38
- }
39
-
40
- function parse(cookieHeader) {
41
- const data = cookie.parse(cookieHeader);
42
-
43
- if (data.access_token && data.refresh_token) {
44
- return {
45
- access_token: data.access_token,
46
- refresh_token: data.refresh_token
47
- };
48
- }
49
-
50
- return {};
51
- }
52
-
53
- return {
54
- build,
55
- parse
56
- };
57
- }
58
- //# sourceMappingURL=authCookies.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authCookies.mjs","names":["ms","cookie","autoService","AUTH_API_PREFIX","initAuthCookies","ENV","COOKIES","BASE_PATH","build","data","session","serialize","access_token","path","httpOnly","domain","DEV_MODE","undefined","secure","sameSite","maxAge","refresh_token","Math","round","parse","cookieHeader"],"sources":["../../src/services/authCookies.ts"],"sourcesContent":["import ms from 'ms';\nimport cookie from 'cookie';\nimport { autoService } from 'knifecycle';\nimport type { BaseAuthenticationData } from '@whook/authorization';\n\nexport const AUTH_API_PREFIX = '/auth';\n\nexport type AuthHandlersConfig<\n AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData,\n> = {\n ROOT_AUTHENTICATION_DATA: AUTHENTICATION_DATA;\n};\n\nexport type AuthCookiesEnv = {\n DEV_MODE?: string;\n};\nexport type AuthCookiesConfig = {\n COOKIES: {\n domain: string;\n };\n BASE_PATH?: string;\n};\n\nexport type AuthCookiesDependencies = AuthCookiesConfig & {\n ENV?: AuthCookiesEnv;\n};\n\nexport type AuthCookiesData = {\n refresh_token: string;\n access_token: string;\n};\n\nexport type AuthCookiesService = {\n build: (\n data?: Partial<AuthCookiesData>,\n options?: { session: boolean },\n ) => string[];\n parse: (content: string) => Partial<AuthCookiesData>;\n};\n\nexport default autoService(initAuthCookies);\n\nasync function initAuthCookies({\n ENV = {},\n COOKIES,\n BASE_PATH = '',\n}: AuthCookiesDependencies): Promise<AuthCookiesService> {\n function build(data: Partial<AuthCookiesData> = {}, { session = true } = {}) {\n return [\n cookie.serialize('access_token', data.access_token || '', {\n path: BASE_PATH + AUTH_API_PREFIX,\n httpOnly: true,\n domain: ENV.DEV_MODE ? undefined : COOKIES.domain,\n secure: !ENV.DEV_MODE,\n ...(ENV.DEV_MODE ? {} : { sameSite: true }),\n ...(data.access_token ? {} : { maxAge: 0 }),\n }),\n cookie.serialize('refresh_token', data.refresh_token || '', {\n path: BASE_PATH + AUTH_API_PREFIX,\n httpOnly: true,\n domain: ENV.DEV_MODE ? undefined : COOKIES.domain,\n secure: !ENV.DEV_MODE,\n ...(ENV.DEV_MODE ? {} : { sameSite: true }),\n ...(session ? {} : { maxAge: Math.round(ms('100y') / 1000) }),\n }),\n ];\n }\n\n function parse(cookieHeader: string): Partial<AuthCookiesData> {\n const data = cookie.parse(cookieHeader);\n\n if (data.access_token && data.refresh_token) {\n return {\n access_token: data.access_token,\n refresh_token: data.refresh_token,\n };\n }\n\n return {};\n }\n\n return {\n build,\n parse,\n };\n}\n"],"mappings":"AAAA,OAAOA,EAAP,MAAe,IAAf;AACA,OAAOC,MAAP,MAAmB,QAAnB;AACA,SAASC,OAAW,IAAXA,QAAT,QAA4B,YAA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IAAI,CAACC,KAAL,CAAWvB,EAAE,CAAC,MAAD,CAAF,GAAa,IAAxB;MAAV,CAAnB;IAN0D,CAA5D,CATK,CAAP;EAkBD;;EAED,SAASwB,KAAT,CAAeC,YAAf,EAA+D;IAC7D,MAAMhB,IAAI,GAAGR,MAAM,CAACuB,KAAP,CAAaC,YAAb,CAAb;;IAEA,IAAIhB,IAAI,CAACG,YAAL,IAAqBH,IAAI,CAACY,aAA9B,EAA6C;MAC3C,OAAO;QACLT,YAAY,EAAEH,IAAI,CAACG,YADd;QAELS,aAAa,EAAEZ,IAAI,CAACY;MAFf,CAAP;IAID;;IAED,OAAO,EAAP;EACD;;EAED,OAAO;IACLb,KADK;IAELgB;EAFK,CAAP;AAID"}
@@ -1,77 +0,0 @@
1
- import initAuthCookies from './authCookies';
2
- describe('authCookies', () => {
3
- describe('.build()', () => {
4
- test('should work with new auth data', async () => {
5
- const ENV = {};
6
- const COOKIES = {
7
- domain: 'api.example.com'
8
- };
9
- const authCookies = await initAuthCookies({
10
- ENV,
11
- COOKIES
12
- });
13
- const result = await authCookies.build({
14
- access_token: 'a_access_token',
15
- refresh_token: 'a_refresh_token'
16
- });
17
- expect(result).toMatchInlineSnapshot(`
18
- Array [
19
- "access_token=a_access_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict",
20
- "refresh_token=a_refresh_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict",
21
- ]
22
- `);
23
- });
24
- test('should allow to reset auth data', async () => {
25
- const ENV = {};
26
- const COOKIES = {
27
- domain: 'api.example.com'
28
- };
29
- const authCookies = await initAuthCookies({
30
- ENV,
31
- COOKIES
32
- });
33
- const result = await authCookies.build({
34
- access_token: '',
35
- refresh_token: ''
36
- });
37
- expect(result).toMatchInlineSnapshot(`
38
- Array [
39
- "access_token=; Max-Age=0; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict",
40
- "refresh_token=; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict",
41
- ]
42
- `);
43
- });
44
- });
45
- describe('.parse()', () => {
46
- test('should work with no cookies', async () => {
47
- const ENV = {};
48
- const COOKIES = {
49
- domain: 'api.example.com'
50
- };
51
- const authCookies = await initAuthCookies({
52
- ENV,
53
- COOKIES
54
- });
55
- const result = await authCookies.parse('');
56
- expect(result).toMatchInlineSnapshot(`Object {}`);
57
- });
58
- test('should work with cookies', async () => {
59
- const ENV = {};
60
- const COOKIES = {
61
- domain: 'api.example.com'
62
- };
63
- const authCookies = await initAuthCookies({
64
- ENV,
65
- COOKIES
66
- });
67
- const result = await authCookies.parse('access_token=a_access_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict; refresh_token=a_refresh_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict');
68
- expect(result).toMatchInlineSnapshot(`
69
- Object {
70
- "access_token": "a_access_token",
71
- "refresh_token": "a_refresh_token",
72
- }
73
- `);
74
- });
75
- });
76
- });
77
- //# sourceMappingURL=authCookies.test.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authCookies.test.mjs","names":["initAuthCookies","describe","test","ENV","COOKIES","domain","authCookies","result","build","access_token","refresh_token","expect","toMatchInlineSnapshot","parse"],"sources":["../../src/services/authCookies.test.ts"],"sourcesContent":["import initAuthCookies from './authCookies';\nimport type { AuthCookiesConfig } from './authCookies';\n\ndescribe('authCookies', () => {\n describe('.build()', () => {\n test('should work with new auth data', async () => {\n const ENV = {};\n const COOKIES: AuthCookiesConfig['COOKIES'] = {\n domain: 'api.example.com',\n };\n\n const authCookies = await initAuthCookies({\n ENV,\n COOKIES,\n });\n\n const result = await authCookies.build({\n access_token: 'a_access_token',\n refresh_token: 'a_refresh_token',\n });\n\n expect(result).toMatchInlineSnapshot(`\n Array [\n \"access_token=a_access_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict\",\n \"refresh_token=a_refresh_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict\",\n ]\n `);\n });\n\n test('should allow to reset auth data', async () => {\n const ENV = {};\n const COOKIES: AuthCookiesConfig['COOKIES'] = {\n domain: 'api.example.com',\n };\n\n const authCookies = await initAuthCookies({\n ENV,\n COOKIES,\n });\n\n const result = await authCookies.build({\n access_token: '',\n refresh_token: '',\n });\n\n expect(result).toMatchInlineSnapshot(`\n Array [\n \"access_token=; Max-Age=0; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict\",\n \"refresh_token=; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict\",\n ]\n `);\n });\n });\n describe('.parse()', () => {\n test('should work with no cookies', async () => {\n const ENV = {};\n const COOKIES: AuthCookiesConfig['COOKIES'] = {\n domain: 'api.example.com',\n };\n\n const authCookies = await initAuthCookies({\n ENV,\n COOKIES,\n });\n\n const result = await authCookies.parse('');\n\n expect(result).toMatchInlineSnapshot(`Object {}`);\n });\n test('should work with cookies', async () => {\n const ENV = {};\n const COOKIES: AuthCookiesConfig['COOKIES'] = {\n domain: 'api.example.com',\n };\n\n const authCookies = await initAuthCookies({\n ENV,\n COOKIES,\n });\n\n const result = await authCookies.parse(\n 'access_token=a_access_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict; refresh_token=a_refresh_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict',\n );\n\n expect(result).toMatchInlineSnapshot(`\n Object {\n \"access_token\": \"a_access_token\",\n \"refresh_token\": \"a_refresh_token\",\n }\n `);\n });\n });\n});\n"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,eAA5B;AAGAC,QAAQ,CAAC,aAAD,EAAgB,MAAM;EAC5BA,QAAQ,CAAC,UAAD,EAAa,MAAM;IACzBC,IAAI,CAAC,gCAAD,EAAmC,YAAY;MACjD,MAAMC,GAAG,GAAG,EAAZ;MACA,MAAMC,OAAqC,GAAG;QAC5CC,MAAM,EAAE;MADoC,CAA9C;MAIA,MAAMC,WAAW,GAAG,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G,EAAZ;MACA,MAAMC,OAAqC,GAAG;QAC5CC,MAAM,EAAE;MADoC,CAA9C;MAIA,MAAMC,WAAW,GAAG,MAAMN,eAAe,CAAC;QACxCG,GADwC;QAExCC;MAFwC,CAAD,CAAzC;MAKA,MAAMG,MAAM,GAAG,MAAMD,WAAW,CAACO,KAAZ,CACnB,0MADmB,CAArB;MAIAF,MAAM,CAACJ,MAAD,CAAN,CAAeK,qBAAf,CAAsC;AAC5C;AACA;AACA;AACA;AACA,OALM;IAMD,CArBG,CAAJ;EAsBD,CAtCO,CAAR;AAuCD,CAzFO,CAAR"}
@@ -1,41 +0,0 @@
1
- import { service as _service } from 'knifecycle';
2
- import { noop } from '@whook/whook';
3
- import YError from 'yerror';
4
- export default _service(initOAuth2ClientCredentialsGranter, "oAuth2ClientCredentialsGranter", ["OAUTH2", "checkApplication", "?log"]); // Client Credentials Grant
5
- // https://tools.ietf.org/html/rfc6749#section-4.4
6
-
7
- async function initOAuth2ClientCredentialsGranter({
8
- OAUTH2,
9
- checkApplication,
10
- log = noop
11
- }) {
12
- const authenticateWithClientCredentials = async ({
13
- scope: demandedScope = ''
14
- }, authenticationData) => {
15
- // The client must be authenticated
16
- if (!authenticationData) {
17
- throw new YError('E_UNAUTHORIZED');
18
- } // Checking the scope and availability of the demanded
19
- // grant type
20
-
21
-
22
- await checkApplication({
23
- applicationId: authenticationData.applicationId,
24
- type: 'client_credentials',
25
- scope: demandedScope
26
- });
27
- return { ...authenticationData,
28
- scope: demandedScope ? demandedScope : OAUTH2.defaultToClientScope ? authenticationData.scope : ''
29
- };
30
- };
31
-
32
- log('debug', '👫 - OAuth2ClientCredentialsGranter Service Initialized!');
33
- return {
34
- type: 'client_credentials',
35
- authenticator: {
36
- grantType: 'client_credentials',
37
- authenticate: authenticateWithClientCredentials
38
- }
39
- };
40
- }
41
- //# sourceMappingURL=oAuth2ClientCredentialsGranter.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oAuth2ClientCredentialsGranter.mjs","names":["autoService","noop","YError","initOAuth2ClientCredentialsGranter","OAUTH2","checkApplication","log","authenticateWithClientCredentials","scope","demandedScope","authenticationData","applicationId","type","defaultToClientScope","authenticator","grantType","authenticate"],"sources":["../../src/services/oAuth2ClientCredentialsGranter.ts"],"sourcesContent":["import { autoService } from 'knifecycle';\nimport { noop } from '@whook/whook';\nimport YError from 'yerror';\nimport type { LogService } from 'common-services';\nimport type {\n OAuth2GranterService,\n CheckApplicationService,\n} from './oAuth2Granters';\nimport type { BaseAuthenticationData } from '@whook/authorization';\nimport type { OAuth2Options } from '..';\n\nexport type OAuth2ClientCredentialsGranterDependencies = {\n OAUTH2: OAuth2Options;\n checkApplication: CheckApplicationService;\n log?: LogService;\n};\nexport type OAuth2ClientCredentialsGranterParameters<\n AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData,\n> = {\n username: string;\n password: string;\n scope?: AUTHENTICATION_DATA['scope'];\n};\nexport type OAuth2ClientCredentialsGranterService<\n AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData,\n> = OAuth2GranterService<\n Record<string, unknown>,\n Record<string, unknown>,\n OAuth2ClientCredentialsGranterParameters,\n AUTHENTICATION_DATA\n>;\n\nexport default autoService(initOAuth2ClientCredentialsGranter);\n\n// Client Credentials Grant\n// https://tools.ietf.org/html/rfc6749#section-4.4\nasync function initOAuth2ClientCredentialsGranter({\n OAUTH2,\n checkApplication,\n log = noop,\n}: OAuth2ClientCredentialsGranterDependencies): Promise<OAuth2ClientCredentialsGranterService> {\n const authenticateWithClientCredentials: NonNullable<\n OAuth2ClientCredentialsGranterService['authenticator']\n >['authenticate'] = async (\n { scope: demandedScope = '' },\n authenticationData,\n ) => {\n // The client must be authenticated\n if (!authenticationData) {\n throw new YError('E_UNAUTHORIZED');\n }\n\n // Checking the scope and availability of the demanded\n // grant type\n await checkApplication({\n applicationId: authenticationData.applicationId,\n type: 'client_credentials',\n scope: demandedScope,\n });\n\n return {\n ...authenticationData,\n scope: demandedScope\n ? demandedScope\n : OAUTH2.defaultToClientScope\n ? authenticationData.scope\n : '',\n };\n };\n\n log('debug', '👫 - OAuth2ClientCredentialsGranter Service Initialized!');\n\n return {\n type: 'client_credentials',\n authenticator: {\n grantType: 'client_credentials',\n authenticate: authenticateWithClientCredentials,\n },\n };\n}\n"],"mappings":"AAAA,SAASA,OAAW,IAAXA,QAAT,QAA4B,YAA5B;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,OAAOC,MAAP,MAAmB,QAAnB;AA8BA,eAAeF,QAAW,CAACG,kCAAD,2EAA1B,C,CAEA;AACA;;AACA,eAAeA,kCAAf,CAAkD;EAChDC,MADgD;EAEhDC,gBAFgD;EAGhDC,GAAG,GAAGL;AAH0C,CAAlD,EAI+F;EAC7F,MAAMM,iCAEW,GAAG,OAClB;IAAEC,KAAK,EAAEC,aAAa,GAAG;EAAzB,CADkB,EAElBC,kBAFkB,KAGf;IACH;IACA,IAAI,CAACA,kBAAL,EAAyB;MACvB,MAAM,IAAIR,MAAJ,CAAW,gBAAX,CAAN;IACD,CAJE,CAMH;IACA;;;IACA,MAAMG,gBAAgB,CAAC;MACrBM,aAAa,EAAED,kBAAkB,CAACC,aADb;MAErBC,IAAI,EAAE,oBAFe;MAGrBJ,KAAK,EAAEC;IAHc,CAAD,CAAtB;IAMA,OAAO,EACL,GAAGC,kBADE;MAELF,KAAK,EAAEC,aAAa,GAChBA,aADgB,GAEhBL,MAAM,CAACS,oBAAP,GACAH,kBAAkB,CAACF,KADnB,GAEA;IANC,CAAP;EAQD,CA3BD;;EA6BAF,GAAG,CAAC,OAAD,EAAU,0DAAV,CAAH;EAEA,OAAO;IACLM,IAAI,EAAE,oBADD;IAELE,aAAa,EAAE;MACbC,SAAS,EAAE,oBADE;MAEbC,YAAY,EAAET;IAFD;EAFV,CAAP;AAOD"}
@@ -1,98 +0,0 @@
1
- import { service as _service } from 'knifecycle';
2
- import { noop } from '@whook/whook';
3
- import YError from 'yerror';
4
- export const CODE_GRANTER_TYPE = 'code';
5
- export default _service(initOAuth2CodeGranter, "oAuth2CodeGranter", ["oAuth2Code", "checkApplication", "?log"]); // Authorization Code Grant
6
- // https://tools.ietf.org/html/rfc6749#section-4.1
7
-
8
- async function initOAuth2CodeGranter({
9
- oAuth2Code,
10
- checkApplication,
11
- log = noop
12
- }) {
13
- const authorizeWithCode = async ({
14
- clientId,
15
- redirectURI,
16
- scope = ''
17
- }) => {
18
- const {
19
- redirectURI: finalRedirectURI
20
- } = await checkApplication({
21
- applicationId: clientId,
22
- type: CODE_GRANTER_TYPE,
23
- redirectURI,
24
- scope
25
- });
26
- return {
27
- applicationId: clientId,
28
- redirectURI: finalRedirectURI,
29
- scope
30
- };
31
- }; // Authorization Code Response:
32
- // https://tools.ietf.org/html/rfc6749#section-4.1.2
33
-
34
-
35
- const acknowledgeWithCode = async (authenticationData, {
36
- clientId,
37
- redirectURI,
38
- scope
39
- }, additionalParameters) => {
40
- const code = await oAuth2Code.create({ ...authenticationData,
41
- applicationId: clientId,
42
- scope
43
- }, redirectURI, additionalParameters);
44
- return {
45
- applicationId: clientId,
46
- redirectURI,
47
- scope,
48
- code
49
- };
50
- };
51
-
52
- const authenticateWithCode = async ({
53
- code,
54
- clientId,
55
- redirectURI
56
- }, authenticationData) => {
57
- // The client must be authenticated (for now, see below)
58
- if (!authenticationData) {
59
- throw new YError('E_UNAUTHORIZED');
60
- } // This check is not really necessary atm but it acts
61
- // as a reminder that this grant type could be used
62
- // without authenticating the client. In this
63
- // scenario, the authenticationData should be deducted
64
- // from the clientId and the code given in parameters
65
- // See https://tools.ietf.org/html/rfc6749#section-4.1.3
66
-
67
-
68
- if (clientId && clientId !== authenticationData.applicationId) {
69
- throw new YError('E_UNAUTHORIZED', clientId, authenticationData.applicationId);
70
- }
71
-
72
- await checkApplication({
73
- applicationId: authenticationData.applicationId,
74
- type: CODE_GRANTER_TYPE,
75
- scope: ''
76
- });
77
- const newAuthenticationData = await oAuth2Code.check(authenticationData, code, redirectURI);
78
- return newAuthenticationData;
79
- };
80
-
81
- log('debug', '👫 - OAuth2CodeGranter Service Initialized!');
82
- return {
83
- type: CODE_GRANTER_TYPE,
84
- authorizer: {
85
- responseType: 'code',
86
- authorize: authorizeWithCode
87
- },
88
- acknowledger: {
89
- acknowledgmentType: 'code',
90
- acknowledge: acknowledgeWithCode
91
- },
92
- authenticator: {
93
- grantType: 'authorization_code',
94
- authenticate: authenticateWithCode
95
- }
96
- };
97
- }
98
- //# sourceMappingURL=oAuth2CodeGranter.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oAuth2CodeGranter.mjs","names":["autoService","noop","YError","CODE_GRANTER_TYPE","initOAuth2CodeGranter","oAuth2Code","checkApplication","log","authorizeWithCode","clientId","redirectURI","scope","finalRedirectURI","applicationId","type","acknowledgeWithCode","authenticationData","additionalParameters","code","create","authenticateWithCode","newAuthenticationData","check","authorizer","responseType","authorize","acknowledger","acknowledgmentType","acknowledge","authenticator","grantType","authenticate"],"sources":["../../src/services/oAuth2CodeGranter.ts"],"sourcesContent":["import { autoService } from 'knifecycle';\nimport { noop } from '@whook/whook';\nimport YError from 'yerror';\nimport type { LogService } from 'common-services';\nimport type {\n OAuth2GranterService,\n OAuth2CodeService,\n CheckApplicationService,\n} from './oAuth2Granters';\nimport type { BaseAuthenticationData } from '@whook/authorization';\n\nexport const CODE_GRANTER_TYPE = 'code';\n\nexport type OAuth2CodeGranterDependencies = {\n oAuth2Code: OAuth2CodeService;\n checkApplication: CheckApplicationService;\n log?: LogService;\n};\nexport type OAuth2CodeGranterParameters = {\n code: string;\n redirectURI: string;\n clientId: string;\n};\nexport type OAuth2CodeGranterService<\n AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData,\n> = OAuth2GranterService<\n Record<string, unknown>,\n Record<string, unknown>,\n OAuth2CodeGranterParameters,\n AUTHENTICATION_DATA\n>;\n\nexport default autoService(initOAuth2CodeGranter);\n\n// Authorization Code Grant\n// https://tools.ietf.org/html/rfc6749#section-4.1\nasync function initOAuth2CodeGranter({\n oAuth2Code,\n checkApplication,\n log = noop,\n}: OAuth2CodeGranterDependencies): Promise<OAuth2CodeGranterService> {\n const authorizeWithCode: NonNullable<\n OAuth2CodeGranterService['authorizer']\n >['authorize'] = async ({ clientId, redirectURI, scope = '' }) => {\n const { redirectURI: finalRedirectURI } = await checkApplication({\n applicationId: clientId,\n type: CODE_GRANTER_TYPE,\n redirectURI,\n scope,\n });\n\n return {\n applicationId: clientId,\n redirectURI: finalRedirectURI,\n scope,\n };\n };\n\n // Authorization Code Response:\n // https://tools.ietf.org/html/rfc6749#section-4.1.2\n const acknowledgeWithCode: NonNullable<\n OAuth2CodeGranterService['acknowledger']\n >['acknowledge'] = async (\n authenticationData,\n { clientId, redirectURI, scope },\n additionalParameters,\n ) => {\n const code = await oAuth2Code.create(\n { ...authenticationData, applicationId: clientId, scope },\n redirectURI,\n additionalParameters,\n );\n\n return {\n applicationId: clientId,\n redirectURI,\n scope,\n code,\n };\n };\n\n const authenticateWithCode: NonNullable<\n OAuth2CodeGranterService['authenticator']\n >['authenticate'] = async (\n { code, clientId, redirectURI },\n authenticationData,\n ) => {\n // The client must be authenticated (for now, see below)\n if (!authenticationData) {\n throw new YError('E_UNAUTHORIZED');\n }\n\n // This check is not really necessary atm but it acts\n // as a reminder that this grant type could be used\n // without authenticating the client. In this\n // scenario, the authenticationData should be deducted\n // from the clientId and the code given in parameters\n // See https://tools.ietf.org/html/rfc6749#section-4.1.3\n if (clientId && clientId !== authenticationData.applicationId) {\n throw new YError(\n 'E_UNAUTHORIZED',\n clientId,\n authenticationData.applicationId,\n );\n }\n\n await checkApplication({\n applicationId: authenticationData.applicationId,\n type: CODE_GRANTER_TYPE,\n scope: '',\n });\n\n const newAuthenticationData = await oAuth2Code.check(\n authenticationData,\n code,\n redirectURI,\n );\n\n return newAuthenticationData;\n };\n\n log('debug', '👫 - OAuth2CodeGranter Service Initialized!');\n\n return {\n type: CODE_GRANTER_TYPE,\n authorizer: {\n responseType: 'code',\n authorize: authorizeWithCode,\n },\n acknowledger: {\n acknowledgmentType: 'code',\n acknowledge: acknowledgeWithCode,\n },\n authenticator: {\n grantType: 'authorization_code',\n authenticate: authenticateWithCode,\n },\n };\n}\n"],"mappings":"AAAA,SAASA,OAAW,IAAXA,QAAT,QAA4B,YAA5B;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,OAAOC,MAAP,MAAmB,QAAnB;AASA,OAAO,MAAMC,iBAAiB,GAAG,MAA1B;AAqBP,eAAeH,QAAW,CAACI,qBAAD,kEAA1B,C,CAEA;AACA;;AACA,eAAeA,qBAAf,CAAqC;EACnCC,UADmC;EAEnCC,gBAFmC;EAGnCC,GAAG,GAAGN;AAH6B,CAArC,EAIqE;EACnE,MAAMO,iBAEQ,GAAG,OAAO;IAAEC,QAAF;IAAYC,WAAZ;IAAyBC,KAAK,GAAG;EAAjC,CAAP,KAAiD;IAChE,MAAM;MAAED,WAAW,EAAEE;IAAf,IAAoC,MAAMN,gBAAgB,CAAC;MAC/DO,aAAa,EAAEJ,QADgD;MAE/DK,IAAI,EAAEX,iBAFyD;MAG/DO,WAH+D;MAI/DC;IAJ+D,CAAD,CAAhE;IAOA,OAAO;MACLE,aAAa,EAAEJ,QADV;MAELC,WAAW,EAAEE,gBAFR;MAGLD;IAHK,CAAP;EAKD,CAfD,CADmE,CAkBnE;EACA;;;EACA,MAAMI,mBAEU,GAAG,OACjBC,kBADiB,EAEjB;IAAEP,QAAF;IAAYC,WAAZ;IAAyBC;EAAzB,CAFiB,EAGjBM,oBAHiB,KAId;IACH,MAAMC,IAAI,GAAG,MAAMb,UAAU,CAACc,MAAX,CACjB,EAAE,GAAGH,kBAAL;MAAyBH,aAAa,EAAEJ,QAAxC;MAAkDE;IAAlD,CADiB,EAEjBD,WAFiB,EAGjBO,oBAHiB,CAAnB;IAMA,OAAO;MACLJ,aAAa,EAAEJ,QADV;MAELC,WAFK;MAGLC,KAHK;MAILO;IAJK,CAAP;EAMD,CAnBD;;EAqBA,MAAME,oBAEW,GAAG,OAClB;IAAEF,IAAF;IAAQT,QAAR;IAAkBC;EAAlB,CADkB,EAElBM,kBAFkB,KAGf;IACH;IACA,IAAI,CAACA,kBAAL,EAAyB;MACvB,MAAM,IAAId,MAAJ,CAAW,gBAAX,CAAN;IACD,CAJE,CAMH;IACA;IACA;IACA;IACA;IACA;;;IACA,IAAIO,QAAQ,IAAIA,QAAQ,KAAKO,kBAAkB,CAACH,aAAhD,EAA+D;MAC7D,MAAM,IAAIX,MAAJ,CACJ,gBADI,EAEJO,QAFI,EAGJO,kBAAkB,CAACH,aAHf,CAAN;IAKD;;IAED,MAAMP,gBAAgB,CAAC;MACrBO,aAAa,EAAEG,kBAAkB,CAACH,aADb;MAErBC,IAAI,EAAEX,iBAFe;MAGrBQ,KAAK,EAAE;IAHc,CAAD,CAAtB;IAMA,MAAMU,qBAAqB,GAAG,MAAMhB,UAAU,CAACiB,KAAX,CAClCN,kBADkC,EAElCE,IAFkC,EAGlCR,WAHkC,CAApC;IAMA,OAAOW,qBAAP;EACD,CAtCD;;EAwCAd,GAAG,CAAC,OAAD,EAAU,6CAAV,CAAH;EAEA,OAAO;IACLO,IAAI,EAAEX,iBADD;IAELoB,UAAU,EAAE;MACVC,YAAY,EAAE,MADJ;MAEVC,SAAS,EAAEjB;IAFD,CAFP;IAMLkB,YAAY,EAAE;MACZC,kBAAkB,EAAE,MADR;MAEZC,WAAW,EAAEb;IAFD,CANT;IAULc,aAAa,EAAE;MACbC,SAAS,EAAE,oBADE;MAEbC,YAAY,EAAEX;IAFD;EAVV,CAAP;AAeD"}
@@ -1,83 +0,0 @@
1
- import initOAuth2CodeGranter from './oAuth2CodeGranter';
2
- describe('OAuth2CodeGranter', () => {
3
- const oAuth2Code = {
4
- create: jest.fn(),
5
- check: jest.fn()
6
- };
7
- const checkApplication = jest.fn();
8
- const log = jest.fn();
9
- beforeEach(() => {
10
- oAuth2Code.create.mockReset();
11
- oAuth2Code.check.mockReset();
12
- checkApplication.mockReset();
13
- log.mockReset();
14
- });
15
- it('should work with a complete valid flow', async () => {
16
- var _oAuth2CodeGranter$au, _oAuth2CodeGranter$ac, _oAuth2CodeGranter$au2;
17
-
18
- const oAuth2CodeGranter = await initOAuth2CodeGranter({
19
- checkApplication,
20
- oAuth2Code,
21
- log
22
- });
23
- checkApplication.mockResolvedValue({
24
- redirectURI: 'https://www.example.com'
25
- });
26
- oAuth2Code.create.mockResolvedValueOnce('yolo');
27
- oAuth2Code.check.mockResolvedValueOnce({
28
- applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
29
- scope: 'user'
30
- });
31
- const authorizerResult = await ((_oAuth2CodeGranter$au = oAuth2CodeGranter.authorizer) === null || _oAuth2CodeGranter$au === void 0 ? void 0 : _oAuth2CodeGranter$au.authorize({
32
- clientId: 'abbacaca-abba-caca-abba-cacaabbacaca',
33
- redirectURI: 'https://www.example.com/oauth2/code',
34
- scope: 'user'
35
- }));
36
- const acknowledgerResult = await ((_oAuth2CodeGranter$ac = oAuth2CodeGranter.acknowledger) === null || _oAuth2CodeGranter$ac === void 0 ? void 0 : _oAuth2CodeGranter$ac.acknowledge({
37
- applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
38
- scope: 'user, admin'
39
- }, {
40
- clientId: 'abbacaca-abba-caca-abba-cacaabbacaca',
41
- redirectURI: 'https://www.example.com/oauth2/code',
42
- scope: 'user'
43
- }, {}));
44
- const authenticatorResult = await ((_oAuth2CodeGranter$au2 = oAuth2CodeGranter.authenticator) === null || _oAuth2CodeGranter$au2 === void 0 ? void 0 : _oAuth2CodeGranter$au2.authenticate({
45
- clientId: 'abbacaca-abba-caca-abba-cacaabbacaca',
46
- redirectURI: 'https://www.example.com/oauth2/code',
47
- code: 'yolo'
48
- }, {
49
- applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
50
- scope: 'user'
51
- }));
52
- expect({
53
- authorizerResult,
54
- acknowledgerResult,
55
- authenticatorResult
56
- }).toMatchInlineSnapshot(`
57
- Object {
58
- "acknowledgerResult": Object {
59
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
60
- "code": "yolo",
61
- "redirectURI": "https://www.example.com/oauth2/code",
62
- "scope": "user",
63
- },
64
- "authenticatorResult": Object {
65
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
66
- "scope": "user",
67
- },
68
- "authorizerResult": Object {
69
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
70
- "redirectURI": "https://www.example.com",
71
- "scope": "user",
72
- },
73
- }
74
- `);
75
- expect({
76
- oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,
77
- oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,
78
- checkApplicationCalls: checkApplication.mock.calls,
79
- logCalls: log.mock.calls
80
- }).toMatchSnapshot();
81
- });
82
- });
83
- //# sourceMappingURL=oAuth2CodeGranter.test.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oAuth2CodeGranter.test.mjs","names":["initOAuth2CodeGranter","describe","oAuth2Code","create","jest","fn","check","checkApplication","log","beforeEach","mockReset","it","oAuth2CodeGranter","mockResolvedValue","redirectURI","mockResolvedValueOnce","applicationId","scope","authorizerResult","authorizer","authorize","clientId","acknowledgerResult","acknowledger","acknowledge","authenticatorResult","authenticator","authenticate","code","expect","toMatchInlineSnapshot","oAuth2CodeCreateCalls","mock","calls","oAuth2CodeCheckCalls","checkApplicationCalls","logCalls","toMatchSnapshot"],"sources":["../../src/services/oAuth2CodeGranter.test.ts"],"sourcesContent":["import initOAuth2CodeGranter from './oAuth2CodeGranter';\n\ndescribe('OAuth2CodeGranter', () => {\n const oAuth2Code = {\n create: jest.fn(),\n check: jest.fn(),\n };\n const checkApplication = jest.fn();\n const log = jest.fn();\n\n beforeEach(() => {\n oAuth2Code.create.mockReset();\n oAuth2Code.check.mockReset();\n checkApplication.mockReset();\n log.mockReset();\n });\n\n it('should work with a complete valid flow', async () => {\n const oAuth2CodeGranter = await initOAuth2CodeGranter({\n checkApplication,\n oAuth2Code,\n log,\n });\n\n checkApplication.mockResolvedValue({\n redirectURI: 'https://www.example.com',\n });\n oAuth2Code.create.mockResolvedValueOnce('yolo');\n oAuth2Code.check.mockResolvedValueOnce({\n applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',\n scope: 'user',\n });\n\n const authorizerResult = await oAuth2CodeGranter.authorizer?.authorize({\n clientId: 'abbacaca-abba-caca-abba-cacaabbacaca',\n redirectURI: 'https://www.example.com/oauth2/code',\n scope: 'user',\n });\n const acknowledgerResult =\n await oAuth2CodeGranter.acknowledger?.acknowledge(\n {\n applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',\n scope: 'user, admin',\n },\n {\n clientId: 'abbacaca-abba-caca-abba-cacaabbacaca',\n redirectURI: 'https://www.example.com/oauth2/code',\n scope: 'user',\n },\n {},\n );\n const authenticatorResult =\n await oAuth2CodeGranter.authenticator?.authenticate(\n {\n clientId: 'abbacaca-abba-caca-abba-cacaabbacaca',\n redirectURI: 'https://www.example.com/oauth2/code',\n code: 'yolo',\n },\n {\n applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',\n scope: 'user',\n },\n );\n\n expect({\n authorizerResult,\n acknowledgerResult,\n authenticatorResult,\n }).toMatchInlineSnapshot(`\n Object {\n \"acknowledgerResult\": Object {\n \"applicationId\": \"abbacaca-abba-caca-abba-cacaabbacaca\",\n \"code\": \"yolo\",\n \"redirectURI\": \"https://www.example.com/oauth2/code\",\n \"scope\": \"user\",\n },\n \"authenticatorResult\": Object {\n \"applicationId\": \"abbacaca-abba-caca-abba-cacaabbacaca\",\n \"scope\": \"user\",\n },\n \"authorizerResult\": Object {\n \"applicationId\": \"abbacaca-abba-caca-abba-cacaabbacaca\",\n \"redirectURI\": \"https://www.example.com\",\n \"scope\": \"user\",\n },\n }\n `);\n expect({\n oAuth2CodeCreateCalls: oAuth2Code.create.mock.calls,\n oAuth2CodeCheckCalls: oAuth2Code.check.mock.calls,\n checkApplicationCalls: checkApplication.mock.calls,\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