@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/lib/service.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
  };
@@ -15,19 +6,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
6
  exports.AuthenticationService = void 0;
16
7
  const merge_1 = __importDefault(require("lodash/merge"));
17
8
  const errors_1 = require("@feathersjs/errors");
18
- const core_1 = require("./core");
19
- const hooks_1 = require("./hooks");
20
9
  require("@feathersjs/transport-commons");
21
10
  const commons_1 = require("@feathersjs/commons");
11
+ const schema_1 = require("@feathersjs/schema");
22
12
  const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
23
- const debug = commons_1.createDebug('@feathersjs/authentication/service');
13
+ const hooks_1 = require("@feathersjs/hooks");
14
+ const core_1 = require("./core");
15
+ const hooks_2 = require("./hooks");
16
+ const debug = (0, commons_1.createDebug)('@feathersjs/authentication/service');
24
17
  class AuthenticationService extends core_1.AuthenticationBase {
25
18
  constructor(app, configKey = 'authentication', options = {}) {
26
19
  super(app, configKey, options);
20
+ (0, hooks_1.hooks)(this, {
21
+ create: [(0, schema_1.resolveDispatch)(), (0, hooks_2.event)('login'), (0, hooks_2.connection)('login')],
22
+ remove: [(0, schema_1.resolveDispatch)(), (0, hooks_2.event)('logout'), (0, hooks_2.connection)('logout')]
23
+ });
24
+ this.app.on('disconnect', async (connection) => {
25
+ await this.handleConnection('disconnect', connection);
26
+ });
27
27
  if (typeof app.defaultAuthentication !== 'function') {
28
28
  app.defaultAuthentication = function (location) {
29
29
  const configKey = app.get('defaultAuthentication');
30
- const path = location || Object.keys(this.services).find(current => this.service(current).configKey === configKey);
30
+ const path = location ||
31
+ Object.keys(this.services).find((current) => this.service(current).configKey === configKey);
31
32
  return path ? this.service(path) : null;
32
33
  };
33
34
  }
@@ -39,12 +40,10 @@ class AuthenticationService extends core_1.AuthenticationBase {
39
40
  * @param _authResult The current authentication result
40
41
  * @param params The service call parameters
41
42
  */
42
- getPayload(_authResult, params) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- // Uses `params.payload` or returns an empty payload
45
- const { payload = {} } = params;
46
- return payload;
47
- });
43
+ async getPayload(_authResult, params) {
44
+ // Uses `params.payload` or returns an empty payload
45
+ const { payload = {} } = params;
46
+ return payload;
48
47
  }
49
48
  /**
50
49
  * Returns the JWT options based on an authentication result.
@@ -53,22 +52,20 @@ class AuthenticationService extends core_1.AuthenticationBase {
53
52
  * @param authResult The authentication result
54
53
  * @param params Service call parameters
55
54
  */
56
- getTokenOptions(authResult, params) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- const { service, entity, entityId } = this.configuration;
59
- const jwtOptions = merge_1.default({}, params.jwtOptions, params.jwt);
60
- const value = service && entity && authResult[entity];
61
- // Set the subject to the entity id if it is available
62
- if (value && !jwtOptions.subject) {
63
- const idProperty = entityId || this.app.service(service).id;
64
- const subject = value[idProperty];
65
- if (subject === undefined) {
66
- throw new errors_1.NotAuthenticated(`Can not set subject from ${entity}.${idProperty}`);
67
- }
68
- jwtOptions.subject = `${subject}`;
55
+ async getTokenOptions(authResult, params) {
56
+ const { service, entity, entityId } = this.configuration;
57
+ const jwtOptions = (0, merge_1.default)({}, params.jwtOptions, params.jwt);
58
+ const value = service && entity && authResult[entity];
59
+ // Set the subject to the entity id if it is available
60
+ if (value && !jwtOptions.subject) {
61
+ const idProperty = entityId || this.app.service(service).id;
62
+ const subject = value[idProperty];
63
+ if (subject === undefined) {
64
+ throw new errors_1.NotAuthenticated(`Can not set subject from ${entity}.${idProperty}`);
69
65
  }
70
- return jwtOptions;
71
- });
66
+ jwtOptions.subject = `${subject}`;
67
+ }
68
+ return jwtOptions;
72
69
  }
