@feathersjs/authentication-local 5.0.0-pre.11 → 5.0.0-pre.17
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 +54 -0
- package/LICENSE +1 -1
- package/README.md +1 -2
- package/lib/hooks/hash-password.d.ts +1 -1
- package/lib/hooks/hash-password.js +1 -1
- package/lib/hooks/hash-password.js.map +1 -1
- package/lib/hooks/protect.d.ts +1 -1
- package/lib/hooks/protect.js +21 -19
- package/lib/hooks/protect.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/package.json +14 -14
- package/src/hooks/hash-password.ts +2 -2
- package/src/hooks/protect.ts +20 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,60 @@
|
|
|
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.17](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.16...v5.0.0-pre.17) (2022-02-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **hooks:** Allow all built-in hooks to be used the async and regular way ([#2559](https://github.com/feathersjs/feathers/issues/2559)) ([8f9f631](https://github.com/feathersjs/feathers/commit/8f9f631e0ce89de349207db72def84e7ab496a4a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [5.0.0-pre.16](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.15...v5.0.0-pre.16) (2022-01-12)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @feathersjs/authentication-local
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13)
|
|
37
|
+
|
|
38
|
+
**Note:** Version bump only for package @feathersjs/authentication-local
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# [5.0.0-pre.13](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.12...v5.0.0-pre.13) (2021-10-13)
|
|
45
|
+
|
|
46
|
+
**Note:** Version bump only for package @feathersjs/authentication-local
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# [5.0.0-pre.12](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.11...v5.0.0-pre.12) (2021-10-12)
|
|
53
|
+
|
|
54
|
+
**Note:** Version bump only for package @feathersjs/authentication-local
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
6
60
|
# [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06)
|
|
7
61
|
|
|
8
62
|
**Note:** Version bump only for package @feathersjs/authentication-local
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# @feathersjs/authentication-local
|
|
2
2
|
|
|
3
3
|
[](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
|
|
4
|
-
[](https://david-dm.org/feathersjs/feathers?path=packages/authentication-local)
|
|
5
4
|
[](https://www.npmjs.com/package/@feathersjs/authentication-local)
|
|
6
5
|
|
|
7
6
|
> Local username and password authentication strategy for Feathers authentication
|
|
@@ -18,6 +17,6 @@ Refer to the [Feathers local authentication API documentation](https://docs.feat
|
|
|
18
17
|
|
|
19
18
|
## License
|
|
20
19
|
|
|
21
|
-
Copyright (c)
|
|
20
|
+
Copyright (c) 2022 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
|
|
22
21
|
|
|
23
22
|
Licensed under the [MIT license](LICENSE).
|
|
@@ -3,4 +3,4 @@ export interface HashPasswordOptions {
|
|
|
3
3
|
authentication?: string;
|
|
4
4
|
strategy?: string;
|
|
5
5
|
}
|
|
6
|
-
export default function hashPassword(field: string, options?: HashPasswordOptions): (context: HookContext
|
|
6
|
+
export default function hashPassword(field: string, options?: HashPasswordOptions): (context: HookContext, next?: NextFunction) => Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash-password.js","sourceRoot":"","sources":["../../src/hooks/hash-password.ts"],"names":[],"mappings":";;;;;AAAA,qDAA6B;AAC7B,qDAA6B;AAC7B,iEAAyC;AACzC,+CAAgD;AAChD,iDAAkD;AAIlD,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,sDAAsD,CAAC,CAAC;AAOlF,SAAwB,YAAY,CAAE,KAAa,EAAE,UAA+B,EAAE;IACpF,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACvE;IAED,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"hash-password.js","sourceRoot":"","sources":["../../src/hooks/hash-password.ts"],"names":[],"mappings":";;;;;AAAA,qDAA6B;AAC7B,qDAA6B;AAC7B,iEAAyC;AACzC,+CAAgD;AAChD,iDAAkD;AAIlD,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,sDAAsD,CAAC,CAAC;AAOlF,SAAwB,YAAY,CAAE,KAAa,EAAE,UAA+B,EAAE;IACpF,IAAI,CAAC,KAAK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,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;gBACnF,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC;SACjC;QAED,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC9B,OAAO,IAAI,EAAE,CAAC;SACf;IACH,CAAC,CAAC;AACJ,CAAC;AA3CD,+BA2CC"}
|
package/lib/hooks/protect.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { HookContext, NextFunction } from '@feathersjs/feathers';
|
|
2
|
-
declare const _default: (...fields: string[]) => (context: HookContext
|
|
2
|
+
declare const _default: (...fields: string[]) => (context: HookContext, next?: NextFunction) => Promise<void>;
|
|
3
3
|
export default _default;
|
package/lib/hooks/protect.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
7
|
-
exports.default = (...fields) =>
|
|
7
|
+
exports.default = (...fields) => {
|
|
8
8
|
const o = (current) => {
|
|
9
9
|
if (typeof current === 'object' && !Array.isArray(current)) {
|
|
10
10
|
const data = typeof current.toJSON === 'function'
|
|
@@ -13,25 +13,27 @@ exports.default = (...fields) => async (context, next) => {
|
|
|
13
13
|
}
|
|
14
14
|
return current;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const result = context.dispatch || context.result;
|
|
20
|
-
if (result) {
|
|
21
|
-
if (Array.isArray(result)) {
|
|
22
|
-
context.dispatch = result.map(o);
|
|
16
|
+
return async (context, next) => {
|
|
17
|
+
if (typeof next === 'function') {
|
|
18
|
+
await next();
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const result = context.dispatch || context.result;
|
|
21
|
+
if (result) {
|
|
22
|
+
if (Array.isArray(result)) {
|
|
23
|
+
context.dispatch = result.map(o);
|
|
24
|
+
}
|
|
25
|
+
else if (result.data && context.method === 'find') {
|
|
26
|
+
context.dispatch = Object.assign({}, result, {
|
|
27
|
+
data: result.data.map(o)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
context.dispatch = o(result);
|
|
32
|
+
}
|
|
33
|
+
if (context.params && context.params.provider) {
|
|
34
|
+
context.result = context.dispatch;
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
|
-
|
|
30
|
-
context.dispatch = o(result);
|
|
31
|
-
}
|
|
32
|
-
if (context.params && context.params.provider) {
|
|
33
|
-
context.result = context.dispatch;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
37
|
+
};
|
|
36
38
|
};
|
|
37
39
|
//# sourceMappingURL=protect.js.map
|
package/lib/hooks/protect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protect.js","sourceRoot":"","sources":["../../src/hooks/protect.ts"],"names":[],"mappings":";;;;;AAAA,uDAA+B;AAG/B,kBAAe,CAAC,GAAG,MAAgB,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"protect.js","sourceRoot":"","sources":["../../src/hooks/protect.ts"],"names":[],"mappings":";;;;;AAAA,uDAA+B;AAG/B,kBAAe,CAAC,GAAG,MAAgB,EAAE,EAAE;IACrC,MAAM,CAAC,GAAG,CAAC,OAAY,EAAE,EAAE;QACzB,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAC1D,MAAM,IAAI,GAAG,OAAO,OAAO,CAAC,MAAM,KAAK,UAAU;gBAC/C,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAE/B,OAAO,IAAA,cAAI,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SAC3B;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,KAAK,EAAE,OAAoB,EAAE,IAAmB,EAAE,EAAE;QACzD,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC9B,MAAM,IAAI,EAAE,CAAC;SACd;QAED,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;QAElD,IAAI,MAAM,EAAE;YACV,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACzB,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aAClC;iBAAM,IAAI,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;gBACnD,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE;oBAC3C,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;iBACzB,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;aAC9B;YAED,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC7C,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;aACnC;SACF;IACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import hashPassword from './hooks/hash-password';
|
|
2
2
|
export declare const hooks: {
|
|
3
3
|
hashPassword: typeof hashPassword;
|
|
4
|
-
protect: (...fields: string[]) => (context: import("@feathersjs/feathers/lib").HookContext<any, any>, next?: import("@feathersjs/hooks
|
|
4
|
+
protect: (...fields: string[]) => (context: import("@feathersjs/feathers/lib").HookContext<import("@feathersjs/feathers/lib").Application<any, any>, any>, next?: import("@feathersjs/hooks").NextFunction) => Promise<void>;
|
|
5
5
|
};
|
|
6
6
|
export { LocalStrategy } from './strategy';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/authentication-local",
|
|
3
3
|
"description": "Local authentication strategy for @feathers/authentication",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.17",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -52,23 +52,23 @@
|
|
|
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.
|
|
55
|
+
"@feathersjs/authentication": "^5.0.0-pre.17",
|
|
56
|
+
"@feathersjs/commons": "^5.0.0-pre.17",
|
|
57
|
+
"@feathersjs/errors": "^5.0.0-pre.17",
|
|
58
|
+
"@feathersjs/feathers": "^5.0.0-pre.17",
|
|
59
59
|
"bcryptjs": "^2.4.3",
|
|
60
60
|
"lodash": "^4.17.21"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@feathersjs/memory": "^5.0.0-pre.
|
|
63
|
+
"@feathersjs/memory": "^5.0.0-pre.17",
|
|
64
64
|
"@types/bcryptjs": "^2.4.2",
|
|
65
|
-
"@types/lodash": "^4.14.
|
|
66
|
-
"@types/mocha": "^9.
|
|
67
|
-
"@types/node": "^
|
|
68
|
-
"mocha": "^9.
|
|
69
|
-
"shx": "^0.3.
|
|
70
|
-
"ts-node": "^10.
|
|
71
|
-
"typescript": "^4.
|
|
65
|
+
"@types/lodash": "^4.14.178",
|
|
66
|
+
"@types/mocha": "^9.1.0",
|
|
67
|
+
"@types/node": "^17.0.15",
|
|
68
|
+
"mocha": "^9.2.0",
|
|
69
|
+
"shx": "^0.3.4",
|
|
70
|
+
"ts-node": "^10.4.0",
|
|
71
|
+
"typescript": "^4.5.5"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "d828748e57b40abfaa15710663afed417de14a1d"
|
|
74
74
|
}
|
|
@@ -18,7 +18,7 @@ export default function hashPassword (field: string, options: HashPasswordOption
|
|
|
18
18
|
throw new Error('The hashPassword hook requires a field name option');
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
return async (context: HookContext
|
|
21
|
+
return async (context: HookContext, next?: NextFunction) => {
|
|
22
22
|
const { app, data, params } = context;
|
|
23
23
|
|
|
24
24
|
if (data !== undefined) {
|
|
@@ -53,7 +53,7 @@ export default function hashPassword (field: string, options: HashPasswordOption
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (typeof next === 'function') {
|
|
56
|
-
|
|
56
|
+
return next();
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
}
|
package/src/hooks/protect.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
2
|
import { HookContext, NextFunction } from '@feathersjs/feathers';
|
|
3
3
|
|
|
4
|
-
export default (...fields: string[]) =>
|
|
4
|
+
export default (...fields: string[]) => {
|
|
5
5
|
const o = (current: any) => {
|
|
6
6
|
if (typeof current === 'object' && !Array.isArray(current)) {
|
|
7
7
|
const data = typeof current.toJSON === 'function'
|
|
@@ -13,25 +13,27 @@ export default (...fields: string[]) => async (context: HookContext<any, any>, n
|
|
|
13
13
|
return current;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return async (context: HookContext, next?: NextFunction) => {
|
|
17
|
+
if (typeof next === 'function') {
|
|
18
|
+
await next();
|
|
19
|
+
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
const result = context.dispatch || context.result;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
if (result) {
|
|
24
|
+
if (Array.isArray(result)) {
|
|
25
|
+
context.dispatch = result.map(o);
|
|
26
|
+
} else if (result.data && context.method === 'find') {
|
|
27
|
+
context.dispatch = Object.assign({}, result, {
|
|
28
|
+
data: result.data.map(o)
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
context.dispatch = o(result);
|
|
32
|
+
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
if (context.params && context.params.provider) {
|
|
35
|
+
context.result = context.dispatch;
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
|
-
}
|
|
38
|
+
};
|
|
37
39
|
};
|