@feathersjs/authentication-client 5.0.0-pre.2 → 5.0.0-pre.22
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 +183 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/lib/core.d.ts +1 -1
- package/lib/hooks/authentication.d.ts +2 -2
- package/lib/hooks/authentication.js +4 -5
- package/lib/hooks/authentication.js.map +1 -1
- package/lib/hooks/populate-header.d.ts +2 -2
- package/lib/hooks/populate-header.js +2 -2
- package/lib/hooks/populate-header.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +10 -10
- package/lib/index.js.map +1 -1
- package/package.json +22 -24
- package/src/hooks/authentication.ts +4 -6
- package/src/hooks/populate-header.ts +3 -3
- package/src/index.ts +6 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,189 @@
|
|
|
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.22](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.21...v5.0.0-pre.22) (2022-05-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [5.0.0-pre.21](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.20...v5.0.0-pre.21) (2022-05-23)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [5.0.0-pre.20](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.19...v5.0.0-pre.20) (2022-05-04)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [5.0.0-pre.19](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.18...v5.0.0-pre.19) (2022-05-01)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# [5.0.0-pre.18](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.17...v5.0.0-pre.18) (2022-04-11)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# [5.0.0-pre.17](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.16...v5.0.0-pre.17) (2022-02-15)
|
|
50
|
+
|
|
51
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# [5.0.0-pre.16](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.15...v5.0.0-pre.16) (2022-01-12)
|
|
58
|
+
|
|
59
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
* **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13)
|
|
77
|
+
|
|
78
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# [5.0.0-pre.13](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.12...v5.0.0-pre.13) (2021-10-13)
|
|
85
|
+
|
|
86
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
# [5.0.0-pre.12](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.11...v5.0.0-pre.12) (2021-10-12)
|
|
93
|
+
|
|
94
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06)
|
|
101
|
+
|
|
102
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19)
|
|
109
|
+
|
|
110
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# [5.0.0-pre.9](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.8...v5.0.0-pre.9) (2021-08-09)
|
|
117
|
+
|
|
118
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# [5.0.0-pre.8](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.7...v5.0.0-pre.8) (2021-08-09)
|
|
125
|
+
|
|
126
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# [5.0.0-pre.7](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.6...v5.0.0-pre.7) (2021-08-09)
|
|
133
|
+
|
|
134
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# [5.0.0-pre.6](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.5...v5.0.0-pre.6) (2021-08-08)
|
|
141
|
+
|
|
142
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# [5.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.4...v5.0.0-pre.5) (2021-06-23)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### Bug Fixes
|
|
152
|
+
|
|
153
|
+
* **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))
|
|
154
|
+
* **koa:** Use extended query parser for compatibility ([#2397](https://github.com/feathersjs/feathers/issues/2397)) ([b2944ba](https://github.com/feathersjs/feathers/commit/b2944bac3ec6d5ecc80dc518cd4e58093692db74))
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### Features
|
|
158
|
+
|
|
159
|
+
* **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))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# [5.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.3...v5.0.0-pre.4) (2021-05-13)
|
|
166
|
+
|
|
167
|
+
**Note:** Version bump only for package @feathersjs/authentication-client
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# [5.0.0-pre.3](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.2...v5.0.0-pre.3) (2021-04-21)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### Bug Fixes
|
|
177
|
+
|
|
178
|
+
* **typescript:** Improve TypeScript backwards compatibility ([#2310](https://github.com/feathersjs/feathers/issues/2310)) ([f33be73](https://github.com/feathersjs/feathers/commit/f33be73fc46a533efb15df9aab0658e3240d3897))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
### Features
|
|
182
|
+
|
|
183
|
+
* **dependencies:** Remove direct debug dependency ([#2296](https://github.com/feathersjs/feathers/issues/2296)) ([501d416](https://github.com/feathersjs/feathers/commit/501d4164d30c6a126906dc640cdfdc82207ba34a))
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
6
189
|
# [5.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.1...v5.0.0-pre.2) (2021-04-06)
|
|
7
190
|
|
|
8
191
|
**Note:** Version bump only for package @feathersjs/authentication-client
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @feathersjs/authentication-client
|
|
2
2
|
|
|
3
3
|
[](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
|
|
4
|
-
[](https://david-dm.org/feathersjs/feathers?path=packages/authentication-client)
|
|
5
4
|
[](https://www.npmjs.com/package/@feathersjs/authentication-client)
|
|
5
|
+
[](https://discord.gg/qa8kez8QBx)
|
|
6
6
|
|
|
7
7
|
> Feathers authentication client
|
|
8
8
|
|
|
@@ -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)
|
|
21
|
+
Copyright (c) 2022 [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(): import("@feathersjs/feathers").FeathersService<Application<any, any>, import("@feathersjs/feathers").Service<any, Partial<any>>>;
|
|
22
|
+
get service(): import("@feathersjs/feathers").FeathersService<Application<any, any>, import("@feathersjs/feathers").Service<any, Partial<any>, Params<import("@feathersjs/feathers").Query>>>;
|
|
23
23
|
get storage(): Storage;
|
|
24
24
|
handleSocket(socket: any): void;
|
|
25
25
|
getFromLocation(location: Location): Promise<any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HookContext } from '@feathersjs/feathers';
|
|
2
|
-
export declare const authentication: () => (context: HookContext
|
|
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
|
|
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
|
-
|
|
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;
|
|
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) =>
|
|
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
|
|
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;
|
|
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<
|
|
6
|
+
interface Application<Services, Settings> {
|
|
7
7
|
io?: any;
|
|
8
8
|
rest?: any;
|
|
9
9
|
authentication: AuthenticationClient;
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -34,7 +38,7 @@ const getDefaultStorage = () => {
|
|
|
34
38
|
return new storage_1.MemoryStorage();
|
|
35
39
|
};
|
|
36
40
|
exports.getDefaultStorage = getDefaultStorage;
|
|
37
|
-
exports.defaultStorage = exports.getDefaultStorage();
|
|
41
|
+
exports.defaultStorage = (0, exports.getDefaultStorage)();
|
|
38
42
|
exports.defaults = {
|
|
39
43
|
header: 'Authorization',
|
|
40
44
|
scheme: 'Bearer',
|
|
@@ -55,14 +59,10 @@ const init = (_options = {}) => {
|
|
|
55
59
|
app.authenticate = authentication.authenticate.bind(authentication);
|
|
56
60
|
app.reAuthenticate = authentication.reAuthenticate.bind(authentication);
|
|
57
61
|
app.logout = authentication.logout.bind(authentication);
|
|
58
|
-
app.hooks(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
hooks.populateHeader()
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
});
|
|
62
|
+
app.hooks([
|
|
63
|
+
hooks.authentication(),
|
|
64
|
+
hooks.populateHeader()
|
|
65
|
+
]);
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
exports.default = init;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA2E;AAwBlE,qGAxBA,2BAAoB,OAwBA;AAvB7B,+CAAiC;AAuBmD,sBAAK;AArBzF,uCAAmE;AAqBE,8FArBnD,uBAAa,OAqBmD;AAR3E,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,IAAI;QACF,OAAO,IAAI,wBAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;KAChD;IAAC,OAAO,KAAU,EAAE,GAAE;IAEvB,OAAO,IAAI,uBAAa,EAAE,CAAC;AAC7B,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B;AAMW,QAAA,cAAc,GAAY,IAAA,yBAAiB,GAAE,CAAC;AAE9C,QAAA,QAAQ,GAAgC;IACnD,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,cAAc;IAC1B,WAAW,EAAE,cAAc;IAC3B,gBAAgB,EAAE,OAAO;IACzB,WAAW,EAAE,KAAK;IAClB,IAAI,EAAE,iBAAiB;IACvB,cAAc,EAAE,2BAAoB;IACpC,OAAO,EAAE,sBAAc;CACxB,CAAC;AAEF,MAAM,IAAI,GAAG,CAAC,WAAiD,EAAE,EAAE,EAAE;IACnE,MAAM,OAAO,GAAgC,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.
|
|
4
|
+
"version": "5.0.0-pre.22",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git://github.com/feathersjs/feathers.git"
|
|
19
|
+
"url": "git://github.com/feathersjs/feathers.git",
|
|
20
|
+
"directory": "packages/authentication-client"
|
|
20
21
|
},
|
|
21
22
|
"author": {
|
|
22
23
|
"name": "Feathers contributors",
|
|
@@ -42,8 +43,7 @@
|
|
|
42
43
|
"scripts": {
|
|
43
44
|
"prepublish": "npm run compile",
|
|
44
45
|
"compile": "shx rm -rf lib/ && tsc",
|
|
45
|
-
"test": "
|
|
46
|
-
"mocha": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
|
|
46
|
+
"test": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
|
|
47
47
|
},
|
|
48
48
|
"directories": {
|
|
49
49
|
"lib": "lib"
|
|
@@ -52,27 +52,25 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@feathersjs/authentication": "^5.0.0-pre.
|
|
56
|
-
"@feathersjs/commons": "^5.0.0-pre.
|
|
57
|
-
"@feathersjs/errors": "^5.0.0-pre.
|
|
58
|
-
"@feathersjs/feathers": "^5.0.0-pre.
|
|
59
|
-
"debug": "^4.3.1"
|
|
55
|
+
"@feathersjs/authentication": "^5.0.0-pre.22",
|
|
56
|
+
"@feathersjs/commons": "^5.0.0-pre.22",
|
|
57
|
+
"@feathersjs/errors": "^5.0.0-pre.22",
|
|
58
|
+
"@feathersjs/feathers": "^5.0.0-pre.22"
|
|
60
59
|
},
|
|
61
60
|
"devDependencies": {
|
|
62
|
-
"@feathersjs/
|
|
63
|
-
"@feathersjs/
|
|
64
|
-
"@feathersjs/
|
|
65
|
-
"@feathersjs/rest-client": "^5.0.0-pre.
|
|
66
|
-
"@feathersjs/socketio": "^5.0.0-pre.
|
|
67
|
-
"@feathersjs/socketio-client": "^5.0.0-pre.
|
|
68
|
-
"@types/
|
|
69
|
-
"@types/
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"typescript": "^4.2.3"
|
|
61
|
+
"@feathersjs/authentication-local": "^5.0.0-pre.22",
|
|
62
|
+
"@feathersjs/express": "^5.0.0-pre.22",
|
|
63
|
+
"@feathersjs/memory": "^5.0.0-pre.22",
|
|
64
|
+
"@feathersjs/rest-client": "^5.0.0-pre.22",
|
|
65
|
+
"@feathersjs/socketio": "^5.0.0-pre.22",
|
|
66
|
+
"@feathersjs/socketio-client": "^5.0.0-pre.22",
|
|
67
|
+
"@types/mocha": "^9.1.1",
|
|
68
|
+
"@types/node": "^17.0.31",
|
|
69
|
+
"axios": "^0.27.2",
|
|
70
|
+
"mocha": "^10.0.0",
|
|
71
|
+
"shx": "^0.3.4",
|
|
72
|
+
"ts-node": "^10.7.0",
|
|
73
|
+
"typescript": "^4.6.4"
|
|
76
74
|
},
|
|
77
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "e452e02063e6d8943a9cae2315ab585bc4f82fb6"
|
|
78
76
|
}
|
|
@@ -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
|
|
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
|
|
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<
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
hooks.populateHeader()
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
});
|
|
55
|
+
app.hooks([
|
|
56
|
+
hooks.authentication(),
|
|
57
|
+
hooks.populateHeader()
|
|
58
|
+
]);
|
|
63
59
|
};
|
|
64
60
|
};
|
|
65
61
|
|