@celljs/oauth2-client 3.7.8 → 3.9.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 (219) hide show
  1. package/esm/node/authentication/authentication-protocol.d.ts +24 -0
  2. package/esm/node/authentication/authentication-protocol.js +8 -0
  3. package/esm/node/authentication/authentication-protocol.js.map +1 -0
  4. package/esm/node/authentication/index.d.ts +3 -0
  5. package/esm/node/authentication/index.js +4 -0
  6. package/esm/node/authentication/index.js.map +1 -0
  7. package/esm/node/authentication/oauth2-authentication-provider.d.ts +29 -0
  8. package/esm/node/authentication/oauth2-authentication-provider.js +167 -0
  9. package/esm/node/authentication/oauth2-authentication-provider.js.map +1 -0
  10. package/esm/node/authentication/oidc-authentication-provider.d.ts +17 -0
  11. package/esm/node/authentication/oidc-authentication-provider.js +71 -0
  12. package/esm/node/authentication/oidc-authentication-provider.js.map +1 -0
  13. package/esm/node/authorization/authorization-code-authorized-client-provider.d.ts +4 -0
  14. package/esm/node/authorization/authorization-code-authorized-client-provider.js +24 -0
  15. package/esm/node/authorization/authorization-code-authorized-client-provider.js.map +1 -0
  16. package/esm/node/authorization/authorization-code-grant-middleware.d.ts +25 -0
  17. package/esm/node/authorization/authorization-code-grant-middleware.js +126 -0
  18. package/esm/node/authorization/authorization-code-grant-middleware.js.map +1 -0
  19. package/esm/node/authorization/authorization-failure-handler.d.ts +9 -0
  20. package/esm/node/authorization/authorization-failure-handler.js +32 -0
  21. package/esm/node/authorization/authorization-failure-handler.js.map +1 -0
  22. package/esm/node/authorization/authorization-protocol.d.ts +77 -0
  23. package/esm/node/authorization/authorization-protocol.js +31 -0
  24. package/esm/node/authorization/authorization-protocol.js.map +1 -0
  25. package/esm/node/authorization/authorization-request-manager.d.ts +12 -0
  26. package/esm/node/authorization/authorization-request-manager.js +61 -0
  27. package/esm/node/authorization/authorization-request-manager.js.map +1 -0
  28. package/esm/node/authorization/authorization-request-redirect-middleware.d.ts +19 -0
  29. package/esm/node/authorization/authorization-request-redirect-middleware.js +110 -0
  30. package/esm/node/authorization/authorization-request-redirect-middleware.js.map +1 -0
  31. package/esm/node/authorization/authorization-request-resolver.d.ts +37 -0
  32. package/esm/node/authorization/authorization-request-resolver.js +153 -0
  33. package/esm/node/authorization/authorization-request-resolver.js.map +1 -0
  34. package/esm/node/authorization/authorization-success-handler.d.ts +6 -0
  35. package/esm/node/authorization/authorization-success-handler.js +25 -0
  36. package/esm/node/authorization/authorization-success-handler.js.map +1 -0
  37. package/esm/node/authorization/authorized-client-manager.d.ts +10 -0
  38. package/esm/node/authorization/authorized-client-manager.js +45 -0
  39. package/esm/node/authorization/authorized-client-manager.js.map +1 -0
  40. package/esm/node/authorization/authorized-client-service.d.ts +11 -0
  41. package/esm/node/authorization/authorized-client-service.js +84 -0
  42. package/esm/node/authorization/authorized-client-service.js.map +1 -0
  43. package/esm/node/authorization/client-credentials-authorized-client-provider.d.ts +11 -0
  44. package/esm/node/authorization/client-credentials-authorized-client-provider.js +69 -0
  45. package/esm/node/authorization/client-credentials-authorized-client-provider.js.map +1 -0
  46. package/esm/node/authorization/context-attributes-mapper.d.ts +4 -0
  47. package/esm/node/authorization/context-attributes-mapper.js +25 -0
  48. package/esm/node/authorization/context-attributes-mapper.js.map +1 -0
  49. package/esm/node/authorization/index.d.ts +13 -0
  50. package/esm/node/authorization/index.js +14 -0
  51. package/esm/node/authorization/index.js.map +1 -0
  52. package/esm/node/authorization/password-authorized-client-provider.d.ts +11 -0
  53. package/esm/node/authorization/password-authorized-client-provider.js +82 -0
  54. package/esm/node/authorization/password-authorized-client-provider.js.map +1 -0
  55. package/esm/node/authorization/refresh-token-authorized-client-provider.d.ts +11 -0
  56. package/esm/node/authorization/refresh-token-authorized-client-provider.js +65 -0
  57. package/esm/node/authorization/refresh-token-authorized-client-provider.js.map +1 -0
  58. package/esm/node/constants.d.ts +4 -0
  59. package/esm/node/constants.js +5 -0
  60. package/esm/node/constants.js.map +1 -0
  61. package/esm/node/endpoint/authorization-code-token-response-client.d.ts +11 -0
  62. package/esm/node/endpoint/authorization-code-token-response-client.js +80 -0
  63. package/esm/node/endpoint/authorization-code-token-response-client.js.map +1 -0
  64. package/esm/node/endpoint/client-credentials-token-response-client.d.ts +11 -0
  65. package/esm/node/endpoint/client-credentials-token-response-client.js +77 -0
  66. package/esm/node/endpoint/client-credentials-token-response-client.js.map +1 -0
  67. package/esm/node/endpoint/endpoint-protocol.d.ts +47 -0
  68. package/esm/node/endpoint/endpoint-protocol.js +6 -0
  69. package/esm/node/endpoint/endpoint-protocol.js.map +1 -0
  70. package/esm/node/endpoint/index.d.ts +6 -0
  71. package/esm/node/endpoint/index.js +7 -0
  72. package/esm/node/endpoint/index.js.map +1 -0
  73. package/esm/node/endpoint/password-token-response-client.d.ts +11 -0
  74. package/esm/node/endpoint/password-token-response-client.js +79 -0
  75. package/esm/node/endpoint/password-token-response-client.js.map +1 -0
  76. package/esm/node/endpoint/refresh-token-token-response-client.d.ts +11 -0
  77. package/esm/node/endpoint/refresh-token-token-response-client.js +84 -0
  78. package/esm/node/endpoint/refresh-token-token-response-client.js.map +1 -0
  79. package/esm/node/endpoint/user-response-client.d.ts +8 -0
  80. package/esm/node/endpoint/user-response-client.js +81 -0
  81. package/esm/node/endpoint/user-response-client.js.map +1 -0
  82. package/esm/node/error/error-handler.d.ts +10 -0
  83. package/esm/node/error/error-handler.js +50 -0
  84. package/esm/node/error/error-handler.js.map +1 -0
  85. package/esm/node/error/error-protocol.d.ts +2 -0
  86. package/esm/node/error/error-protocol.js +4 -0
  87. package/esm/node/error/error-protocol.js.map +1 -0
  88. package/esm/node/error/error.d.ts +9 -0
  89. package/esm/node/error/error.js +18 -0
  90. package/esm/node/error/error.js.map +1 -0
  91. package/esm/node/error/index.d.ts +3 -0
  92. package/esm/node/error/index.js +4 -0
  93. package/esm/node/error/index.js.map +1 -0
  94. package/esm/node/index.d.ts +7 -0
  95. package/esm/node/index.js +8 -0
  96. package/esm/node/index.js.map +1 -0
  97. package/esm/node/module.d.ts +3 -0
  98. package/esm/node/module.js +4 -0
  99. package/esm/node/module.js.map +1 -0
  100. package/esm/node/provider/index.d.ts +2 -0
  101. package/esm/node/provider/index.js +3 -0
  102. package/esm/node/provider/index.js.map +1 -0
  103. package/esm/node/provider/provider-details-manager.d.ts +11 -0
  104. package/esm/node/provider/provider-details-manager.js +47 -0
  105. package/esm/node/provider/provider-details-manager.js.map +1 -0
  106. package/esm/node/provider/provider-protocol.d.ts +20 -0
  107. package/esm/node/provider/provider-protocol.js +2 -0
  108. package/esm/node/provider/provider-protocol.js.map +1 -0
  109. package/esm/node/registration/id-token-jwt-decoder-facatory.d.ts +14 -0
  110. package/esm/node/registration/id-token-jwt-decoder-facatory.js +86 -0
  111. package/esm/node/registration/id-token-jwt-decoder-facatory.js.map +1 -0
  112. package/esm/node/registration/index.d.ts +4 -0
  113. package/esm/node/registration/index.js +5 -0
  114. package/esm/node/registration/index.js.map +1 -0
  115. package/esm/node/registration/jws-algorithm-resolver.d.ts +4 -0
  116. package/esm/node/registration/jws-algorithm-resolver.js +19 -0
  117. package/esm/node/registration/jws-algorithm-resolver.js.map +1 -0
  118. package/esm/node/registration/registration-manager.d.ts +14 -0
  119. package/esm/node/registration/registration-manager.js +61 -0
  120. package/esm/node/registration/registration-manager.js.map +1 -0
  121. package/esm/node/registration/registration-protocol.d.ts +21 -0
  122. package/esm/node/registration/registration-protocol.js +4 -0
  123. package/esm/node/registration/registration-protocol.js.map +1 -0
  124. package/esm/node/user/index.d.ts +3 -0
  125. package/esm/node/user/index.js +4 -0
  126. package/esm/node/user/index.js.map +1 -0
  127. package/esm/node/user/oauth2-user-service.d.ts +9 -0
  128. package/esm/node/user/oauth2-user-service.js +58 -0
  129. package/esm/node/user/oauth2-user-service.js.map +1 -0
  130. package/esm/node/user/oidc-user-service.d.ts +12 -0
  131. package/esm/node/user/oidc-user-service.js +95 -0
  132. package/esm/node/user/oidc-user-service.js.map +1 -0
  133. package/esm/node/user/user-protocol.d.ts +5 -0
  134. package/esm/node/user/user-protocol.js +2 -0
  135. package/esm/node/user/user-protocol.js.map +1 -0
  136. package/esm/node/utils/authorization-grant-request-entity-util.d.ts +9 -0
  137. package/esm/node/utils/authorization-grant-request-entity-util.js +26 -0
  138. package/esm/node/utils/authorization-grant-request-entity-util.js.map +1 -0
  139. package/esm/node/utils/authorization-response-util.d.ts +7 -0
  140. package/esm/node/utils/authorization-response-util.js +50 -0
  141. package/esm/node/utils/authorization-response-util.js.map +1 -0
  142. package/esm/node/utils/index.d.ts +2 -0
  143. package/esm/node/utils/index.js +3 -0
  144. package/esm/node/utils/index.js.map +1 -0
  145. package/esm/package.json +3 -0
  146. package/lib/node/authentication/authentication-protocol.js.map +1 -1
  147. package/lib/node/authentication/oauth2-authentication-provider.d.ts.map +1 -1
  148. package/lib/node/authentication/oauth2-authentication-provider.js.map +1 -1
  149. package/lib/node/authentication/oidc-authentication-provider.d.ts.map +1 -1
  150. package/lib/node/authentication/oidc-authentication-provider.js.map +1 -1
  151. package/lib/node/authorization/authorization-code-authorized-client-provider.d.ts.map +1 -1
  152. package/lib/node/authorization/authorization-code-authorized-client-provider.js.map +1 -1
  153. package/lib/node/authorization/authorization-code-grant-middleware.d.ts.map +1 -1
  154. package/lib/node/authorization/authorization-code-grant-middleware.js.map +1 -1
  155. package/lib/node/authorization/authorization-failure-handler.d.ts.map +1 -1
  156. package/lib/node/authorization/authorization-failure-handler.js.map +1 -1
  157. package/lib/node/authorization/authorization-protocol.js.map +1 -1
  158. package/lib/node/authorization/authorization-request-manager.d.ts.map +1 -1
  159. package/lib/node/authorization/authorization-request-manager.js.map +1 -1
  160. package/lib/node/authorization/authorization-request-redirect-middleware.d.ts.map +1 -1
  161. package/lib/node/authorization/authorization-request-redirect-middleware.js.map +1 -1
  162. package/lib/node/authorization/authorization-request-resolver.d.ts.map +1 -1
  163. package/lib/node/authorization/authorization-request-resolver.js +34 -1
  164. package/lib/node/authorization/authorization-request-resolver.js.map +1 -1
  165. package/lib/node/authorization/authorization-success-handler.d.ts.map +1 -1
  166. package/lib/node/authorization/authorization-success-handler.js.map +1 -1
  167. package/lib/node/authorization/authorized-client-manager.d.ts.map +1 -1
  168. package/lib/node/authorization/authorized-client-manager.js.map +1 -1
  169. package/lib/node/authorization/authorized-client-service.d.ts.map +1 -1
  170. package/lib/node/authorization/authorized-client-service.js.map +1 -1
  171. package/lib/node/authorization/client-credentials-authorized-client-provider.d.ts.map +1 -1
  172. package/lib/node/authorization/client-credentials-authorized-client-provider.js.map +1 -1
  173. package/lib/node/authorization/context-attributes-mapper.d.ts.map +1 -1
  174. package/lib/node/authorization/context-attributes-mapper.js.map +1 -1
  175. package/lib/node/authorization/password-authorized-client-provider.d.ts.map +1 -1
  176. package/lib/node/authorization/password-authorized-client-provider.js.map +1 -1
  177. package/lib/node/authorization/refresh-token-authorized-client-provider.d.ts.map +1 -1
  178. package/lib/node/authorization/refresh-token-authorized-client-provider.js.map +1 -1
  179. package/lib/node/endpoint/authorization-code-token-response-client.d.ts.map +1 -1
  180. package/lib/node/endpoint/authorization-code-token-response-client.js +34 -1
  181. package/lib/node/endpoint/authorization-code-token-response-client.js.map +1 -1
  182. package/lib/node/endpoint/client-credentials-token-response-client.d.ts.map +1 -1
  183. package/lib/node/endpoint/client-credentials-token-response-client.js +34 -1
  184. package/lib/node/endpoint/client-credentials-token-response-client.js.map +1 -1
  185. package/lib/node/endpoint/password-token-response-client.d.ts.map +1 -1
  186. package/lib/node/endpoint/password-token-response-client.js +34 -1
  187. package/lib/node/endpoint/password-token-response-client.js.map +1 -1
  188. package/lib/node/endpoint/refresh-token-token-response-client.d.ts.map +1 -1
  189. package/lib/node/endpoint/refresh-token-token-response-client.js +34 -1
  190. package/lib/node/endpoint/refresh-token-token-response-client.js.map +1 -1
  191. package/lib/node/endpoint/user-response-client.d.ts.map +1 -1
  192. package/lib/node/endpoint/user-response-client.js +34 -1
  193. package/lib/node/endpoint/user-response-client.js.map +1 -1
  194. package/lib/node/error/error-handler.d.ts.map +1 -1
  195. package/lib/node/error/error-handler.js.map +1 -1
  196. package/lib/node/error/error.d.ts.map +1 -1
  197. package/lib/node/error/error.js.map +1 -1
  198. package/lib/node/module.d.ts.map +1 -1
  199. package/lib/node/module.js.map +1 -1
  200. package/lib/node/provider/provider-details-manager.d.ts.map +1 -1
  201. package/lib/node/provider/provider-details-manager.js.map +1 -1
  202. package/lib/node/registration/id-token-jwt-decoder-facatory.d.ts.map +1 -1
  203. package/lib/node/registration/id-token-jwt-decoder-facatory.js.map +1 -1
  204. package/lib/node/registration/jws-algorithm-resolver.d.ts.map +1 -1
  205. package/lib/node/registration/jws-algorithm-resolver.js.map +1 -1
  206. package/lib/node/registration/registration-manager.d.ts.map +1 -1
  207. package/lib/node/registration/registration-manager.js.map +1 -1
  208. package/lib/node/user/oauth2-user-service.d.ts.map +1 -1
  209. package/lib/node/user/oauth2-user-service.js.map +1 -1
  210. package/lib/node/user/oidc-user-service.d.ts.map +1 -1
  211. package/lib/node/user/oidc-user-service.js.map +1 -1
  212. package/lib/node/utils/authorization-grant-request-entity-util.js.map +1 -1
  213. package/lib/node/utils/authorization-response-util.js.map +1 -1
  214. package/lib/package.spec.d.ts +1 -0
  215. package/lib/package.spec.js +5 -2
  216. package/lib/package.spec.js.map +1 -1
  217. package/package.json +76 -14
  218. package/src/package.spec.ts +1 -0
  219. package/LICENSE +0 -21