73
70
  /**
74
71
  * Create and return a new JWT for a given authentication request.
@@ -77,30 +74,30 @@ class AuthenticationService extends core_1.AuthenticationBase {
77
74
  * @param data The authentication request (should include `strategy` key)
78
75
  * @param params Service call parameters
79
76
  */
80
- create(data, params) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- const authStrategies = params.authStrategies || this.configuration.authStrategies;
83
- if (!authStrategies.length) {
84
- throw new errors_1.NotAuthenticated('No authentication strategies allowed for creating a JWT (`authStrategies`)');
85
- }
86
- const authResult = yield this.authenticate(data, params, ...authStrategies);
87
- debug('Got authentication result', authResult);
88
- if (authResult.accessToken) {
89
- return authResult;
77
+ async create(data, params) {
78
+ const authStrategies = params.authStrategies || this.configuration.authStrategies;
79
+ if (!authStrategies.length) {
80
+ throw new errors_1.NotAuthenticated('No authentication strategies allowed for creating a JWT (`authStrategies`)');
81
+ }
82
+ const authResult = await this.authenticate(data, params, ...authStrategies);
83
+ debug('Got authentication result', authResult);
84
+ if (authResult.accessToken) {
85
+ return authResult;
86
+ }
87
+ const [payload, jwtOptions] = await Promise.all([
88
+ this.getPayload(authResult, params),
89
+ this.getTokenOptions(authResult, params)
90
+ ]);
91
+ debug('Creating JWT with', payload, jwtOptions);
92
+ const accessToken = await this.createAccessToken(payload, jwtOptions, params.secret);
93
+ return {
94
+ accessToken,
95
+ ...authResult,
96
+ authentication: {
97
+ ...authResult.authentication,
98
+ payload: jsonwebtoken_1.default.decode(accessToken)
90
99
  }
91
- const [payload, jwtOptions] = yield Promise.all([
92
- this.getPayload(authResult, params),
93
- this.getTokenOptions(authResult, params)
94
- ]);
95
- debug('Creating JWT with', payload, jwtOptions);
96
- const accessToken = yield this.createAccessToken(payload, jwtOptions, params.secret);
97
- return merge_1.default({ accessToken }, authResult, {
98
- authentication: {
99
- accessToken,
100
- payload: jsonwebtoken_1.default.decode(accessToken)
101
- }
102
- });
103
- });
100
+ };
104
101
  }
105
102
  /**
106
103
  * Mark a JWT as removed. By default only verifies the JWT and returns the result.
@@ -109,51 +106,41 @@ class AuthenticationService extends core_1.AuthenticationBase {
109
106
  * @param id The JWT to remove or null
110
107
  * @param params Service call parameters
111
108
  */
112
- remove(id, params) {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- const { authentication } = params;
115
- const { authStrategies } = this.configuration;
116
- // When an id is passed it is expected to be the authentication `accessToken`
117
- if (id !== null && id !== authentication.accessToken) {
118
- throw new errors_1.NotAuthenticated('Invalid access token');
119
- }
120
- debug('Verifying authentication strategy in remove');
121
- return this.authenticate(authentication, params, ...authStrategies);
122
- });
109
+ async remove(id, params) {
110
+ const { authentication } = params;
111
+ const { authStrategies } = this.configuration;
112
+ // When an id is passed it is expected to be the authentication `accessToken`
113
+ if (id !== null && id !== authentication.accessToken) {
114
+ throw new errors_1.NotAuthenticated('Invalid access token');
115
+ }
116
+ debug('Verifying authentication strategy in remove');
117
+ return this.authenticate(authentication, params, ...authStrategies);
123
118
  }
