@feathersjs/authentication-client 5.0.0-pre.1 → 5.0.0-pre.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,164 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
12
+
13
+
14
+
15
+
16
+
17
+ # [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13)
18
+
19
+ **Note:** Version bump only for package @feathersjs/authentication-client
20
+
21
+
22
+
23
+
24
+
25
+ # [5.0.0-pre.13](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.12...v5.0.0-pre.13) (2021-10-13)
26
+
27
+ **Note:** Version bump only for package @feathersjs/authentication-client
28
+
29
+
30
+
31
+
32
+
33
+ # [5.0.0-pre.12](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.11...v5.0.0-pre.12) (2021-10-12)
34
+
35
+ **Note:** Version bump only for package @feathersjs/authentication-client
36
+
37
+
38
+
39
+
40
+
41
+ # [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06)
42
+
43
+ **Note:** Version bump only for package @feathersjs/authentication-client
44
+
45
+
46
+
47
+
48
+
49
+ # [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19)
50
+
51
+ **Note:** Version bump only for package @feathersjs/authentication-client
52
+
53
+
54
+
55
+
56
+
57
+ # [5.0.0-pre.9](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.8...v5.0.0-pre.9) (2021-08-09)
58
+
59
+ **Note:** Version bump only for package @feathersjs/authentication-client
60
+
61
+
62
+
63
+
64
+
65
+ # [5.0.0-pre.8](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.7...v5.0.0-pre.8) (2021-08-09)
66
+
67
+ **Note:** Version bump only for package @feathersjs/authentication-client
68
+
69
+
70
+
71
+
72
+
73
+ # [5.0.0-pre.7](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.6...v5.0.0-pre.7) (2021-08-09)
74
+
75
+ **Note:** Version bump only for package @feathersjs/authentication-client
76
+
77
+
78
+
79
+
80
+
81
+ # [5.0.0-pre.6](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.5...v5.0.0-pre.6) (2021-08-08)
82
+
83
+ **Note:** Version bump only for package @feathersjs/authentication-client
84
+
85
+
86
+
87
+
88
+
89
+ # [5.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.4...v5.0.0-pre.5) (2021-06-23)
90
+
91
+
92
+ ### Bug Fixes
93
+
94
+ * **hooks:** Migrate built-in hooks and allow backwards compatibility ([#2358](https://github.com/feathersjs/feathers/issues/2358)) ([759c5a1](https://github.com/feathersjs/feathers/commit/759c5a19327a731af965c3604119393b3d09a406))
95
+ * **koa:** Use extended query parser for compatibility ([#2397](https://github.com/feathersjs/feathers/issues/2397)) ([b2944ba](https://github.com/feathersjs/feathers/commit/b2944bac3ec6d5ecc80dc518cd4e58093692db74))
96
+
97
+
98
+ ### Features
99
+
100
+ * **adapter-commons:** Add support for params.adapter option and move memory adapter to @feathersjs/memory ([#2367](https://github.com/feathersjs/feathers/issues/2367)) ([a43e7da](https://github.com/feathersjs/feathers/commit/a43e7da22b6b981a96d1321736ea9a0cb924fb4f))
101
+
102
+
103
+
104
+
105
+
106
+ # [5.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.3...v5.0.0-pre.4) (2021-05-13)
107
+
108
+ **Note:** Version bump only for package @feathersjs/authentication-client
109
+
110
+
111
+
112
+
113
+
114
+ # [5.0.0-pre.3](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.2...v5.0.0-pre.3) (2021-04-21)
115
+
116
+
117
+ ### Bug Fixes
118
+
119
+ * **typescript:** Improve TypeScript backwards compatibility ([#2310](https://github.com/feathersjs/feathers/issues/2310)) ([f33be73](https://github.com/feathersjs/feathers/commit/f33be73fc46a533efb15df9aab0658e3240d3897))
120
+
121
+
122
+ ### Features
123
+
124
+ * **dependencies:** Remove direct debug dependency ([#2296](https://github.com/feathersjs/feathers/issues/2296)) ([501d416](https://github.com/feathersjs/feathers/commit/501d4164d30c6a126906dc640cdfdc82207ba34a))
125
+
126
+
127
+
128
+
129
+
130
+ # [5.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.1...v5.0.0-pre.2) (2021-04-06)
131
+
132
+ **Note:** Version bump only for package @feathersjs/authentication-client
133
+
134
+
135
+
136
+
137
+
138
+ # [5.0.0-beta.1](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.0...v5.0.0-beta.1) (2021-04-03)
139
+
140
+ **Note:** Version bump only for package @feathersjs/authentication-client
141
+
142
+
143
+
144
+
145
+
146
+ # [5.0.0-beta.0](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.1...v5.0.0-beta.0) (2021-03-28)
147
+
148
+
149
+ ### Bug Fixes
150
+
151
+ * Update Grant usage and other dependencies ([#2264](https://github.com/feathersjs/feathers/issues/2264)) ([7b0f8fa](https://github.com/feathersjs/feathers/commit/7b0f8fad252419ed0ad0bf259cdf3104d322ab60))
152
+
153
+
154
+ ### Features
155
+
156
+ * Application service types default to any ([#1566](https://github.com/feathersjs/feathers/issues/1566)) ([d93ba9a](https://github.com/feathersjs/feathers/commit/d93ba9a17edd20d3397bb00f4f6e82e804e42ed6))
157
+ * Feathers v5 core refactoring and features ([#2255](https://github.com/feathersjs/feathers/issues/2255)) ([2dafb7c](https://github.com/feathersjs/feathers/commit/2dafb7ce14ba57406aeec13d10ca45b1e709bee9))
158
+ * **authentication-client:** Throw separate OauthError in authentication client ([#2189](https://github.com/feathersjs/feathers/issues/2189)) ([fa45ec5](https://github.com/feathersjs/feathers/commit/fa45ec520b21834e103e6fe4200b06dced56c0e6))
159
+
160
+
161
+
162
+
163
+
6
164
  # [5.0.0-pre.1](https://github.com/feathersjs/feathers/compare/v4.5.11...v5.0.0-pre.1) (2020-12-17)
7
165
 
8
166
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Feathers
3
+ Copyright (c) 2021 Feathers
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -18,6 +18,6 @@ Refer to the [Feathers authentication client API documentation](https://docs.fea
18
18
 
19
19
  ## License
20
20
 
21
- Copyright (c) 2019
21
+ Copyright (c) 2021 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
22
22
 
23
23
  Licensed under the [MIT license](LICENSE).
package/lib/core.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare class AuthenticationClient {
19
19
  authenticated: boolean;
20
20
  options: AuthenticationClientOptions;
21
21
  constructor(app: Application, options: AuthenticationClientOptions);
22
- get service(): any;
22
+ get service(): import("@feathersjs/feathers").FeathersService<Application<any, any>, import("@feathersjs/feathers").Service<any, Partial<any>>>;
23
23
  get storage(): Storage;
24
24
  handleSocket(socket: any): void;
25
25
  getFromLocation(location: Location): Promise<any>;
package/lib/core.js CHANGED
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthenticationClient = void 0;
4
4
  const errors_1 = require("@feathersjs/errors");
5
5
  const storage_1 = require("./storage");
6
+ class OauthError extends errors_1.FeathersError {
7
+ constructor(message, data) {
8
+ super(message, 'OauthError', 401, 'oauth-error', data);
9
+ }
10
+ }
6
11
  const getMatch = (location, key) => {
7
12
  const regex = new RegExp(`(?:\&?)${key}=([^&]*)`);
8
13
  const match = location.hash ? location.hash.match(regex) : null;
@@ -14,7 +19,7 @@ const getMatch = (location, key) => {
14
19
  };
15
20
  class AuthenticationClient {
16
21
  constructor(app, options) {
17
- const socket = app.io || app.primus;
22
+ const socket = app.io;
18
23
  const storage = new storage_1.StorageWrapper(app.get('storage') || options.storage);
19
24
  this.app = app;
20
25
  this.options = options;
@@ -52,7 +57,7 @@ class AuthenticationClient {
52
57
  const [message, errorRegex] = getMatch(location, this.options.locationErrorKey);
53
58
  if (message !== null) {
54
59
  location.hash = location.hash.replace(errorRegex, '');
55
- return Promise.reject(new errors_1.NotAuthenticated(decodeURIComponent(message)));
60
+ return Promise.reject(new OauthError(decodeURIComponent(message)));
56
61
  }
57
62
  return Promise.resolve(null);
58
63
  }
package/lib/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;AAAA,+CAAqE;AAGrE,uCAAoD;AAEpD,MAAM,QAAQ,GAAG,CAAC,QAAkB,EAAE,GAAW,EAAsB,EAAE;IACvE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEhE,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,MAAM,CAAE,AAAD,EAAG,KAAK,CAAE,GAAG,KAAK,CAAC;QAE1B,OAAO,CAAE,KAAK,EAAE,KAAK,CAAE,CAAC;KACzB;IAED,OAAO,CAAE,IAAI,EAAE,KAAK,CAAE,CAAC;AACzB,CAAC,CAAC;AAiBF,MAAa,oBAAoB;IAK/B,YAAa,GAAgB,EAAE,OAAoC;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C,KAAK,CAAC,CAAC,KAAoB,EAAE,EAAE,CAChC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CACxC,CAAC;QAEJ,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAExC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM;QACJ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;aACnD,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;aACpC,IAAI,CAAC,CAAC,UAAgC,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE;aACjE,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;aACxB,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAEpC,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC,CACH,CAAC;aACD,KAAK,CAAC,CAAC,KAAoB,EAAE,EAAE,CAC9B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAClC,CAAC;IACN,CAAC;CACF;AAhKD,oDAgKC"}
@@ -1,2 +1,2 @@
1
- import { HookContext } from '@feathersjs/feathers';
2
- export declare const authentication: () => (context: HookContext) => HookContext<any, import("@feathersjs/feathers/lib").Service<any>> | Promise<HookContext<any, import("@feathersjs/feathers/lib").Service<any>>>;
1
+ import { HookContext, NextFunction } from '@feathersjs/feathers';
2
+ export declare const authentication: () => (context: HookContext, next: NextFunction) => Promise<any>;
@@ -3,17 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.authentication = void 0;
4
4
  const commons_1 = require("@feathersjs/commons");
5
5
  const authentication = () => {
6
- return (context) => {
6
+ return (context, next) => {
7
7
  const { app, params, path, method, app: { authentication: service } } = context;
8
- if (commons_1.stripSlashes(service.options.path) === path && method === 'create') {
9
- return context;
8
+ if ((0, commons_1.stripSlashes)(service.options.path) === path && method === 'create') {
9
+ return next();
10
10
  }
11
11
  return Promise.resolve(app.get('authentication')).then(authResult => {
12
12
  if (authResult) {
13
13
  context.params = Object.assign({}, authResult, params);
14
14
  }
15
- return context;
16
- });
15
+ }).then(next);
17
16
  };
18
17
  };
19
18
  exports.authentication = authentication;
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/hooks/authentication.ts"],"names":[],"mappings":";;;AACA,iDAAmD;AAE5C,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CAAC,OAAoB,EAAE,EAAE;QAC9B,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,CAAC;QAEhF,IAAI,sBAAY,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,KAAK,QAAQ,EAAE;YACtE,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAClE,IAAI,UAAU,EAAE;gBACd,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;aACxD;YAED,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,cAAc,kBAgBzB"}
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/hooks/authentication.ts"],"names":[],"mappings":";;;AACA,iDAAmD;AAE5C,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CAAC,OAAoB,EAAE,IAAkB,EAAE,EAAE;QAClD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,CAAC;QAEhF,IAAI,IAAA,sBAAY,EAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,KAAK,QAAQ,EAAE;YACtE,OAAO,IAAI,EAAE,CAAC;SACf;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAClE,IAAI,UAAU,EAAE;gBACd,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;aACxD;QACH,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,cAAc,kBAczB"}
@@ -1,2 +1,2 @@
1
- import { HookContext } from '@feathersjs/feathers';
2
- export declare const populateHeader: () => (context: HookContext) => HookContext<any, import("@feathersjs/feathers/lib").Service<any>>;
1
+ import { HookContext, NextFunction } from '@feathersjs/feathers';
2
+ export declare const populateHeader: () => (context: HookContext, next: NextFunction) => Promise<any>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.populateHeader = void 0;
4
4
  const populateHeader = () => {
5
- return (context) => {
5
+ return (context, next) => {
6
6
  const { app, params: { accessToken } } = context;
7
7
  const authentication = app.authentication;
8
8
  // Set REST header if necessary
@@ -13,7 +13,7 @@ const populateHeader = () => {
13
13
  [header]: authHeader
14
14
  }, context.params.headers);
15
15
  }
16
- return context;
16
+ return next();
17
17
  };
18
18
  };
19
19
  exports.populateHeader = populateHeader;
@@ -1 +1 @@
1
- {"version":3,"file":"populate-header.js","sourceRoot":"","sources":["../../src/hooks/populate-header.ts"],"names":[],"mappings":";;;AAEO,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CAAC,OAAoB,EAAE,EAAE;QAC9B,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC;QACjD,MAAM,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC;QAE1C,+BAA+B;QAC/B,IAAI,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE;YAC3B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC;YAClD,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,WAAW,EAAE,CAAC;YAE9C,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE;gBACzC,CAAC,MAAM,CAAC,EAAE,UAAU;aACrB,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SAC5B;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,cAAc,kBAiBzB"}
1
+ {"version":3,"file":"populate-header.js","sourceRoot":"","sources":["../../src/hooks/populate-header.ts"],"names":[],"mappings":";;;AAEO,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CAAC,OAAoB,EAAE,IAAkB,EAAE,EAAE;QAClD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC;QACjD,MAAM,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC;QAE1C,+BAA+B;QAC/B,IAAI,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE;YAC3B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC;YAClD,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,WAAW,EAAE,CAAC;YAE9C,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE;gBACzC,CAAC,MAAM,CAAC,EAAE,UAAU;aACrB,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SAC5B;QAED,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,cAAc,kBAiBzB"}
package/lib/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import * as hooks from './hooks';
3
3
  import { Application } from '@feathersjs/feathers';
4
4
  import { Storage, MemoryStorage, StorageWrapper } from './storage';
5
5
  declare module '@feathersjs/feathers/lib/declarations' {
6
- interface Application<ServiceTypes = {}> {
6
+ interface Application<Services, Settings> {
7
7
  io?: any;
8
8
  rest?: any;
9
9
  authentication: AuthenticationClient;
package/lib/index.js CHANGED
@@ -34,7 +34,7 @@ const getDefaultStorage = () => {
34
34
  return new storage_1.MemoryStorage();
35
35
  };
36
36
  exports.getDefaultStorage = getDefaultStorage;
37
- exports.defaultStorage = exports.getDefaultStorage();
37
+ exports.defaultStorage = (0, exports.getDefaultStorage)();
38
38
  exports.defaults = {
39
39
  header: 'Authorization',
40
40
  scheme: 'Bearer',
@@ -55,14 +55,10 @@ const init = (_options = {}) => {
55
55
  app.authenticate = authentication.authenticate.bind(authentication);
56
56
  app.reAuthenticate = authentication.reAuthenticate.bind(authentication);
57
57
  app.logout = authentication.logout.bind(authentication);
58
- app.hooks({
59
- before: {
60
- all: [
61
- hooks.authentication(),
62
- hooks.populateHeader()
63
- ]
64
- }
65
- });
58
+ app.hooks([
59
+ hooks.authentication(),
60
+ hooks.populateHeader()
61
+ ]);
66
62
  };
67
63
  };
68
64
  exports.default = init;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA2E;AAwBlE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MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,gBAAQ,EAAE,QAAQ,CAAC,CAAC;IACnF,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAEnC,OAAO,CAAC,GAAgB,EAAE,EAAE;QAC1B,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAExD,GAAG,CAAC,cAAc,GAAG,cAAc,CAAC;QACpC,GAAG,CAAC,YAAY,GAAG,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpE,GAAG,CAAC,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACxE,GAAG,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAExD,GAAG,CAAC,KAAK,CAAC;YACR,KAAK,CAAC,cAAc,EAAE;YACtB,KAAK,CAAC,cAAc,EAAE;SACvB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,IAAI,CAAC;AAEpB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;CACtD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@feathersjs/authentication-client",
3
3
  "description": "The authentication plugin for feathers-client",
4
- "version": "5.0.0-pre.1",
4
+ "version": "5.0.0-pre.15",
5
5
  "homepage": "https://feathersjs.com",
6
6
  "main": "lib/",
7
7
  "types": "lib/",
@@ -28,7 +28,7 @@
28
28
  "url": "https://github.com/feathersjs/feathers/issues"
29
29
  },
30
30
  "engines": {
31
- "node": ">= 10"
31
+ "node": ">= 12"
32
32
  },
33
33
  "files": [
34
34
  "CHANGELOG.md",
@@ -52,27 +52,25 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@feathersjs/authentication": "^5.0.0-pre.1",
56
- "@feathersjs/commons": "^5.0.0-pre.1",
57
- "@feathersjs/errors": "^5.0.0-pre.1",
58
- "@feathersjs/feathers": "^5.0.0-pre.1",
59
- "debug": "^4.3.1"
55
+ "@feathersjs/authentication": "^5.0.0-pre.15",
56
+ "@feathersjs/commons": "^5.0.0-pre.15",
57
+ "@feathersjs/errors": "^5.0.0-pre.15",
58
+ "@feathersjs/feathers": "^5.0.0-pre.15"
60
59
  },
61
60
  "devDependencies": {
62
- "@feathersjs/adapter-memory": "^5.0.0-pre.1",
63
- "@feathersjs/authentication-local": "^5.0.0-pre.1",
64
- "@feathersjs/express": "^5.0.0-pre.1",
65
- "@feathersjs/rest-client": "^5.0.0-pre.1",
66
- "@feathersjs/socketio": "^5.0.0-pre.1",
67
- "@feathersjs/socketio-client": "^5.0.0-pre.1",
68
- "@types/debug": "^4.1.5",
69
- "@types/mocha": "^8.0.4",
70
- "@types/node": "^14.14.10",
71
- "axios": "^0.21.0",
72
- "mocha": "^8.2.1",
61
+ "@feathersjs/authentication-local": "^5.0.0-pre.15",
62
+ "@feathersjs/express": "^5.0.0-pre.15",
63
+ "@feathersjs/memory": "^5.0.0-pre.15",
64
+ "@feathersjs/rest-client": "^5.0.0-pre.15",
65
+ "@feathersjs/socketio": "^5.0.0-pre.15",
66
+ "@feathersjs/socketio-client": "^5.0.0-pre.15",
67
+ "@types/mocha": "^9.0.0",
68
+ "@types/node": "^16.11.6",
69
+ "axios": "^0.24.0",
70
+ "mocha": "^9.1.3",
73
71
  "shx": "^0.3.3",
74
- "ts-node": "^9.1.0",
75
- "typescript": "^4.1.2"
72
+ "ts-node": "^10.4.0",
73
+ "typescript": "^4.4.4"
76
74
  },
77
- "gitHead": "3756506935c520fc50d4be416ff649c2158afdac"
75
+ "gitHead": "8008bf4f8529a2a40b6a2f976c1f43ae13675693"
78
76
  }
package/src/core.ts CHANGED
@@ -3,6 +3,12 @@ import { Application, Params } from '@feathersjs/feathers';
3
3
  import { AuthenticationRequest, AuthenticationResult } from '@feathersjs/authentication';
4
4
  import { Storage, StorageWrapper } from './storage';
5
5
 
6
+ class OauthError extends FeathersError {
7
+ constructor (message: string, data?: any) {
8
+ super(message, 'OauthError', 401, 'oauth-error', data);
9
+ }
10
+ }
11
+
6
12
  const getMatch = (location: Location, key: string): [ string, RegExp ] => {
7
13
  const regex = new RegExp(`(?:\&?)${key}=([^&]*)`);
8
14
  const match = location.hash ? location.hash.match(regex) : null;
@@ -37,7 +43,7 @@ export class AuthenticationClient {
37
43
  options: AuthenticationClientOptions;
38
44
 
39
45
  constructor (app: Application, options: AuthenticationClientOptions) {
40
- const socket = app.io || (app as any).primus;
46
+ const socket = app.io;
41
47
  const storage = new StorageWrapper(app.get('storage') || options.storage);
42
48
 
43
49
  this.app = app;
@@ -90,7 +96,7 @@ export class AuthenticationClient {
90
96
  if (message !== null) {
91
97
  location.hash = location.hash.replace(errorRegex, '');
92
98
 
93
- return Promise.reject(new NotAuthenticated(decodeURIComponent(message)));
99
+ return Promise.reject(new OauthError(decodeURIComponent(message)));
94
100
  }
95
101
 
96
102
  return Promise.resolve(null);
@@ -1,20 +1,18 @@
1
- import { HookContext } from '@feathersjs/feathers';
1
+ import { HookContext, NextFunction } from '@feathersjs/feathers';
2
2
  import { stripSlashes } from '@feathersjs/commons';
3
3
 
4
4
  export const authentication = () => {
5
- return (context: HookContext) => {
5
+ return (context: HookContext, next: NextFunction) => {
6
6
  const { app, params, path, method, app: { authentication: service } } = context;
7
7
 
8
8
  if (stripSlashes(service.options.path) === path && method === 'create') {
9
- return context;
9
+ return next();
10
10
  }
11
11
 
12
12
  return Promise.resolve(app.get('authentication')).then(authResult => {
13
13
  if (authResult) {
14
14
  context.params = Object.assign({}, authResult, params);
15
15
  }
16
-
17
- return context;
18
- });
16
+ }).then(next);
19
17
  };
20
18
  };
@@ -1,7 +1,7 @@
1
- import { HookContext } from '@feathersjs/feathers';
1
+ import { HookContext, NextFunction } from '@feathersjs/feathers';
2
2
 
3
3
  export const populateHeader = () => {
4
- return (context: HookContext) => {
4
+ return (context: HookContext, next: NextFunction) => {
5
5
  const { app, params: { accessToken } } = context;
6
6
  const authentication = app.authentication;
7
7
 
@@ -15,6 +15,6 @@ export const populateHeader = () => {
15
15
  }, context.params.headers);
16
16
  }
17
17
 
18
- return context;
18
+ return next();
19
19
  };
20
20
  };
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@ import { Application } from '@feathersjs/feathers';
4
4
  import { Storage, MemoryStorage, StorageWrapper } from './storage';
5
5
 
6
6
  declare module '@feathersjs/feathers/lib/declarations' {
7
- interface Application<ServiceTypes = {}> { // eslint-disable-line
7
+ interface Application<Services, Settings> { // eslint-disable-line
8
8
  io?: any;
9
9
  rest?: any;
10
10
  authentication: AuthenticationClient;
@@ -17,7 +17,7 @@ declare module '@feathersjs/feathers/lib/declarations' {
17
17
  export const getDefaultStorage = () => {
18
18
  try {
19
19
  return new StorageWrapper(window.localStorage);
20
- } catch (error) {}
20
+ } catch (error: any) {}
21
21
 
22
22
  return new MemoryStorage();
23
23
  };
@@ -52,14 +52,10 @@ const init = (_options: Partial<AuthenticationClientOptions> = {}) => {
52
52
  app.reAuthenticate = authentication.reAuthenticate.bind(authentication);
53
53
  app.logout = authentication.logout.bind(authentication);
54
54
 
55
- app.hooks({
56
- before: {
57
- all: [
58
- hooks.authentication(),
59
- hooks.populateHeader()
60
- ]
61
- }
62
- });
55
+ app.hooks([
56
+ hooks.authentication(),
57
+ hooks.populateHeader()
58
+ ]);
63
59
  };
64
60
  };
65
61