@feathersjs/authentication 5.0.0-pre.2 → 5.0.0-pre.20
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 +27 -3
- package/lib/core.js +85 -79
- package/lib/core.js.map +1 -1
- package/lib/hooks/authenticate.d.ts +3 -3
- package/lib/hooks/authenticate.js +11 -20
- package/lib/hooks/authenticate.js.map +1 -1
- package/lib/hooks/connection.d.ts +2 -2
- package/lib/hooks/connection.js +7 -17
- package/lib/hooks/connection.js.map +1 -1
- package/lib/hooks/event.d.ts +2 -2
- package/lib/hooks/event.js +5 -17
- package/lib/hooks/event.js.map +1 -1
- package/lib/index.d.ts +4 -5
- package/lib/index.js +11 -6
- package/lib/index.js.map +1 -1
- package/lib/jwt.d.ts +3 -3
- package/lib/jwt.js +95 -106
- package/lib/jwt.js.map +1 -1
- package/lib/options.d.ts +118 -3
- package/lib/options.js +106 -1
- package/lib/options.js.map +1 -1
- package/lib/service.d.ts +10 -8
- package/lib/service.js +73 -93
- package/lib/service.js.map +1 -1
- package/lib/strategy.d.ts +1 -1
- package/package.json +20 -20
- package/src/core.ts +47 -9
- package/src/hooks/authenticate.ts +8 -9
- package/src/hooks/connection.ts +9 -11
- package/src/hooks/event.ts +6 -6
- package/src/index.ts +4 -6
- package/src/jwt.ts +8 -5
- package/src/options.ts +107 -2
- package/src/service.ts +14 -14
- package/src/strategy.ts +1 -1
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.20](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.19...v5.0.0-pre.20) (2022-05-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [5.0.0-pre.19](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.18...v5.0.0-pre.19) (2022-05-01)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **typescript:** Improve adapter typings ([#2605](https://github.com/feathersjs/feathers/issues/2605)) ([3b2ca0a](https://github.com/feathersjs/feathers/commit/3b2ca0a6a8e03e8390272c4d7e930b4bffdaacf5))
|
|
23
|
+
* **typescript:** Improve params and query typeability ([#2600](https://github.com/feathersjs/feathers/issues/2600)) ([df28b76](https://github.com/feathersjs/feathers/commit/df28b7619161f1df5e700326f52cca1a92dc5d28))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# [5.0.0-pre.18](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.17...v5.0.0-pre.18) (2022-04-11)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* **authentication:** Add setup method for auth strategies ([#1611](https://github.com/feathersjs/feathers/issues/1611)) ([a3c3581](https://github.com/feathersjs/feathers/commit/a3c35814dccdbbf6de96f04f60b226ce206c6dbe))
|
|
35
|
+
* **configuration:** Allow app configuration to be validated against a schema ([#2590](https://github.com/feathersjs/feathers/issues/2590)) ([a268f86](https://github.com/feathersjs/feathers/commit/a268f86da92a8ada14ed11ab456aac0a4bba5bb0))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# [5.0.0-pre.17](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.16...v5.0.0-pre.17) (2022-02-15)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @feathersjs/authentication
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# [5.0.0-pre.16](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.15...v5.0.0-pre.16) (2022-01-12)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* **express, koa:** make transports similar ([#2486](https://github.com/feathersjs/feathers/issues/2486)) ([26aa937](https://github.com/feathersjs/feathers/commit/26aa937c114fb8596dfefc599b1f53cead69c159))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Bug Fixes
|
|
64
|
+
|
|
65
|
+
* **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Features
|
|
69
|
+
|
|
70
|
+
* **authentication-oauth:** Allow dynamic oAuth redirect ([#2469](https://github.com/feathersjs/feathers/issues/2469)) ([b7143d4](https://github.com/feathersjs/feathers/commit/b7143d4c0fbe961e714f79512be04449b9bbd7d9))
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @feathersjs/authentication
|
|
2
2
|
|
|
3
3
|
[](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
|
|
4
|
-
[](https://david-dm.org/feathersjs/feathers?path=packages/authentication)
|
|
5
4
|
[](https://www.npmjs.com/package/@feathersjs/authentication)
|
|
5
|
+
[](https://discord.gg/qa8kez8QBx)
|
|
6
6
|
|
|
7
7
|
> Add Authentication to your FeathersJS app.
|
|
8
8
|
|
|
@@ -18,6 +18,6 @@ Refer to the [Feathers authentication API documentation](https://docs.feathersjs
|
|
|
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
|
@@ -9,6 +9,15 @@ export interface AuthenticationRequest {
|
|
|
9
9
|
strategy?: string;
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
|
+
export interface AuthenticationParams extends Params {
|
|
13
|
+
payload?: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
jwtOptions?: SignOptions;
|
|
17
|
+
authStrategies?: string[];
|
|
18
|
+
secret?: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
12
21
|
export declare type ConnectionEvent = 'login' | 'logout' | 'disconnect';
|
|
13
22
|
export interface AuthenticationStrategy {
|
|
14
23
|
/**
|
|
@@ -34,6 +43,12 @@ export interface AuthenticationStrategy {
|
|
|
34
43
|
* and throw an error if it is invalid.
|
|
35
44
|
*/
|
|
36
45
|
verifyConfiguration?(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Implement this method to setup this strategy
|
|
48
|
+
* @param auth The AuthenticationService
|
|
49
|
+
* @param name The name of the strategy
|
|
50
|
+
*/
|
|
51
|
+
setup?(auth: AuthenticationBase, name: string): Promise<void>;
|
|
37
52
|
/**
|
|
38
53
|
* Authenticate an authentication request with this strategy.
|
|
39
54
|
* Should throw an error if the strategy did not succeed.
|
|
@@ -41,7 +56,7 @@ export interface AuthenticationStrategy {
|
|
|
41
56
|
* @param authentication The authentication request
|
|
42
57
|
* @param params The service call parameters
|
|
43
58
|
*/
|
|
44
|
-
authenticate?(authentication: AuthenticationRequest, params:
|
|
59
|
+
authenticate?(authentication: AuthenticationRequest, params: AuthenticationParams): Promise<AuthenticationResult>;
|
|
45
60
|
/**
|
|
46
61
|
* Update a real-time connection according to this strategy.
|
|
47
62
|
*
|
|
@@ -65,10 +80,11 @@ export interface JwtVerifyOptions extends VerifyOptions {
|
|
|
65
80
|
*/
|
|
66
81
|
export declare class AuthenticationBase {
|
|
67
82
|
app: Application;
|
|
68
|
-
configKey: string;
|
|
69
83
|
strategies: {
|
|
70
84
|
[key: string]: AuthenticationStrategy;
|
|
71
85
|
};
|
|
86
|
+
configKey: string;
|
|
87
|
+
isReady: boolean;
|
|
72
88
|
/**
|
|
73
89
|
* Create a new authentication service.
|
|
74
90
|
*
|
|
@@ -98,6 +114,13 @@ export declare class AuthenticationBase {
|
|
|
98
114
|
* @param names The list or strategy names
|
|
99
115
|
*/
|
|
100
116
|
getStrategies(...names: string[]): AuthenticationStrategy[];
|
|
117
|
+
/**
|
|
118
|
+
* Returns a single strategy by name
|
|
119
|
+
*
|
|
120
|
+
* @param name The strategy name
|
|
121
|
+
* @returns The authentication strategy or undefined
|
|
122
|
+
*/
|
|
123
|
+
getStrategy(name: string): AuthenticationStrategy;
|
|
101
124
|
/**
|
|
102
125
|
* Create a new access token with payload and options.
|
|
103
126
|
*
|
|
@@ -121,7 +144,7 @@ export declare class AuthenticationBase {
|
|
|
121
144
|
* @param params Service call parameters
|
|
122
145
|
* @param allowed A list of allowed strategy names
|
|
123
146
|
*/
|
|
124
|
-
authenticate(authentication: AuthenticationRequest, params:
|
|
147
|
+
authenticate(authentication: AuthenticationRequest, params: AuthenticationParams, ...allowed: string[]): Promise<AuthenticationResult>;
|
|
125
148
|
handleConnection(event: ConnectionEvent, connection: any, authResult?: AuthenticationResult): Promise<void>;
|
|
126
149
|
/**
|
|
127
150
|
* Parse an HTTP request and response for authentication request information.
|
|
@@ -131,4 +154,5 @@ export declare class AuthenticationBase {
|
|
|
131
154
|
* @param names A list of strategies to use
|
|
132
155
|
*/
|
|
133
156
|
parse(req: IncomingMessage, res: ServerResponse, ...names: string[]): Promise<AuthenticationRequest>;
|
|
157
|
+
setup(): Promise<void>;
|
|
134
158
|
}
|
package/lib/core.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -17,9 +8,9 @@ const merge_1 = __importDefault(require("lodash/merge"));
|
|
|
17
8
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
18
9
|
const uuid_1 = require("uuid");
|
|
19
10
|
const errors_1 = require("@feathersjs/errors");
|
|
20
|
-
const
|
|
21
|
-
const options_1 =
|
|
22
|
-
const debug =
|
|
11
|
+
const commons_1 = require("@feathersjs/commons");
|
|
12
|
+
const options_1 = require("./options");
|
|
13
|
+
const debug = (0, commons_1.createDebug)('@feathersjs/authentication/base');
|
|
23
14
|
/**
|
|
24
15
|
* A base class for managing authentication strategies and creating and verifying JWTs
|
|
25
16
|
*/
|
|
@@ -38,15 +29,16 @@ class AuthenticationBase {
|
|
|
38
29
|
this.app = app;
|
|
39
30
|
this.strategies = {};
|
|
40
31
|
this.configKey = configKey;
|
|
32
|
+
this.isReady = false;
|
|
41
33
|
app.set('defaultAuthentication', app.get('defaultAuthentication') || configKey);
|
|
42
|
-
app.set(configKey, merge_1.default({}, app.get(configKey), options));
|
|
34
|
+
app.set(configKey, (0, merge_1.default)({}, app.get(configKey), options));
|
|
43
35
|
}
|
|
44
36
|
/**
|
|
45
37
|
* Return the current configuration from the application
|
|
46
38
|
*/
|
|
47
39
|
get configuration() {
|
|
48
40
|
// Always returns a copy of the authentication configuration
|
|
49
|
-
return Object.assign({}, options_1.
|
|
41
|
+
return Object.assign({}, options_1.defaultOptions, this.app.get(this.configKey));
|
|
50
42
|
}
|
|
51
43
|
/**
|
|
52
44
|
* A list of all registered strategy names
|
|
@@ -61,6 +53,7 @@ class AuthenticationBase {
|
|
|
61
53
|
* @param strategy The authentication strategy instance
|
|
62
54
|
*/
|
|
63
55
|
register(name, strategy) {
|
|
56
|
+
var _a;
|
|
64
57
|
// Call the functions a strategy can implement
|
|
65
58
|
if (typeof strategy.setName === 'function') {
|
|
66
59
|
strategy.setName(name);
|
|
@@ -76,6 +69,9 @@ class AuthenticationBase {
|
|
|
76
69
|
}
|
|
77
70
|
// Register strategy as name
|
|
78
71
|
this.strategies[name] = strategy;
|
|
72
|
+
if (this.isReady) {
|
|
73
|
+
(_a = strategy.setup) === null || _a === void 0 ? void 0 : _a.call(strategy, this, name);
|
|
74
|
+
}
|
|
79
75
|
}
|
|
80
76
|
/**
|
|
81
77
|
* Get the registered authentication strategies for a list of names.
|
|
@@ -86,6 +82,15 @@ class AuthenticationBase {
|
|
|
86
82
|
return names.map(name => this.strategies[name])
|
|
87
83
|
.filter(current => !!current);
|
|
88
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns a single strategy by name
|
|
87
|
+
*
|
|
88
|
+
* @param name The strategy name
|
|
89
|
+
* @returns The authentication strategy or undefined
|
|
90
|
+
*/
|
|
91
|
+
getStrategy(name) {
|
|
92
|
+
return this.strategies[name];
|
|
93
|
+
}
|
|
89
94
|
/**
|
|
90
95
|
* Create a new access token with payload and options.
|
|
91
96
|
*
|
|
@@ -93,19 +98,17 @@ class AuthenticationBase {
|
|
|
93
98
|
* @param optsOverride The options to extend the defaults (`configuration.jwtOptions`) with
|
|
94
99
|
* @param secretOverride Use a different secret instead
|
|
95
100
|
*/
|
|
96
|
-
createAccessToken(payload, optsOverride, secretOverride) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return jsonwebtoken_1.default.sign(payload, jwtSecret, options);
|
|
108
|
-
});
|
|
101
|
+
async createAccessToken(payload, optsOverride, secretOverride) {
|
|
102
|
+
const { secret, jwtOptions } = this.configuration;
|
|
103
|
+
// Use configuration by default but allow overriding the secret
|
|
104
|
+
const jwtSecret = secretOverride || secret;
|
|
105
|
+
// Default jwt options merged with additional options
|
|
106
|
+
const options = (0, merge_1.default)({}, jwtOptions, optsOverride);
|
|
107
|
+
if (!options.jwtid) {
|
|
108
|
+
// Generate a UUID as JWT ID by default
|
|
109
|
+
options.jwtid = (0, uuid_1.v4)();
|
|
110
|
+
}
|
|
111
|
+
return jsonwebtoken_1.default.sign(payload, jwtSecret, options);
|
|
109
112
|
}
|
|
110
113
|
/**
|
|
111
114
|
* Verifies an access token.
|
|
@@ -114,25 +117,23 @@ class AuthenticationBase {
|
|
|
114
117
|
* @param optsOverride The options to extend the defaults (`configuration.jwtOptions`) with
|
|
115
118
|
* @param secretOverride Use a different secret instead
|
|
116
119
|
*/
|
|
117
|
-
verifyAccessToken(accessToken, optsOverride, secretOverride) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
});
|
|
120
|
+
async verifyAccessToken(accessToken, optsOverride, secretOverride) {
|
|
121
|
+
const { secret, jwtOptions } = this.configuration;
|
|
122
|
+
const jwtSecret = secretOverride || secret;
|
|
123
|
+
const options = (0, merge_1.default)({}, jwtOptions, optsOverride);
|
|
124
|
+
const { algorithm } = options;
|
|
125
|
+
// Normalize the `algorithm` setting into the algorithms array
|
|
126
|
+
if (algorithm && !options.algorithms) {
|
|
127
|
+
options.algorithms = Array.isArray(algorithm) ? algorithm : [algorithm];
|
|
128
|
+
delete options.algorithm;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
const verified = jsonwebtoken_1.default.verify(accessToken, jwtSecret, options);
|
|
132
|
+
return verified;
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
throw new errors_1.NotAuthenticated(error.message, error);
|
|
136
|
+
}
|
|
136
137
|
}
|
|
137
138
|
/**
|
|
138
139
|
* Authenticate a given authentication request against a list of strategies.
|
|
@@ -141,29 +142,28 @@ class AuthenticationBase {
|
|
|
141
142
|
* @param params Service call parameters
|
|
142
143
|
* @param allowed A list of allowed strategy names
|
|
143
144
|
*/
|
|
144
|
-
authenticate(authentication, params, ...allowed) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
145
|
+
async authenticate(authentication, params, ...allowed) {
|
|
146
|
+
const { strategy } = authentication || {};
|
|
147
|
+
const [authStrategy] = this.getStrategies(strategy);
|
|
148
|
+
const strategyAllowed = allowed.includes(strategy);
|
|
149
|
+
debug('Running authenticate for strategy', strategy, allowed);
|
|
150
|
+
if (!authentication || !authStrategy || !strategyAllowed) {
|
|
151
|
+
const additionalInfo = (!strategy && ' (no `strategy` set)') ||
|
|
152
|
+
(!strategyAllowed && ' (strategy not allowed in authStrategies)') || '';
|
|
153
|
+
// If there are no valid strategies or `authentication` is not an object
|
|
154
|
+
throw new errors_1.NotAuthenticated('Invalid authentication information' + additionalInfo);
|
|
155
|
+
}
|
|
156
|
+
return authStrategy.authenticate(authentication, {
|
|
157
|
+
...params,
|
|
158
|
+
authenticated: true
|
|
157
159
|
});
|
|
158
160
|
}
|
|
159
|
-
handleConnection(event, connection, authResult) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
});
|
|
161
|
+
async handleConnection(event, connection, authResult) {
|
|
162
|
+
const strategies = this.getStrategies(...Object.keys(this.strategies))
|
|
163
|
+
.filter(current => typeof current.handleConnection === 'function');
|
|
164
|
+
for (const strategy of strategies) {
|
|
165
|
+
await strategy.handleConnection(event, connection, authResult);
|
|
166
|
+
}
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
169
|
* Parse an HTTP request and response for authentication request information.
|
|
@@ -172,19 +172,25 @@ class AuthenticationBase {
|
|
|
172
172
|
* @param res The HTTP response
|
|
173
173
|
* @param names A list of strategies to use
|
|
174
174
|
*/
|
|
175
|
-
parse(req, res, ...names) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return value;
|
|
184
|
-
}
|
|
175
|
+
async parse(req, res, ...names) {
|
|
176
|
+
const strategies = this.getStrategies(...names)
|
|
177
|
+
.filter(current => typeof current.parse === 'function');
|
|
178
|
+
debug('Strategies parsing HTTP header for authentication information', names);
|
|
179
|
+
for (const authStrategy of strategies) {
|
|
180
|
+
const value = await authStrategy.parse(req, res);
|
|
181
|
+
if (value !== null) {
|
|
182
|
+
return value;
|
|
185
183
|
}
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
async setup() {
|
|
188
|
+
var _a;
|
|
189
|
+
this.isReady = true;
|
|
190
|
+
for (const name of Object.keys(this.strategies)) {
|
|
191
|
+
const strategy = this.strategies[name];
|
|
192
|
+
await ((_a = strategy.setup) === null || _a === void 0 ? void 0 : _a.call(strategy, this, name));
|
|
193
|
+
}
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
196
|
exports.AuthenticationBase = AuthenticationBase;
|
package/lib/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings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G,KAAK,CAAC;aAC5C,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC;QAE1D,KAAK,CAAC,+DAA+D,EAAE,KAAK,CAAC,CAAC;QAE9E,KAAK,MAAM,YAAY,IAAI,UAAU,EAAE;YACrC,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAEjD,IAAI,KAAK,KAAK,IAAI,EAAE;gBAClB,OAAO,KAAK,CAAC;aACd;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAK;;QACT,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEvC,MAAM,CAAA,MAAA,QAAQ,CAAC,KAAK,yDAAG,IAAI,EAAE,IAAI,CAAC,CAAA,CAAC;SACpC;IACH,CAAC;CACF;AAtND,gDAsNC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HookContext } from '@feathersjs/feathers';
|
|
1
|
+
import { HookContext, NextFunction } from '@feathersjs/feathers';
|
|
2
2
|
export interface AuthenticateHookSettings {
|
|
3
3
|
service?: string;
|
|
4
|
-
strategies
|
|
4
|
+
strategies?: string[];
|
|
5
5
|
}
|
|
6
|
-
declare const _default: (originalSettings: string | AuthenticateHookSettings, ...originalStrategies: string[]) => (context: HookContext
|
|
6
|
+
declare const _default: (originalSettings: string | AuthenticateHookSettings, ...originalStrategies: string[]) => (context: HookContext, _next?: NextFunction) => Promise<any>;
|
|
7
7
|
export default _default;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -15,16 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
6
|
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
16
7
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
17
8
|
const errors_1 = require("@feathersjs/errors");
|
|
18
|
-
const
|
|
19
|
-
const debug =
|
|
9
|
+
const commons_1 = require("@feathersjs/commons");
|
|
10
|
+
const debug = (0, commons_1.createDebug)('@feathersjs/authentication/hooks/authenticate');
|
|
20
11
|
exports.default = (originalSettings, ...originalStrategies) => {
|
|
21
12
|
const settings = typeof originalSettings === 'string'
|
|
22
|
-
? { strategies: flatten_1.default([originalSettings, ...originalStrategies]) }
|
|
13
|
+
? { strategies: (0, flatten_1.default)([originalSettings, ...originalStrategies]) }
|
|
23
14
|
: originalSettings;
|
|
24
15
|
if (!originalSettings || settings.strategies.length === 0) {
|
|
25
16
|
throw new Error('The authenticate hook needs at least one allowed strategy');
|
|
26
17
|
}
|
|
27
|
-
return (context) =>
|
|
18
|
+
return async (context, _next) => {
|
|
19
|
+
const next = typeof _next === 'function' ? _next : async () => context;
|
|
28
20
|
const { app, params, type, path, service } = context;
|
|
29
21
|
const { strategies } = settings;
|
|
30
22
|
const { provider, authentication } = params;
|
|
@@ -41,19 +33,18 @@ exports.default = (originalSettings, ...originalStrategies) => {
|
|
|
41
33
|
throw new errors_1.NotAuthenticated('The authenticate hook does not need to be used on the authentication service');
|
|
42
34
|
}
|
|
43
35
|
if (params.authenticated === true) {
|
|
44
|
-
return
|
|
36
|
+
return next();
|
|
45
37
|
}
|
|
46
38
|
if (authentication) {
|
|
47
|
-
const authParams = omit_1.default(params, 'provider', 'authentication');
|
|
39
|
+
const authParams = (0, omit_1.default)(params, 'provider', 'authentication');
|
|
48
40
|
debug('Authenticating with', authentication, strategies);
|
|
49
|
-
const authResult =
|
|
50
|
-
context.params = Object.assign({}, params, omit_1.default(authResult, 'accessToken'), { authenticated: true });
|
|
51
|
-
return context;
|
|
41
|
+
const authResult = await authService.authenticate(authentication, authParams, ...strategies);
|
|
42
|
+
context.params = Object.assign({}, params, (0, omit_1.default)(authResult, 'accessToken'), { authenticated: true });
|
|
52
43
|
}
|
|
53
44
|
else if (provider) {
|
|
54
45
|
throw new errors_1.NotAuthenticated('Not authenticated');
|
|
55
46
|
}
|
|
56
|
-
return
|
|
57
|
-
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
58
49
|
};
|
|
59
50
|
//# sourceMappingURL=authenticate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/hooks/authenticate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/hooks/authenticate.ts"],"names":[],"mappings":";;;;;AAAA,6DAAqC;AACrC,uDAA+B;AAE/B,+CAAsD;AACtD,iDAAkD;AAElD,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,+CAA+C,CAAC,CAAC;AAO3E,kBAAe,CAAC,gBAAmD,EAAE,GAAG,kBAA4B,EAAE,EAAE;IACtG,MAAM,QAAQ,GAAG,OAAO,gBAAgB,KAAK,QAAQ;QACnD,CAAC,CAAC,EAAE,UAAU,EAAE,IAAA,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