@feathersjs/authentication 5.0.0-pre.9 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +275 -286
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/lib/core.d.ts +31 -5
- package/lib/core.js +84 -80
- package/lib/core.js.map +1 -1
- package/lib/hooks/authenticate.d.ts +2 -2
- package/lib/hooks/authenticate.js +11 -19
- package/lib/hooks/authenticate.js.map +1 -1
- package/lib/hooks/connection.js +4 -18
- package/lib/hooks/connection.js.map +1 -1
- package/lib/hooks/event.js +4 -13
- package/lib/hooks/event.js.map +1 -1
- package/lib/hooks/index.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 +2 -2
- package/lib/jwt.js +98 -104
- package/lib/jwt.js.map +1 -1
- package/lib/options.d.ts +5 -3
- package/lib/options.js +4 -1
- package/lib/options.js.map +1 -1
- package/lib/service.d.ts +10 -8
- package/lib/service.js +82 -95
- package/lib/service.js.map +1 -1
- package/lib/strategy.d.ts +1 -1
- package/lib/strategy.js.map +1 -1
- package/package.json +25 -22
- package/src/core.ts +133 -83
- package/src/hooks/authenticate.ts +37 -33
- package/src/hooks/connection.ts +10 -10
- package/src/hooks/event.ts +9 -9
- package/src/hooks/index.ts +3 -3
- package/src/index.ts +8 -10
- package/src/jwt.ts +93 -82
- package/src/options.ts +9 -3
- package/src/service.ts +87 -71
- package/src/strategy.ts +17 -17
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) 2023 [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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { SignOptions, Secret, VerifyOptions } from 'jsonwebtoken';
|
|
3
4
|
import { Application, Params } from '@feathersjs/feathers';
|
|
4
5
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
6
|
+
import { AuthenticationConfiguration } from './options';
|
|
5
7
|
export interface AuthenticationResult {
|
|
6
8
|
[key: string]: any;
|
|
7
9
|
}
|
|
@@ -9,7 +11,16 @@ export interface AuthenticationRequest {
|
|
|
9
11
|
strategy?: string;
|
|
10
12
|
[key: string]: any;
|
|
11
13
|
}
|
|
12
|
-
export
|
|
14
|
+
export interface AuthenticationParams extends Params {
|
|
15
|
+
payload?: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
jwtOptions?: SignOptions;
|
|
19
|
+
authStrategies?: string[];
|
|
20
|
+
secret?: string;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|
|
23
|
+
export type ConnectionEvent = 'login' | 'logout' | 'disconnect';
|
|
13
24
|
export interface AuthenticationStrategy {
|
|
14
25
|
/**
|
|
15
26
|
* Implement this method to get access to the AuthenticationService
|
|
@@ -34,6 +45,12 @@ export interface AuthenticationStrategy {
|
|
|
34
45
|
* and throw an error if it is invalid.
|
|
35
46
|
*/
|
|
36
47
|
verifyConfiguration?(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Implement this method to setup this strategy
|
|
50
|
+
* @param auth The AuthenticationService
|
|
51
|
+
* @param name The name of the strategy
|
|
52
|
+
*/
|
|
53
|
+
setup?(auth: AuthenticationBase, name: string): Promise<void>;
|
|
37
54
|
/**
|
|
38
55
|
* Authenticate an authentication request with this strategy.
|
|
39
56
|
* Should throw an error if the strategy did not succeed.
|
|
@@ -41,7 +58,7 @@ export interface AuthenticationStrategy {
|
|
|
41
58
|
* @param authentication The authentication request
|
|
42
59
|
* @param params The service call parameters
|
|
43
60
|
*/
|
|
44
|
-
authenticate?(authentication: AuthenticationRequest, params:
|
|
61
|
+
authenticate?(authentication: AuthenticationRequest, params: AuthenticationParams): Promise<AuthenticationResult>;
|
|
45
62
|
/**
|
|
46
63
|
* Update a real-time connection according to this strategy.
|
|
47
64
|
*
|
|
@@ -65,10 +82,11 @@ export interface JwtVerifyOptions extends VerifyOptions {
|
|
|
65
82
|
*/
|
|
66
83
|
export declare class AuthenticationBase {
|
|
67
84
|
app: Application;
|
|
68
|
-
configKey: string;
|
|
69
85
|
strategies: {
|
|
70
86
|
[key: string]: AuthenticationStrategy;
|
|
71
87
|
};
|
|
88
|
+
configKey: string;
|
|
89
|
+
isReady: boolean;
|
|
72
90
|
/**
|
|
73
91
|
* Create a new authentication service.
|
|
74
92
|
*
|
|
@@ -80,7 +98,7 @@ export declare class AuthenticationBase {
|
|
|
80
98
|
/**
|
|
81
99
|
* Return the current configuration from the application
|
|
82
100
|
*/
|
|
83
|
-
get configuration():
|
|
101
|
+
get configuration(): AuthenticationConfiguration;
|
|
84
102
|
/**
|
|
85
103
|
* A list of all registered strategy names
|
|
86
104
|
*/
|
|
@@ -98,6 +116,13 @@ export declare class AuthenticationBase {
|
|
|
98
116
|
* @param names The list or strategy names
|
|
99
117
|
*/
|
|
100
118
|
getStrategies(...names: string[]): AuthenticationStrategy[];
|
|
119
|
+
/**
|
|
120
|
+
* Returns a single strategy by name
|
|
121
|
+
*
|
|
122
|
+
* @param name The strategy name
|
|
123
|
+
* @returns The authentication strategy or undefined
|
|
124
|
+
*/
|
|
125
|
+
getStrategy(name: string): AuthenticationStrategy;
|
|
101
126
|
/**
|
|
102
127
|
* Create a new access token with payload and options.
|
|
103
128
|
*
|
|
@@ -121,7 +146,7 @@ export declare class AuthenticationBase {
|
|
|
121
146
|
* @param params Service call parameters
|
|
122
147
|
* @param allowed A list of allowed strategy names
|
|
123
148
|
*/
|
|
124
|
-
authenticate(authentication: AuthenticationRequest, params:
|
|
149
|
+
authenticate(authentication: AuthenticationRequest, params: AuthenticationParams, ...allowed: string[]): Promise<AuthenticationResult>;
|
|
125
150
|
handleConnection(event: ConnectionEvent, connection: any, authResult?: AuthenticationResult): Promise<void>;
|
|
126
151
|
/**
|
|
127
152
|
* Parse an HTTP request and response for authentication request information.
|
|
@@ -131,4 +156,5 @@ export declare class AuthenticationBase {
|
|
|
131
156
|
* @param names A list of strategies to use
|
|
132
157
|
*/
|
|
133
158
|
parse(req: IncomingMessage, res: ServerResponse, ...names: string[]): Promise<AuthenticationRequest>;
|
|
159
|
+
setup(): Promise<void>;
|
|
134
160
|
}
|
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
|
};
|
|
@@ -18,8 +9,8 @@ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
|
18
9
|
const uuid_1 = require("uuid");
|
|
19
10
|
const errors_1 = require("@feathersjs/errors");
|
|
20
11
|
const commons_1 = require("@feathersjs/commons");
|
|
21
|
-
const options_1 =
|
|
22
|
-
const debug = commons_1.createDebug('@feathersjs/authentication/base');
|
|
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.
|
|
@@ -83,8 +79,16 @@ class AuthenticationBase {
|
|
|
83
79
|
* @param names The list or strategy names
|
|
84
80
|
*/
|
|
85
81
|
getStrategies(...names) {
|
|
86
|
-
return names.map(name => this.strategies[name])
|
|
87
|
-
|
|
82
|
+
return names.map((name) => this.strategies[name]).filter((current) => !!current);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns a single strategy by name
|
|
86
|
+
*
|
|
87
|
+
* @param name The strategy name
|
|
88
|
+
* @returns The authentication strategy or undefined
|
|
89
|
+
*/
|
|
90
|
+
getStrategy(name) {
|
|
91
|
+
return this.strategies[name];
|
|
88
92
|
}
|
|
89
93
|
/**
|
|
90
94
|
* Create a new access token with payload and options.
|
|
@@ -93,19 +97,17 @@ class AuthenticationBase {
|
|
|
93
97
|
* @param optsOverride The options to extend the defaults (`configuration.jwtOptions`) with
|
|
94
98
|
* @param secretOverride Use a different secret instead
|
|
95
99
|
*/
|
|
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
|
-
});
|
|
100
|
+
async createAccessToken(payload, optsOverride, secretOverride) {
|
|
101
|
+
const { secret, jwtOptions } = this.configuration;
|
|
102
|
+
// Use configuration by default but allow overriding the secret
|
|
103
|
+
const jwtSecret = secretOverride || secret;
|
|
104
|
+
// Default jwt options merged with additional options
|
|
105
|
+
const options = (0, merge_1.default)({}, jwtOptions, optsOverride);
|
|
106
|
+
if (!options.jwtid) {
|
|
107
|
+
// Generate a UUID as JWT ID by default
|
|
108
|
+
options.jwtid = (0, uuid_1.v4)();
|
|
109
|
+
}
|
|
110
|
+
return jsonwebtoken_1.default.sign(payload, jwtSecret, options);
|
|
109
111
|
}
|
|
110
112
|
/**
|
|
111
113
|
* Verifies an access token.
|
|
@@ -114,25 +116,23 @@ class AuthenticationBase {
|
|
|
114
116
|
* @param optsOverride The options to extend the defaults (`configuration.jwtOptions`) with
|
|
115
117
|
* @param secretOverride Use a different secret instead
|
|
116
118
|
*/
|
|
117
|
-
verifyAccessToken(accessToken, optsOverride, secretOverride) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
});
|
|
119
|
+
async verifyAccessToken(accessToken, optsOverride, secretOverride) {
|
|
120
|
+
const { secret, jwtOptions } = this.configuration;
|
|
121
|
+
const jwtSecret = secretOverride || secret;
|
|
122
|
+
const options = (0, merge_1.default)({}, jwtOptions, optsOverride);
|
|
123
|
+
const { algorithm } = options;
|
|
124
|
+
// Normalize the `algorithm` setting into the algorithms array
|
|
125
|
+
if (algorithm && !options.algorithms) {
|
|
126
|
+
options.algorithms = (Array.isArray(algorithm) ? algorithm : [algorithm]);
|
|
127
|
+
delete options.algorithm;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const verified = jsonwebtoken_1.default.verify(accessToken, jwtSecret, options);
|
|
131
|
+
return verified;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
throw new errors_1.NotAuthenticated(error.message, error);
|
|
135
|
+
}
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* Authenticate a given authentication request against a list of strategies.
|
|
@@ -141,29 +141,28 @@ class AuthenticationBase {
|
|
|
141
141
|
* @param params Service call parameters
|
|
142
142
|
* @param allowed A list of allowed strategy names
|
|
143
143
|
*/
|
|
144
|
-
authenticate(authentication, params, ...allowed) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
144
|
+
async authenticate(authentication, params, ...allowed) {
|
|
145
|
+
const { strategy } = authentication || {};
|
|
146
|
+
const [authStrategy] = this.getStrategies(strategy);
|
|
147
|
+
const strategyAllowed = allowed.includes(strategy);
|
|
148
|
+
debug('Running authenticate for strategy', strategy, allowed);
|
|
149
|
+
if (!authentication || !authStrategy || !strategyAllowed) {
|
|
150
|
+
const additionalInfo = (!strategy && ' (no `strategy` set)') ||
|
|
151
|
+
(!strategyAllowed && ' (strategy not allowed in authStrategies)') ||
|
|
152
|
+
'';
|
|
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
|
-
yield strategy.handleConnection(event, connection, authResult);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
161
|
+
async handleConnection(event, connection, authResult) {
|
|
162
|
+
const strategies = this.getStrategies(...Object.keys(this.strategies)).filter((current) => typeof current.handleConnection === 'function');
|
|
163
|
+
for (const strategy of strategies) {
|
|
164
|
+
await strategy.handleConnection(event, connection, authResult);
|
|
165
|
+
}
|
|
167
166
|
}
|
|
168
167
|
/**
|
|
169
168
|
* Parse an HTTP request and response for authentication request information.
|
|
@@ -172,19 +171,24 @@ class AuthenticationBase {
|
|
|
172
171
|
* @param res The HTTP response
|
|
173
172
|
* @param names A list of strategies to use
|
|
174
173
|
*/
|
|
175
|
-
parse(req, res, ...names) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (value !== null) {
|
|
183
|
-
return value;
|
|
184
|
-
}
|
|
174
|
+
async parse(req, res, ...names) {
|
|
175
|
+
const strategies = this.getStrategies(...names).filter((current) => typeof current.parse === 'function');
|
|
176
|
+
debug('Strategies parsing HTTP header for authentication information', names);
|
|
177
|
+
for (const authStrategy of strategies) {
|
|
178
|
+
const value = await authStrategy.parse(req, res);
|
|
179
|
+
if (value !== null) {
|
|
180
|
+
return value;
|
|
185
181
|
}
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
async setup() {
|
|
186
|
+
var _a;
|
|
187
|
+
this.isReady = true;
|
|
188
|
+
for (const name of Object.keys(this.strategies)) {
|
|
189
|
+
const strategy = this.strategies[name];
|
|
190
|
+
await ((_a = strategy.setup) === null || _a === void 0 ? void 0 : _a.call(strategy, this, name));
|
|
191
|
+
}
|
|
188
192
|
}
|
|
189
193
|
}
|
|
190
194
|
exports.AuthenticationBase = AuthenticationBase;
|
package/lib/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAgC;AAChC,gEAA0F;AAC1F,+BAAmC;AACnC,+CAAqD;AACrD,iDAAiD;AAGjD,uCAAuE;AAEvE,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,iCAAiC,CAAC,CAAA;AAkF5D;;GAEG;AACH,MAAa,kBAAkB;IAM7B;;;;;;OAMG;IACH,YAAY,GAAg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AE,GAAG,CAAC,CAAA;YAEhD,IAAI,KAAK,KAAK,IAAI,EAAE;gBAClB,OAAO,KAAK,CAAA;aACb;SACF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,KAAK;;QACT,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QAEnB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;YAEtC,MAAM,CAAA,MAAA,QAAQ,CAAC,KAAK,yDAAG,IAAI,EAAE,IAAI,CAAC,CAAA,CAAA;SACnC;IACH,CAAC;CACF;AA/ND,gDA+NC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
};
|
|
@@ -16,28 +7,27 @@ 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
9
|
const commons_1 = require("@feathersjs/commons");
|
|
19
|
-
const debug = commons_1.createDebug('@feathersjs/authentication/hooks/authenticate');
|
|
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, _next) =>
|
|
28
|
-
const next = typeof _next === 'function' ? _next : () =>
|
|
18
|
+
return async (context, _next) => {
|
|
19
|
+
const next = typeof _next === 'function' ? _next : async () => context;
|
|
29
20
|
const { app, params, type, path, service } = context;
|
|
30
21
|
const { strategies } = settings;
|
|
31
22
|
const { provider, authentication } = params;
|
|
32
23
|
const authService = app.defaultAuthentication(settings.service);
|
|
33
24
|
debug(`Running authenticate hook on '${path}'`);
|
|
34
|
-
if (type && type !== 'before') {
|
|
25
|
+
if (type && type !== 'before' && type !== 'around') {
|
|
35
26
|
throw new errors_1.NotAuthenticated('The authenticate hook must be used as a before hook');
|
|
36
27
|
}
|
|
37
28
|
if (!authService || typeof authService.authenticate !== 'function') {
|
|
38
29
|
throw new errors_1.NotAuthenticated('Could not find a valid authentication service');
|
|
39
30
|
}
|
|
40
|
-
// @ts-ignore
|
|
41
31
|
if (service === authService) {
|
|
42
32
|
throw new errors_1.NotAuthenticated('The authenticate hook does not need to be used on the authentication service');
|
|
43
33
|
}
|
|
@@ -45,15 +35,17 @@ exports.default = (originalSettings, ...originalStrategies) => {
|
|
|
45
35
|
return next();
|
|
46
36
|
}
|
|
47
37
|
if (authentication) {
|
|
48
|
-
const authParams = omit_1.default(params, 'provider', 'authentication');
|
|
38
|
+
const authParams = (0, omit_1.default)(params, 'provider', 'authentication');
|
|
49
39
|
debug('Authenticating with', authentication, strategies);
|
|
50
|
-
const authResult =
|
|
51
|
-
context.params = Object.assign({}, params, omit_1.default(authResult, 'accessToken'), {
|
|
40
|
+
const authResult = await authService.authenticate(authentication, authParams, ...strategies);
|
|
41
|
+
context.params = Object.assign({}, params, (0, omit_1.default)(authResult, 'accessToken'), {
|
|
42
|
+
authenticated: true
|
|
43
|
+
});
|
|
52
44
|
}
|
|
53
45
|
else if (provider) {
|
|
54
46
|
throw new errors_1.NotAuthenticated('Not authenticated');
|
|
55
47
|
}
|
|
56
48
|
return next();
|
|
57
|
-
}
|
|
49
|
+
};
|
|
58
50
|
};
|
|
59
51
|
//# 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,6DAAoC;AACpC,uDAA8B;AAE9B,+CAAqD;AACrD,iDAAiD;AAEjD,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,+CAA+C,CAAC,CAAA;AAO1E,kBAAe,CAAC,gBAAmD,EAAE,GAAG,kBAA4B,EAAE,EAAE;IACtG,MAAM,QAAQ,GACZ,OAAO,gBAAgB,KAAK,QAAQ;QAClC,CAAC,CAAC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;QAED,IAAI,cAAc,EAAE;YAClB,MAAM,UAAU,GAAG,IAAA,cAAI,EAAC,MAAM,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAA;YAE7D,KAAK,CAAC,qBAAqB,EAAE,cAAc,EAAE,UAAU,CAAC,CAAA;YAExD,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,cAAc,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,CAAA;YAE5F,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,cAAI,EAAC,UAAU,EAAE,aAAa,CAAC,EAAE;gBAC1E,aAAa,EAAE,IAAI;aACpB,CAAC,CAAA;SACH;aAAM,IAAI,QAAQ,EAAE;YACnB,MAAM,IAAI,yBAAgB,CAAC,mBAAmB,CAAC,CAAA;SAChD;QAED,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC,CAAA"}
|
package/lib/hooks/connection.js
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
yield next();
|
|
3
|
+
exports.default = (event) => async (context, next) => {
|
|
4
|
+
await next();
|
|
18
5
|
const { result, params: { connection } } = context;
|
|
19
6
|
if (connection) {
|
|
20
7
|
const service = context.service;
|
|
21
|
-
|
|
22
|
-
yield service.handleConnection(event, connection, result);
|
|
8
|
+
await service.handleConnection(event, connection, result);
|
|
23
9
|
}
|
|
24
|
-
}
|
|
10
|
+
};
|
|
25
11
|
//# sourceMappingURL=connection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/hooks/connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/hooks/connection.ts"],"names":[],"mappings":";;AAGA,kBAAe,CAAC,KAAsB,EAAE,EAAE,CAAC,KAAK,EAAE,OAAoB,EAAE,IAAkB,EAAE,EAAE;IAC5F,MAAM,IAAI,EAAE,CAAA;IAEZ,MAAM,EACJ,MAAM,EACN,MAAM,EAAE,EAAE,UAAU,EAAE,EACvB,GAAG,OAAO,CAAA;IAEX,IAAI,UAAU,EAAE;QACd,MAAM,OAAO,GAAG,OAAO,CAAC,OAAwC,CAAA;QAEhE,MAAM,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;KAC1D;AACH,CAAC,CAAA"}
|
package/lib/hooks/event.js
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const commons_1 = require("@feathersjs/commons");
|
|
13
|
-
const debug = commons_1.createDebug('@feathersjs/authentication/hooks/connection');
|
|
14
|
-
exports.default = (event) => (context, next) =>
|
|
15
|
-
|
|
4
|
+
const debug = (0, commons_1.createDebug)('@feathersjs/authentication/hooks/connection');
|
|
5
|
+
exports.default = (event) => async (context, next) => {
|
|
6
|
+
await next();
|
|
16
7
|
const { app, result, params } = context;
|
|
17
8
|
if (params.provider && result) {
|
|
18
9
|
debug(`Sending authentication event '${event}'`);
|
|
19
10
|
app.emit(event, result, params, context);
|
|
20
11
|
}
|
|
21
|
-
}
|
|
12
|
+
};
|
|
22
13
|
//# sourceMappingURL=event.js.map
|
package/lib/hooks/event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../src/hooks/event.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../src/hooks/event.ts"],"names":[],"mappings":";;AACA,iDAAiD;AAGjD,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,6CAA6C,CAAC,CAAA;AAExE,kBAAe,CAAC,KAAsB,EAAE,EAAE,CAAC,KAAK,EAAE,OAAoB,EAAE,IAAkB,EAAE,EAAE;IAC5F,MAAM,IAAI,EAAE,CAAA;IAEZ,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAEvC,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,EAAE;QAC7B,KAAK,CAAC,iCAAiC,KAAK,GAAG,CAAC,CAAA;QAChD,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;KACzC;AACH,CAAC,CAAA"}
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAwD;AAA/C,6HAAA,OAAO,OAAgB;AAChC,2CAAoD;AAA3C,yHAAA,OAAO,OAAc;AAC9B,iCAA0C;AAAjC,+GAAA,OAAO,OAAS"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export { authenticate };
|
|
5
|
-
export { AuthenticationBase, AuthenticationRequest, AuthenticationResult, AuthenticationStrategy, ConnectionEvent } from './core';
|
|
1
|
+
export * as hooks from './hooks';
|
|
2
|
+
export { authenticate } from './hooks';
|
|
3
|
+
export { AuthenticationBase, AuthenticationRequest, AuthenticationResult, AuthenticationStrategy, AuthenticationParams, ConnectionEvent } from './core';
|
|
6
4
|
export { AuthenticationBaseStrategy } from './strategy';
|
|
7
5
|
export { AuthenticationService } from './service';
|
|
8
6
|
export { JWTStrategy } from './jwt';
|
|
7
|
+
export { authenticationSettingsSchema, AuthenticationConfiguration } from './options';
|
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];
|
|
@@ -19,11 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.JWTStrategy = exports.AuthenticationService = exports.AuthenticationBaseStrategy = exports.AuthenticationBase = exports.authenticate = exports.hooks = void 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
exports.authenticate = authenticate;
|
|
26
|
+
exports.authenticationSettingsSchema = exports.JWTStrategy = exports.AuthenticationService = exports.AuthenticationBaseStrategy = exports.AuthenticationBase = exports.authenticate = exports.hooks = void 0;
|
|
27
|
+
exports.hooks = __importStar(require("./hooks"));
|
|
28
|
+
var hooks_1 = require("./hooks");
|
|
29
|
+
Object.defineProperty(exports, "authenticate", { enumerable: true, get: function () { return hooks_1.authenticate; } });
|
|
27
30
|
var core_1 = require("./core");
|
|
28
31
|
Object.defineProperty(exports, "AuthenticationBase", { enumerable: true, get: function () { return core_1.AuthenticationBase; } });
|
|
29
32
|
var strategy_1 = require("./strategy");
|
|
@@ -32,4 +35,6 @@ var service_1 = require("./service");
|
|
|
32
35
|
Object.defineProperty(exports, "AuthenticationService", { enumerable: true, get: function () { return service_1.AuthenticationService; } });
|
|
33
36
|
var jwt_1 = require("./jwt");
|
|
34
37
|
Object.defineProperty(exports, "JWTStrategy", { enumerable: true, get: function () { return jwt_1.JWTStrategy; } });
|
|
38
|
+
var options_1 = require("./options");
|
|
39
|
+
Object.defineProperty(exports, "authenticationSettingsSchema", { enumerable: true, get: function () { return options_1.authenticationSettingsSchema; } });
|
|
35
40
|
//# sourceMappingURL=index.js.map
|