@@ -0,0 +1,11 @@
1
+ import { AuthorizedClientService, AuthorizeRequest, AuthorizedClient, AuthorizedClientProvider, AuthorizedClientManager, ContextAttributesMapper, AuthorizationSuccessHandler, AuthorizationFailureHandler } from './authorization-protocol.js';
2
+ import { ClientRegistrationManager } from '../registration/index.js';
3
+ export declare class DefaultAuthorizedClientService implements AuthorizedClientService {
4
+ protected readonly authorizedClientProviders: AuthorizedClientProvider[];
5
+ protected readonly clientRegistrationManager: ClientRegistrationManager;
6
+ protected readonly authorizedClientManager: AuthorizedClientManager<AuthorizedClient>;
7
+ protected readonly contextAttributesMapper: ContextAttributesMapper;
8
+ protected readonly authorizationSuccessHandler: AuthorizationSuccessHandler;
9
+ protected readonly authorizationFailureHandler: AuthorizationFailureHandler;
10
+ authorize(authorizeRequest: AuthorizeRequest): Promise<AuthorizedClient | undefined>;
11
+ }
@@ -0,0 +1,84 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { AuthorizedClientService, AuthorizedClientProvider, AuthorizedClientManager, ContextAttributesMapper, AuthorizationSuccessHandler, AuthorizationFailureHandler } from './authorization-protocol.js';
11
+ import { Component, Autowired } from '@celljs/core';
12
+ import { ClientRegistrationManager } from '../registration/index.js';
13
+ import { ok } from 'assert';
14
+ import { OAuth2AuthorizationError } from '@celljs/oauth2-core';
15
+ let DefaultAuthorizedClientService = class DefaultAuthorizedClientService {
16
+ async authorize(authorizeRequest) {
17
+ const { clientRegistrationId, principal, authorizedClient, attributes } = authorizeRequest;
18
+ const contextAttributes = await this.contextAttributesMapper.apply(authorizeRequest);
19
+ if (attributes) {
20
+ for (const [key, value] of attributes.entries()) {
21
+ contextAttributes.set(key, value);
22
+ }
23
+ }
24
+ const context = {
25
+ principal,
26
+ attributes: contextAttributes
27
+ };
28
+ if (!authorizedClient) {
29
+ const clientRegistration = await this.clientRegistrationManager.get(clientRegistrationId);
30
+ ok(clientRegistration, `Could not find ClientRegistration with id '${clientRegistrationId}'`);
31
+ context.clientRegistration = clientRegistration;
32
+ context.authorizedClient = await this.authorizedClientManager.get(clientRegistrationId, principal.name);
33
+ }
34
+ let client;
35
+ try {
36
+ for (const authorizedClientProvider of this.authorizedClientProviders) {
37
+ client = await authorizedClientProvider.provide(context);
38
+ if (client) {
39
+ break;
40
+ }
41
+ }
42
+ }
43
+ catch (error) {
44
+ if (error instanceof OAuth2AuthorizationError) {
45
+ await this.authorizationFailureHandler.onAuthorizationFailure(error, principal);
46
+ }
47
+ throw error;
48
+ }
49
+ if (client) {
50
+ await this.authorizationSuccessHandler.onAuthorizationSuccess(client, principal);
51
+ return client;
52
+ }
53
+ return authorizedClient;
54
+ }
55
+ };
56
+ __decorate([
57
+ Autowired(AuthorizedClientProvider),
58
+ __metadata("design:type", Array)
59
+ ], DefaultAuthorizedClientService.prototype, "authorizedClientProviders", void 0);
60
+ __decorate([
61
+ Autowired(ClientRegistrationManager),
62
+ __metadata("design:type", Object)
63
+ ], DefaultAuthorizedClientService.prototype, "clientRegistrationManager", void 0);
64
+ __decorate([
65
+ Autowired(AuthorizedClientManager),
66
+ __metadata("design:type", Object)
67
+ ], DefaultAuthorizedClientService.prototype, "authorizedClientManager", void 0);
68
+ __decorate([
69
+ Autowired(ContextAttributesMapper),
70
+ __metadata("design:type", Object)
71
+ ], DefaultAuthorizedClientService.prototype, "contextAttributesMapper", void 0);
72
+ __decorate([
73
+ Autowired(AuthorizationSuccessHandler),
74
+ __metadata("design:type", Object)
75
+ ], DefaultAuthorizedClientService.prototype, "authorizationSuccessHandler", void 0);
76
+ __decorate([
77
+ Autowired(AuthorizationFailureHandler),
78
+ __metadata("design:type", Object)
79
+ ], DefaultAuthorizedClientService.prototype, "authorizationFailureHandler", void 0);
80
+ DefaultAuthorizedClientService = __decorate([
81
+ Component(AuthorizedClientService)
82
+ ], DefaultAuthorizedClientService);
83
+ export { DefaultAuthorizedClientService };
84
+ //# sourceMappingURL=authorized-client-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorized-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BAAgB,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,oBAAoB,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5G,CAAC;QAED,IAAI,MAAoC,CAAC;QAEzC,IAAI,CAAC;YACD,KAAK,MAAM,wBAAwB,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACpE,MAAM,GAAG,MAAM,wBAAwB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACzD,IAAI,MAAM,EAAE,CAAC;oBACT,MAAM;gBACV,CAAC;YACL,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,KAAK,YAAY,wBAAwB,EAAE,CAAC;gBAC5C,MAAM,IAAI,CAAC,2BAA2B,CAAC,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACpF,CAAC;YACD,MAAM,KAAK,CAAC;QAChB,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACT,MAAM,IAAI,CAAC,2BAA2B,CAAC,sBAAsB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YACjF,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,OAAO,gBAAgB,CAAC;IAE5B,CAAC;CAEJ,CAAA;AA7DsB;IADlB,SAAS,CAAC,wBAAwB,CAAC;;iFACqC;AAGtD;IADlB,SAAS,CAAC,yBAAyB,CAAC;;iFACmC;AAGrD;IADlB,SAAS,CAAC,uBAAuB,CAAC;;+EACmD;AAGnE;IADlB,SAAS,CAAC,uBAAuB,CAAC;;+EACiC;AAGjD;IADlB,SAAS,CAAC,2BAA2B,CAAC;;mFACqC;AAGzD;IADlB,SAAS,CAAC,2BAA2B,CAAC;;mFACqC;AAlBnE,8BAA8B;IAD1C,SAAS,CAAC,uBAAuB,CAAC;GACtB,8BAA8B,CAgE1C"}
@@ -0,0 +1,11 @@
1
+ import { AuthorizedClientProvider, AuthorizationContext, AuthorizedClient } from './authorization-protocol.js';
2
+ import { AccessToken } from '@celljs/oauth2-core';
3
+ import { ClientCredentialsTokenResponseClient } from '../endpoint/index.js';
4
+ import { ClientRegistration } from '../registration/index.js';
5
+ export declare class ClientCredentialsAuthorizedClientProvider implements AuthorizedClientProvider {
6
+ protected readonly clockSkew: number;
7
+ protected readonly accessTokenResponseClient: ClientCredentialsTokenResponseClient;
8
+ provide(context: AuthorizationContext): Promise<AuthorizedClient | undefined>;
9
+ hasTokenExpired(accessToken: AccessToken): boolean;
10
+ protected getTokenResponse(clientRegistration: ClientRegistration): Promise<import("@celljs/oauth2-core").AccessTokenResponse>;
11
+ }
@@ -0,0 +1,69 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { AuthorizedClientProvider } from './authorization-protocol.js';
11
+ import { AuthorizationGrantType, OAuth2AuthorizationError } from '@celljs/oauth2-core';
12
+ import { Component, Autowired, Value } from '@celljs/core';
13
+ import { ClientCredentialsTokenResponseClient } from '../endpoint/index.js';
14
+ import { ClientAuthorizationError } from '../error/index.js';
15
+ let ClientCredentialsAuthorizedClientProvider = class ClientCredentialsAuthorizedClientProvider {
16
+ async provide(context) {
17
+ const { clientRegistration, authorizedClient } = context;
18
+ if (AuthorizationGrantType.ClientCredentials !== clientRegistration.authorizationGrantType) {
19
+ return;
20
+ }
21
+ if (authorizedClient && !this.hasTokenExpired(authorizedClient.accessToken)) {
22
+ // If client is already authorized but access token is NOT expired than no
23
+ // need for re-authorization
24
+ return;
25
+ }
26
+ // As per spec, in section 4.4.3 Access Token Response
27
+ // https://tools.ietf.org/html/rfc6749#section-4.4.3
28
+ // A refresh token SHOULD NOT be included.
29
+ //
30
+ // Therefore, renewing an expired access token (re-authorization)
31
+ // is the same as acquiring a new access token (authorization).
32
+ const tokenResponse = await this.getTokenResponse(clientRegistration);
33
+ return {
34
+ clientRegistration,
35
+ principalName: context.principal.name,
36
+ accessToken: tokenResponse.accessToken
37
+ };
38
+ }
39
+ hasTokenExpired(accessToken) {
40
+ return accessToken.expiresAt - Date.now() < this.clockSkew;
41
+ }
42
+ getTokenResponse(clientRegistration) {
43
+ try {
44
+ return this.accessTokenResponseClient.getTokenResponse({
45
+ authorizationGrantType: AuthorizationGrantType.ClientCredentials,
46
+ clientRegistration
47
+ });
48
+ }
49
+ catch (error) {
50
+ if (error instanceof OAuth2AuthorizationError) {
51
+ throw new ClientAuthorizationError(error.oauth2Error, clientRegistration.registrationId, error);
52
+ }
53
+ throw error;
54
+ }
55
+ }
56
+ };
57
+ __decorate([
58
+ Value('cell.oauth2.client.clockSkew'),
59
+ __metadata("design:type", Number)
60
+ ], ClientCredentialsAuthorizedClientProvider.prototype, "clockSkew", void 0);
61
+ __decorate([
62
+ Autowired(ClientCredentialsTokenResponseClient),
63
+ __metadata("design:type", ClientCredentialsTokenResponseClient)
64
+ ], ClientCredentialsAuthorizedClientProvider.prototype, "accessTokenResponseClient", void 0);
65
+ ClientCredentialsAuthorizedClientProvider = __decorate([
66
+ Component(AuthorizedClientProvider)
67
+ ], ClientCredentialsAuthorizedClientProvider);
68
+ export { ClientCredentialsAuthorizedClientProvider };
69
+ //# sourceMappingURL=client-credentials-authorized-client-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-credentials-authorized-client-provider.js","sourceRoot":"","sources":["../../../src/node/authorization/client-credentials-authorized-client-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO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B,CAAC,iBAAiB;gBAChE,kBAAkB;aACrB,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,KAAK,YAAY,wBAAwB,EAAE,CAAC;gBAC5C,MAAM,IAAI,wBAAwB,CAAC,KAAK,CAAC,WAAW,EAAE,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;YACpG,CAAC;YACD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CAEJ,CAAA;AAjDsB;IADlB,KAAK,CAAC,8BAA8B,CAAC;;4EACD;AAGlB;IADlB,SAAS,CAAC,oCAAoC,CAAC;8BACF,oCAAoC;4FAAC;AAN1E,yCAAyC;IADrD,SAAS,CAAC,wBAAwB,CAAC;GACvB,yCAAyC,CAoDrD"}
@@ -0,0 +1,4 @@
1
+ import { ContextAttributesMapper, AuthorizeRequest } from './authorization-protocol.js';
2
+ export declare class DefaultContextAttributesMapper implements ContextAttributesMapper {
3
+ apply(authorizeRequest: AuthorizeRequest): Promise<Map<string, any>>;
4
+ }
@@ -0,0 +1,25 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { ContextAttributesMapper, AuthorizationContext } from './authorization-protocol.js';
8
+ import { Component } from '@celljs/core';
9
+ import { Context, AttributeScope } from '@celljs/web/lib/node';
10
+ import { OAuth2ParameterNames } from '@celljs/oauth2-core';
11
+ let DefaultContextAttributesMapper = class DefaultContextAttributesMapper {
12
+ async apply(authorizeRequest) {
13
+ const contextAttributes = new Map();
14
+ const scopes = Context.getAttr(OAuth2ParameterNames.SCOPE, AttributeScope.Request);
15
+ if (scopes) {
16
+ contextAttributes.set(AuthorizationContext.REQUEST_SCOPE_ATTRIBUTE_NAME, scopes.split(' '));
17
+ }
18
+ return contextAttributes;
19
+ }
20
+ };
21
+ DefaultContextAttributesMapper = __decorate([
22
+ Component(ContextAttributesMapper)
23
+ ], DefaultContextAttributesMapper);
24
+ export { DefaultContextAttributesMapper };
25
+ //# sourceMappingURL=context-attributes-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-attributes-mapper.js","sourceRoot":"","sources":["../../../src/node/authorization/context-attributes-mapper.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,uBAAuB,EAAoB,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGpD,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAEvC,KAAK,CAAC,KAAK,CAAC,gBAAkC;QAC1C,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAe,CAAC;QACjD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAS,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QAC3F,IAAI,MAAM,EAAE,CAAC;YACT,iBAAiB,CAAC,GAAG,CAAC,oBAAoB,CAAC,4BAA4B,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CAEJ,CAAA;AAXY,8BAA8B;IAD1C,SAAS,CAAC,uBAAuB,CAAC;GACtB,8BAA8B,CAW1C"}
@@ -0,0 +1,13 @@
1
+ export * from './authorization-protocol.js';
2
+ export * from './authorization-request-resolver.js';
3
+ export * from './authorized-client-manager.js';
4
+ export * from './authorization-request-manager.js';
5
+ export * from './authorization-request-redirect-middleware.js';
6
+ export * from './authorization-code-grant-middleware.js';
7
+ export * from './authorization-code-authorized-client-provider.js';
8
+ export * from './client-credentials-authorized-client-provider.js';
9
+ export * from './password-authorized-client-provider.js';
10
+ export * from './refresh-token-authorized-client-provider.js';
11
+ export * from './context-attributes-mapper.js';
12
+ export * from './authorization-failure-handler.js';
13
+ export * from './authorization-success-handler.js';
@@ -0,0 +1,14 @@
1
+ export * from './authorization-protocol.js';
2
+ export * from './authorization-request-resolver.js';
3
+ export * from './authorized-client-manager.js';
4
+ export * from './authorization-request-manager.js';
5
+ export * from './authorization-request-redirect-middleware.js';
6
+ export * from './authorization-code-grant-middleware.js';
7
+ export * from './authorization-code-authorized-client-provider.js';
8
+ export * from './client-credentials-authorized-client-provider.js';
9
+ export * from './password-authorized-client-provider.js';
10
+ export * from './refresh-token-authorized-client-provider.js';
11
+ export * from './context-attributes-mapper.js';
12
+ export * from './authorization-failure-handler.js';
13
+ export * from './authorization-success-handler.js';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AACtD,cAAc,iDAAiD,CAAC;AAChE,cAAc,iDAAiD,CAAC;AAChE,cAAc,uCAAuC,CAAC;AACtD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { AuthorizedClientProvider, AuthorizationContext, AuthorizedClient } from './authorization-protocol.js';
2
+ import { AccessToken } from '@celljs/oauth2-core';
3
+ import { ClientRegistration } from '../registration/index.js';
4
+ import { PasswordTokenResponseClient } from '../endpoint/password-token-response-client.js';
5
+ export declare class PasswordAuthorizedClientProvider implements AuthorizedClientProvider {
6
+ protected readonly clockSkew: number;
7
+ protected readonly accessTokenResponseClient: PasswordTokenResponseClient;
8
+ provide(context: AuthorizationContext): Promise<AuthorizedClient | undefined>;
9
+ hasTokenExpired(accessToken: AccessToken): boolean;
10
+ protected getTokenResponse(clientRegistration: ClientRegistration, username: string, password: string): Promise<import("@celljs/oauth2-core").AccessTokenResponse>;
11
+ }
@@ -0,0 +1,82 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { AuthorizedClientProvider, AuthorizationContext } from './authorization-protocol.js';
11
+ import { AuthorizationGrantType, OAuth2AuthorizationError } from '@celljs/oauth2-core';
12
+ import { Component, Autowired, Value } from '@celljs/core';
13
+ import { ClientAuthorizationError } from '../error/index.js';
14
+ import { PasswordTokenResponseClient } from '../endpoint/password-token-response-client.js';
15
+ let PasswordAuthorizedClientProvider = class PasswordAuthorizedClientProvider {
16
+ async provide(context) {
17
+ const { clientRegistration, authorizedClient, attributes } = context;
18
+ if (AuthorizationGrantType.Password !== clientRegistration.authorizationGrantType) {
19
+ return;
20
+ }
21
+ const username = attributes.get(AuthorizationContext.USERNAME_ATTRIBUTE_NAME);
22
+ const password = attributes.get(AuthorizationContext.PASSWORD_ATTRIBUTE_NAME);
23
+ if (!username || !password) {
24
+ return;
25
+ }
26
+ if (authorizedClient && !this.hasTokenExpired(authorizedClient.accessToken)) {
27
+ // If client is already authorized but access token is NOT expired than no
28
+ // need for re-authorization
29
+ return;
30
+ }
31
+ if (authorizedClient && this.hasTokenExpired(authorizedClient.accessToken) && authorizedClient.refreshToken) {
32
+ // If client is already authorized and access token is expired and a refresh
33
+ // token is available, than return and allow
34
+ // RefreshTokenAuthorizedClientProvider to handle the refresh
35
+ return;
36
+ }
37
+ // As per spec, in section 4.4.3 Access Token Response
38
+ // https://tools.ietf.org/html/rfc6749#section-4.4.3
39
+ // A refresh token SHOULD NOT be included.
40
+ //
41
+ // Therefore, renewing an expired access token (re-authorization)
42
+ // is the same as acquiring a new access token (authorization).
43
+ const tokenResponse = await this.getTokenResponse(clientRegistration, username, password);
44
+ return {
45
+ clientRegistration,
46
+ principalName: context.principal.name,
47
+ accessToken: tokenResponse.accessToken
48
+ };
49
+ }
50
+ hasTokenExpired(accessToken) {
51
+ return accessToken.expiresAt - Date.now() < this.clockSkew;
52
+ }
53
+ getTokenResponse(clientRegistration, username, password) {
54
+ try {
55
+ return this.accessTokenResponseClient.getTokenResponse({
56
+ authorizationGrantType: AuthorizationGrantType.Password,
57
+ clientRegistration,
58
+ username,
59
+ password
60
+ });
61
+ }
62
+ catch (error) {
63
+ if (error instanceof OAuth2AuthorizationError) {
64
+ throw new ClientAuthorizationError(error.oauth2Error, clientRegistration.registrationId, error);
65
+ }
66
+ throw error;
67
+ }
68
+ }
69
+ };
70
+ __decorate([
71
+ Value('cell.oauth2.client.clockSkew'),
72
+ __metadata("design:type", Number)
73
+ ], PasswordAuthorizedClientProvider.prototype, "clockSkew", void 0);
74
+ __decorate([
75
+ Autowired(PasswordTokenResponseClient),
76
+ __metadata("design:type", PasswordTokenResponseClient)
77
+ ], PasswordAuthorizedClientProvider.prototype, "accessTokenResponseClient", void 0);
78
+ PasswordAuthorizedClientProvider = __decorate([
79
+ Component(AuthorizedClientProvider)
80
+ ], PasswordAuthorizedClientProvider);
81
+ export { PasswordAuthorizedClientProvider };
82
+ //# sourceMappingURL=password-authorized-client-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-authorized-client-provider.js","sourceRoot":"","sources":["../../../src/node/authorization/password-authorized-client-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAoB,MAAM,0BAA0B,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAe,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAGlF,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAQzC,KAAK,CAAC,OAAO,CAAC,OAA6B;QACvC,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QACrE,IAAI,sBAAsB,CAAC,QAAQ,KAAK,kBAAkB,CAAC,sBAAsB,EAAE,CAAC;YAChF,OAAQ;QACZ,CAAC;QAED,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;QAC9E,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;QAE9E,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;YACzB,OAAO;QACX,CAAC;QAED,IAAI,gBAAgB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;YAC1E,0EAA0E;YAC1E,4BAA4B;YAC5B,OAAO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2B;mFAAC;AANjE,gCAAgC;IAD5C,SAAS,CAAC,wBAAwB,CAAC;GACvB,gCAAgC,CAqE5C"}
@@ -0,0 +1,11 @@
1
+ import { AuthorizedClientProvider, AuthorizationContext, AuthorizedClient } from './authorization-protocol.js';
2
+ import { AccessToken } from '@celljs/oauth2-core';
3
+ import { RefreshTokenTokenResponseClient } from '../endpoint/index.js';
4
+ import { ClientRegistration } from '../registration/index.js';
5
+ export declare class RefreshTokenAuthorizedClientProvider implements AuthorizedClientProvider {
6
+ protected readonly clockSkew: number;
7
+ protected readonly accessTokenResponseClient: RefreshTokenTokenResponseClient;
8
+ provide(context: AuthorizationContext): Promise<AuthorizedClient | undefined>;
9
+ hasTokenExpired(accessToken: AccessToken): boolean;
10
+ protected getTokenResponse(clientRegistration: ClientRegistration, authorizedClient: AuthorizedClient, scopes?: string[]): Promise<import("@celljs/oauth2-core").AccessTokenResponse>;
11
+ }
@@ -0,0 +1,65 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { AuthorizedClientProvider, AuthorizationContext } from './authorization-protocol.js';
11
+ import { AuthorizationGrantType, OAuth2AuthorizationError } from '@celljs/oauth2-core';
12
+ import { Component, Autowired, Value } from '@celljs/core';
13
+ import { RefreshTokenTokenResponseClient } from '../endpoint/index.js';
14
+ import { ClientAuthorizationError } from '../error/index.js';
15
+ import { ok } from 'assert';
16
+ let RefreshTokenAuthorizedClientProvider = class RefreshTokenAuthorizedClientProvider {
17
+ async provide(context) {
18
+ const { clientRegistration, authorizedClient, attributes } = context;
19
+ if (!authorizedClient || !authorizedClient.refreshToken || !this.hasTokenExpired(authorizedClient.accessToken)) {
20
+ return;
21
+ }
22
+ const scopes = attributes.get(AuthorizationContext.REQUEST_SCOPE_ATTRIBUTE_NAME);
23
+ ok(scopes || Array.isArray(scopes), `The context attribute must be of type Array '${AuthorizationContext.REQUEST_SCOPE_ATTRIBUTE_NAME}'`);
24
+ const tokenResponse = await this.getTokenResponse(clientRegistration, authorizedClient, scopes);
25
+ return {
26
+ clientRegistration,
27
+ principalName: context.principal.name,
28
+ accessToken: tokenResponse.accessToken,
29
+ refreshToken: tokenResponse.refreshToken
30
+ };
31
+ }
32
+ hasTokenExpired(accessToken) {
33
+ return accessToken.expiresAt - Date.now() < this.clockSkew;
34
+ }
35
+ getTokenResponse(clientRegistration, authorizedClient, scopes) {
36
+ try {
37
+ return this.accessTokenResponseClient.getTokenResponse({
38
+ authorizationGrantType: AuthorizationGrantType.RefreshToken,
39
+ clientRegistration,
40
+ accessToken: authorizedClient.accessToken,
41
+ refreshToken: authorizedClient.refreshToken,
42
+ scopes
43
+ });
44
+ }
45
+ catch (error) {
46
+ if (error instanceof OAuth2AuthorizationError) {
47
+ throw new ClientAuthorizationError(error.oauth2Error, clientRegistration.registrationId, error);
48
+ }
49
+ throw error;
50
+ }
51
+ }
52
+ };
53
+ __decorate([
54
+ Value('cell.oauth2.client.clockSkew'),
55
+ __metadata("design:type", Number)
56
+ ], RefreshTokenAuthorizedClientProvider.prototype, "clockSkew", void 0);
57
+ __decorate([
58
+ Autowired(RefreshTokenTokenResponseClient),
59
+ __metadata("design:type", RefreshTokenTokenResponseClient)
60
+ ], RefreshTokenAuthorizedClientProvider.prototype, "accessTokenResponseClient", void 0);
61
+ RefreshTokenAuthorizedClientProvider = __decorate([
62
+ Component(AuthorizedClientProvider)
63
+ ], RefreshTokenAuthorizedClientProvider);
64
+ export { RefreshTokenAuthorizedClientProvider };
65
+ //# sourceMappingURL=refresh-token-authorized-client-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-token-authorized-client-provider.js","sourceRoot":"","sources":["../../../src/node/authorization/refresh-token-authorized-client-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAoB,MAAM,0BAA0B,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAe,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAGrB,IAAM,oCAAoC,GAA1C,MAAM,oCAAoC;IAQ7C,KAAK,CAAC,OAAO,CAAC,OAA6B;QACvC,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QACrE,IAAI,CAAC,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7G,OAAO;QACX,CAAC;QAED,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,oBAAoB,CAAC,4BAA4B,CAAC,CAAC;QAEjF,EAAE,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,gDAAgD,oBAAoB,CAAC,4BAA4B,GAAG,CAAC,CAAC;QAE1I,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAChG,OAAO;YACH,kBAAkB;YAClB,aAAa,EAAE,OAAO,CAAC,SAAS,CAAC,IAAI;YACrC,WAAW,EAAE,aAAa,CAAC,WAAW;YACtC,YAAY,EAAE,aAAa,CAAC,YAAY;SAC3C,CAAC;IACN,CAAC;IAED,eAAe,CAAC,WAAwB;QACpC,OAAO,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IAC/D,CAAC;IAES,gBAAgB,CAAC,kBAAsC,EAAE,gBAAkC,EAAE,MAAiB;QACpH,IAAI,CAAC;YACD,OAAO,IAAI,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;gBACnD,sBAAsB,EAAE,sBAAsB,CAAC,YAAY;gBAC3D,kBAAkB;gBAClB,WAAW,EAAE,gBAAgB,CAAC,WAAW;gBACzC,YAAY,EAAE,gBAAgB,CAAC,YAAa;gBAC5C,MAAM;aACT,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,KAAK,YAAY,wBAAwB,EAAE,CAAC;gBAC5C,MAAM,IAAI,wBAAwB,CAAC,KAAK,CAAC,WAAW,EAAE,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;YACpG,CAAC;YACD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CAEJ,CAAA;AA7CsB;IADlB,KAAK,CAAC,8BAA8B,CAAC;;uEACD;AAGlB;IADlB,SAAS,CAAC,+BAA+B,CAAC;8BACG,+BAA+B;uFAAC;AANrE,oCAAoC;IADhD,SAAS,CAAC,wBAAwB,CAAC;GACvB,oCAAoC,CAgDhD"}
@@ -0,0 +1,4 @@
1
+ export declare const AUTHORIZATION_REQUEST_BASE_URI = "cell.oauth2.client.authorizationRequestBaseUri";
2
+ export declare const DEFAULT_REDIRECT_URI = "cell.oauth2.client.defaultRedirectUri";
3
+ export declare const AUTHORIZATION_CODE_GRANT_URI = "cell.oauth2.client.authorizationCodeGrantUri";
4
+ export declare const REDIRECT_LOGIN_PATH = "cell.oauth2.client.redirectLoginPath";
@@ -0,0 +1,5 @@
1
+ export const AUTHORIZATION_REQUEST_BASE_URI = 'cell.oauth2.client.authorizationRequestBaseUri';
2
+ export const DEFAULT_REDIRECT_URI = 'cell.oauth2.client.defaultRedirectUri';
3
+ export const AUTHORIZATION_CODE_GRANT_URI = 'cell.oauth2.client.authorizationCodeGrantUri';
4
+ export const REDIRECT_LOGIN_PATH = 'cell.oauth2.client.redirectLoginPath';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/node/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG,gDAAgD,CAAC;AAC/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,uCAAuC,CAAC;AAC5E,MAAM,CAAC,MAAM,4BAA4B,GAAG,8CAA8C,CAAC;AAC3F,MAAM,CAAC,MAAM,mBAAmB,GAAG,sCAAsC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { AccessTokenResponseClient, AuthorizationCodeGrantRequest } from './endpoint-protocol.js';
2
+ import { RestOperations } from '@celljs/http';
3
+ import { ProviderDetailsManager } from '../provider/index.js';
4
+ import { AccessTokenResponse, AccessTokenResponseConverter } from '@celljs/oauth2-core';
5
+ export declare class AuthorizationCodeTokenResponseClient implements AccessTokenResponseClient<AuthorizationCodeGrantRequest> {
6
+ protected readonly restOperations: RestOperations;
7
+ protected readonly providerDetailsManager: ProviderDetailsManager;
8
+ protected readonly accessTokenResponseConverter: AccessTokenResponseConverter;
9
+ getTokenResponse(authorizationCodeGrantRequest: AuthorizationCodeGrantRequest): Promise<AccessTokenResponse>;
10
+ protected buildFormParameters(authorizationCodeGrantRequest: AuthorizationCodeGrantRequest): string;
11
+ }
@@ -0,0 +1,80 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { INVALID_TOKEN_RESPONSE_ERROR_CODE } from './endpoint-protocol.js';
11
+ import { Component, Autowired } from '@celljs/core';
12
+ import { RestOperations } from '@celljs/http';
13
+ import { ProviderDetailsManager } from '../provider/index.js';
14
+ import { OAuth2ParameterNames, PkceParameterNames, ClientAuthenticationMethod, OAuth2AuthorizationError, AccessTokenResponseConverter } from '@celljs/oauth2-core';
15
+ import { AuthorizationGrantRequestEntityUtil } from '../utils/index.js';
16
+ import * as qs from 'qs';
17
+ let AuthorizationCodeTokenResponseClient = class AuthorizationCodeTokenResponseClient {
18
+ async getTokenResponse(authorizationCodeGrantRequest) {
19
+ const { clientRegistration } = authorizationCodeGrantRequest;
20
+ const providerDetails = await this.providerDetailsManager.get(clientRegistration.provider);
21
+ let response;
22
+ try {
23
+ response = await this.restOperations.post(providerDetails.tokenUri, this.buildFormParameters(authorizationCodeGrantRequest), {
24
+ headers: AuthorizationGrantRequestEntityUtil.getTokenRequestHeaders(clientRegistration)
25
+ });
26
+ }
27
+ catch (error) {
28
+ const oauth2Error = {
29
+ errorCode: INVALID_TOKEN_RESPONSE_ERROR_CODE,
30
+ description: `An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: ${(error === null || error === void 0 ? void 0 : error.message) || error}`
31
+ };
32
+ throw new OAuth2AuthorizationError(oauth2Error, error);
33
+ }
34
+ const { data } = response;
35
+ const acccessTokenResponse = this.accessTokenResponseConverter.convert(data);
36
+ if (!acccessTokenResponse.accessToken.scopes || acccessTokenResponse.accessToken.scopes.length === 0) {
37
+ // As per spec, in Section 5.1 Successful Access Token Response
38
+ // https://tools.ietf.org/html/rfc6749#section-5.1
39
+ // If AccessTokenResponse.scope is empty, then default to the scope
40
+ // originally requested by the client in the Token Request
41
+ acccessTokenResponse.accessToken.scopes = clientRegistration.scopes;
42
+ }
43
+ return acccessTokenResponse;
44
+ }
45
+ buildFormParameters(authorizationCodeGrantRequest) {
46
+ const { authorizationExchange, clientRegistration, authorizationGrantType } = authorizationCodeGrantRequest;
47
+ const { authorizationRequest, authorizationResponse } = authorizationExchange;
48
+ const formParameters = {
49
+ [OAuth2ParameterNames.GRANT_TYPE]: authorizationGrantType,
50
+ [OAuth2ParameterNames.CODE]: authorizationResponse.code,
51
+ [OAuth2ParameterNames.REDIRECT_URI]: authorizationRequest.redirectUri,
52
+ [PkceParameterNames.CODE_VERIFIER]: authorizationRequest.attributes[PkceParameterNames.CODE_VERIFIER]
53
+ };
54
+ const { clientAuthenticationMethod, clientId, clientSecret } = clientRegistration;
55
+ if (ClientAuthenticationMethod.Basic !== clientAuthenticationMethod) {
56
+ formParameters[OAuth2ParameterNames.CLIENT_ID] = clientId;
57
+ }
58
+ if (ClientAuthenticationMethod.Post === clientAuthenticationMethod) {
59
+ formParameters[OAuth2ParameterNames.CLIENT_SECRET] = clientSecret;
60
+ }
61
+ return qs.stringify(formParameters);
62
+ }
63
+ };
64
+ __decorate([
65
+ Autowired(RestOperations),
66
+ __metadata("design:type", Function)
67
+ ], AuthorizationCodeTokenResponseClient.prototype, "restOperations", void 0);
68
+ __decorate([
69
+ Autowired(ProviderDetailsManager),
70
+ __metadata("design:type", Object)
71
+ ], AuthorizationCodeTokenResponseClient.prototype, "providerDetailsManager", void 0);
72
+ __decorate([
73
+ Autowired(AccessTokenResponseConverter),
74
+ __metadata("design:type", AccessTokenResponseConverter)
75
+ ], AuthorizationCodeTokenResponseClient.prototype, "accessTokenResponseConverter", void 0);
76
+ AuthorizationCodeTokenResponseClient = __decorate([
77
+ Component()
78
+ ], AuthorizationCodeTokenResponseClient);
79
+ export { AuthorizationCodeTokenResponseClient };
80
+ //# sourceMappingURL=authorization-code-token-response-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-code-token-response-client.js","sourceRoot":"","sources":["../../../src/node/endpoint/authorization-code-token-response-client.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAA4D,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAClI,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAuB,oBAAoB,EAAE,kBAAkB,EAAE,0BAA0B,EAAe,wBAAwB,EACrI,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,mCAAmC,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGlB,IAAM,oCAAoC,GAA1C,MAAM,oCAAoC;IAW7C,KAAK,CAAC,gBAAgB,CAAC,6BAA4D;QAC/E,MAAM,EAAE,kBAAkB,EAAE,GAAG,6BAA6B,CAAC;QAC7D,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAE3F,IAAI,QAAQ,CAAC;QACb,IAAI,CAAC;YACD,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,eAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,6BAA6B,CAAC,EAAE;gBACrJ,OAAO,EAAE,mCAAmC,CAAC,sBAAsB,CAAC,kBAAkB,CAAC;aAC1F,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,KAAK,EAAE,CAA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GAAG,kBAAkB,CAAC;QAClF,IAAI,0BAA0B,CAAC,KAAK,KAAK,0BAA0B,EAAE,CAAC;YAClE,cAAc,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;QAC9D,CAAC;QACD,IAAI,0BAA0B,CAAC,IAAI,KAAK,0BAA0B,EAAE,CAAC;YACjE,cAAc,CAAC,oBAAoB,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;QACtE,CAAC;QACD,OAAO,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;CAEJ,CAAA;AA3DsB;IADlB,SAAS,CAAC,cAAc,CAAC;;4EACwB;AAG/B;IADlB,SAAS,CAAC,sBAAsB,CAAC;;oFACgC;AAG/C;IADlB,SAAS,CAAC,4BAA4B,CAAC;8BACS,4BAA4B;0FAAC;AATrE,oCAAoC;IADhD,SAAS,EAAE;GACC,oCAAoC,CA8DhD"}
@@ -0,0 +1,11 @@
1
+ import { AccessTokenResponseClient, ClientCredentialsGrantRequest } from './endpoint-protocol.js';
2
+ import { RestOperations } from '@celljs/http';
3
+ import { ProviderDetailsManager } from '../provider/index.js';
4
+ import { AccessTokenResponse, AccessTokenResponseConverter } from '@celljs/oauth2-core';
5
+ export declare class ClientCredentialsTokenResponseClient implements AccessTokenResponseClient<ClientCredentialsGrantRequest> {
6
+ protected readonly restOperations: RestOperations;
7
+ protected readonly providerDetailsManager: ProviderDetailsManager;
8
+ protected readonly accessTokenResponseConverter: AccessTokenResponseConverter;
9
+ getTokenResponse(clientCredentialsGrantRequest: ClientCredentialsGrantRequest): Promise<AccessTokenResponse>;
10
+ protected buildFormParameters(clientCredentialsGrantRequest: ClientCredentialsGrantRequest): string;
11
+ }