124
119
  /**
125
120
  * Validates the service configuration.
126
121
  */
127
- setup() {
128
- return __awaiter(this, void 0, void 0, function* () {
129
- // The setup method checks for valid settings and registers the
130
- // connection and event (login, logout) hooks
131
- const { secret, service, entity, entityId } = this.configuration;
132
- if (typeof secret !== 'string') {
133
- throw new Error('A \'secret\' must be provided in your authentication configuration');
122
+ async setup() {
123
+ await super.setup();
124
+ // The setup method checks for valid settings and registers the
125
+ // connection and event (login, logout) hooks
126
+ const { secret, service, entity, entityId } = this.configuration;
127
+ if (typeof secret !== 'string') {
128
+ throw new Error("A 'secret' must be provided in your authentication configuration");
129
+ }
130
+ if (entity !== null) {
131
+ if (service === undefined) {
132
+ throw new Error("The 'service' option is not set in the authentication configuration");
134
133
  }
135
- if (entity !== null) {
136
- if (service === undefined) {
137
- throw new Error('The \'service\' option is not set in the authentication configuration');
138
- }
139
- if (this.app.service(service) === undefined) {
140
- throw new Error(`The '${service}' entity service does not exist (set to 'null' if it is not required)`);
141
- }
142
- if (this.app.service(service).id === undefined && entityId === undefined) {
143
- throw new Error(`The '${service}' service does not have an 'id' property and no 'entityId' option is set.`);
144
- }
134
+ if (this.app.service(service) === undefined) {
135
+ throw new Error(`The '${service}' entity service does not exist (set to 'null' if it is not required)`);
145
136
  }
146
- this.hooks({
147
- create: [hooks_1.connection('login'), hooks_1.event('login')],
148
- remove: [hooks_1.connection('logout'), hooks_1.event('logout')]
149
- });
150
- this.app.on('disconnect', (connection) => __awaiter(this, void 0, void 0, function* () {
151
- yield this.handleConnection('disconnect', connection);
152
- }));
153
- if (typeof this.publish === 'function') {
154
- this.publish(() => null);
137
+ if (this.app.service(service).id === undefined && entityId === undefined) {
138
+ throw new Error(`The '${service}' service does not have an 'id' property and no 'entityId' option is set.`);
155
139
  }
156
- });
140
+ }
141
+ if (typeof this.publish === 'function') {
142
+ this.publish(() => null);
143
+ }
157
144
  }
158
145
  }
159
146
  exports.AuthenticationService = AuthenticationService;
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yDAAiC;AACjC,+CAAsD;AACtD,iCAAyF;AACzF,mCAA4C;AAC5C,yCAAuC;AACvC,iDAAkD;AAElD,gEAAwC;AAExC,MAAM,KAAK,GAAG,qBAAW,CAAC,oCAAoC,CAAC,CAAC;AAsBhE,MAAa,qBAAsB,SAAQ,yBAAkB;IAC3D,YAAa,GAAQ,EAAE,SAAS,GAAG,gBAAgB,EAAE,OAAO,GAAG,EAAE;QAC/D,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,OAA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OAAO,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE;gBAC3C,MAAM,IAAI,KAAK,CACb,QAAQ,OAAO,uEAAuE,CACvF,CAAA;aACF;YAED,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACxE,MAAM,IAAI,KAAK,CACb,QAAQ,OAAO,2EAA2E,CAC3F,CAAA;aACF;SACF;QAED,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE;YACtC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;SACzB;IACH,CAAC;CACF;AAtKD,sDAsKC"}
package/lib/strategy.d.ts CHANGED
@@ -8,5 +8,5 @@ export declare class AuthenticationBaseStrategy implements AuthenticationStrateg
8
8
  setApplication(app: Application): void;
9
9
  setName(name: string): void;
10
10
  get configuration(): any;
11
- get entityService(): Service<any>;
11
+ get entityService(): Service;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"strategy.js","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":";;;AAGA,MAAa,0BAA0B;IAKrC,iBAAiB,CAAE,IAAwB;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,cAAc,CAAE,GAAgB;QAC9B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,OAAO,CAAE,IAAY;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,aAAa;QACf,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QAEvC,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IAC3C,CAAC;CACF;AA9BD,gEA8BC"}
1
+ {"version":3,"file":"strategy.js","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":";;;AAGA,MAAa,0BAA0B;IAKrC,iBAAiB,CAAC,IAAwB;QACxC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;IAC5B,CAAC;IAED,cAAc,CAAC,GAAgB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrD,CAAC;IAED,IAAI,aAAa;QACf,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,aAAa,CAAA;QAEtC,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,IAAI,CAAA;SACZ;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,CAAA;IAC1C,CAAC;CACF;AA9BD,gEA8BC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@feathersjs/authentication",
3
3
  "description": "Add Authentication to your FeathersJS app.",
4
- "version": "5.0.0-pre.9",
4
+ "version": "5.0.0",
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"
20
21
  },
21
22
  "author": {
22
23
  "name": "Feathers contributors",
@@ -41,9 +42,9 @@
41
42
  },
42
43
  "scripts": {
43
44
  "prepublish": "npm run compile",
44
- "compile": "shx rm -rf lib/ && tsc",
45
- "test": "npm run compile && npm run mocha",
46
- "mocha": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
45
+ "pack": "npm pack --pack-destination ../generators/test/build",
46
+ "compile": "shx rm -rf lib/ && tsc && npm run pack",
47
+ "test": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
47
48
  },
48
49
  "directories": {
49
50
  "lib": "lib"
@@ -52,26 +53,28 @@
52
53
  "access": "public"
53
54
  },
54
55
  "dependencies": {
55
- "@feathersjs/commons": "^5.0.0-pre.9",
56
- "@feathersjs/errors": "^5.0.0-pre.9",
57
- "@feathersjs/feathers": "^5.0.0-pre.9",
58
- "@feathersjs/transport-commons": "^5.0.0-pre.9",
59
- "@types/jsonwebtoken": "^8.5.4",
60
- "jsonwebtoken": "^8.5.1",
56
+ "@feathersjs/commons": "^5.0.0",
57
+ "@feathersjs/errors": "^5.0.0",
58
+ "@feathersjs/feathers": "^5.0.0",
59
+ "@feathersjs/hooks": "^0.8.1",
60
+ "@feathersjs/schema": "^5.0.0",
61
+ "@feathersjs/transport-commons": "^5.0.0",
62
+ "@types/jsonwebtoken": "^9.0.1",
63
+ "jsonwebtoken": "^9.0.0",
61
64
  "lodash": "^4.17.21",
62
65
  "long-timeout": "^0.1.1",
63
- "uuid": "^8.3.2"
66
+ "uuid": "^9.0.0"
64
67
  },
65
68
  "devDependencies": {
66
- "@feathersjs/memory": "^5.0.0-pre.9",
67
- "@types/lodash": "^4.14.172",
68
- "@types/mocha": "^9.0.0",
69
- "@types/node": "^16.4.13",
70
- "@types/uuid": "^8.3.1",
71
- "mocha": "^9.0.3",
72
- "shx": "^0.3.3",
73
- "ts-node": "^10.1.0",
74
- "typescript": "^4.3.5"
69
+ "@feathersjs/memory": "^5.0.0",
70
+ "@types/lodash": "^4.14.191",
71
+ "@types/mocha": "^10.0.1",
72
+ "@types/node": "^18.14.1",
73
+ "@types/uuid": "^9.0.1",
74
+ "mocha": "^10.2.0",
75
+ "shx": "^0.3.4",
76
+ "ts-node": "^10.9.1",
77
+ "typescript": "^4.9.5"
75
78
  },
76
- "gitHead": "3d1721a7286e6a7f37bbc38695fe45084023f13b"
79
+ "gitHead": "90caf635aec850550b9d37bea2762af959d9e8d5"
77
80
  }