@feathersjs/authentication-client 5.0.0-pre.21 → 5.0.0-pre.24

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 CHANGED
@@ -3,6 +3,30 @@
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.24](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.23...v5.0.0-pre.24) (2022-06-21)
7
+
8
+ **Note:** Version bump only for package @feathersjs/authentication-client
9
+
10
+
11
+
12
+
13
+
14
+ # [5.0.0-pre.23](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.22...v5.0.0-pre.23) (2022-06-06)
15
+
16
+ **Note:** Version bump only for package @feathersjs/authentication-client
17
+
18
+
19
+
20
+
21
+
22
+ # [5.0.0-pre.22](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.21...v5.0.0-pre.22) (2022-05-24)
23
+
24
+ **Note:** Version bump only for package @feathersjs/authentication-client
25
+
26
+
27
+
28
+
29
+
6
30
  # [5.0.0-pre.21](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.20...v5.0.0-pre.21) (2022-05-23)
7
31
 
8
32
  **Note:** Version bump only for package @feathersjs/authentication-client
package/lib/core.js CHANGED
@@ -40,11 +40,11 @@ class AuthenticationClient {
40
40
  const connected = this.app.io ? 'connect' : 'open';
41
41
  const disconnected = this.app.io ? 'disconnect' : 'disconnection';
42
42
  socket.on(disconnected, () => {
43
- const authPromise = new Promise(resolve => socket.once(connected, (data) => resolve(data)))
43
+ const authPromise = new Promise((resolve) => socket.once(connected, (data) => resolve(data)))
44
44
  // Only reconnect when `reAuthenticate()` or `authenticate()`
45
45
  // has been called explicitly first
46
46
  // Force reauthentication with the server
47
- .then(() => this.authenticated ? this.reAuthenticate(true) : null);
47
+ .then(() => (this.authenticated ? this.reAuthenticate(true) : null));
48
48
  this.app.set('authentication', authPromise);
49
49
  });
50
50
  }
@@ -65,8 +65,7 @@ class AuthenticationClient {
65
65
  return this.storage.setItem(this.options.storageKey, accessToken);
66
66
  }
67
67
  getAccessToken() {
68
- return this.storage.getItem(this.options.storageKey)
69
- .then((accessToken) => {
68
+ return this.storage.getItem(this.options.storageKey).then((accessToken) => {
70
69
  if (!accessToken && typeof window !== 'undefined' && window.location) {
71
70
  return this.getFromLocation(window.location);
72
71
  }
@@ -93,7 +92,7 @@ class AuthenticationClient {
93
92
  // tries to re-authenticate with the stored JWT and strategy
94
93
  const authPromise = this.app.get('authentication');
95
94
  if (!authPromise || force === true) {
96
- return this.getAccessToken().then(accessToken => {
95
+ return this.getAccessToken().then((accessToken) => {
97
96
  if (!accessToken) {
98
97
  throw new errors_1.NotAuthenticated('No accessToken found in storage');
99
98
  }
@@ -109,21 +108,22 @@ class AuthenticationClient {
109
108
  if (!authentication) {
110
109
  return this.reAuthenticate();
111
110
  }
112
- const promise = this.service.create(authentication, params)
111
+ const promise = this.service
112
+ .create(authentication, params)
113
113
  .then((authResult) => {
114
114
  const { accessToken } = authResult;
115
115
  this.authenticated = true;
116
116
  this.app.emit('login', authResult);
117
117
  this.app.emit('authenticated', authResult);
118
118
  return this.setAccessToken(accessToken).then(() => authResult);
119
- }).catch((error) => this.handleError(error, 'authenticate'));
119
+ })
120
+ .catch((error) => this.handleError(error, 'authenticate'));
120
121
  this.app.set('authentication', promise);
121
122
  return promise;
122
123
  }
123
124
  logout() {
124
125
  return Promise.resolve(this.app.get('authentication'))
125
- .then(() => this.service.remove(null)
126
- .then((authResult) => this.removeAccessToken()
126
+ .then(() => this.service.remove(null).then((authResult) => this.removeAccessToken()
127
127
  .then(() => this.reset())
128
128
  .then(() => {
129
129
  this.app.emit('logout', authResult);
package/lib/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;AAAA,+CAAqE;AAGrE,uCAAoD;AAEpD,MAAM,UAA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aACxB,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;YAEnC,OAAO,UAAU,CAAA;QACnB,CAAC,CAAC,CACL,CACF;aACA,KAAK,CAAC,CAAC,KAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;IACvE,CAAC;CACF;AA7JD,oDA6JC"}
@@ -8,11 +8,13 @@ const authentication = () => {
8
8
  if ((0, commons_1.stripSlashes)(service.options.path) === path && method === 'create') {
9
9
  return next();
10
10
  }
11
- return Promise.resolve(app.get('authentication')).then(authResult => {
11
+ return Promise.resolve(app.get('authentication'))
12
+ .then((authResult) => {
12
13
  if (authResult) {
13
14
  context.params = Object.assign({}, authResult, params);
14
15
  }
15
- }).then(next);
16
+ })
17
+ .then(next);
16
18
  };
17
19
  };
18
20
  exports.authentication = authentication;
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/hooks/authentication.ts"],"names":[],"mappings":";;;AACA,iDAAmD;AAE5C,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CAAC,OAAoB,EAAE,IAAkB,EAAE,EAAE;QAClD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,CAAC;QAEhF,IAAI,IAAA,sBAAY,EAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,KAAK,QAAQ,EAAE;YACtE,OAAO,IAAI,EAAE,CAAC;SACf;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAClE,IAAI,UAAU,EAAE;gBACd,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;aACxD;QACH,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,cAAc,kBAczB"}
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/hooks/authentication.ts"],"names":[],"mappings":";;;AACA,iDAAkD;AAE3C,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CAAC,OAAoB,EAAE,IAAkB,EAAE,EAAE;QAClD,MAAM,EACJ,GAAG,EACH,MAAM,EACN,IAAI,EACJ,MAAM,EACN,GAAG,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,EACjC,GAAG,OAAO,CAAA;QAEX,IAAI,IAAA,sBAAY,EAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,KAAK,QAAQ,EAAE;YACtE,OAAO,IAAI,EAAE,CAAA;SACd;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;aAC9C,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YACnB,IAAI,UAAU,EAAE;gBACd,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;aACvD;QACH,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAA;IACf,CAAC,CAAA;AACH,CAAC,CAAA;AAtBY,QAAA,cAAc,kBAsB1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AACvB,qDAAkD;AAAzC,iHAAA,cAAc,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"populate-header.js","sourceRoot":"","sources":["../../src/hooks/populate-header.ts"],"names":[],"mappings":";;;AAEO,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CAAC,OAAoB,EAAE,IAAkB,EAAE,EAAE;QAClD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC;QACjD,MAAM,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC;QAE1C,+BAA+B;QAC/B,IAAI,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE;YAC3B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC;YAClD,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,WAAW,EAAE,CAAC;YAE9C,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE;gBACzC,CAAC,MAAM,CAAC,EAAE,UAAU;aACrB,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SAC5B;QAED,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,cAAc,kBAiBzB"}
1
+ {"version":3,"file":"populate-header.js","sourceRoot":"","sources":["../../src/hooks/populate-header.ts"],"names":[],"mappings":";;;AAEO,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CAAC,OAAoB,EAAE,IAAkB,EAAE,EAAE;QAClD,MAAM,EACJ,GAAG,EACH,MAAM,EAAE,EAAE,WAAW,EAAE,EACxB,GAAG,OAAO,CAAA;QACX,MAAM,cAAc,GAAG,GAAG,CAAC,cAAc,CAAA;QAEzC,+BAA+B;QAC/B,IAAI,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE;YAC3B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,CAAA;YACjD,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,WAAW,EAAE,CAAA;YAE7C,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CACpC,EAAE,EACF;gBACE,CAAC,MAAM,CAAC,EAAE,UAAU;aACrB,EACD,OAAO,CAAC,MAAM,CAAC,OAAO,CACvB,CAAA;SACF;QAED,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC,CAAA;AAxBY,QAAA,cAAc,kBAwB1B"}
package/lib/index.js CHANGED
@@ -59,10 +59,7 @@ const init = (_options = {}) => {
59
59
  app.authenticate = authentication.authenticate.bind(authentication);
60
60
  app.reAuthenticate = authentication.reAuthenticate.bind(authentication);
61
61
  app.logout = authentication.logout.bind(authentication);
62
- app.hooks([
63
- hooks.authentication(),
64
- hooks.populateHeader()
65
- ]);
62
+ app.hooks([hooks.authentication(), hooks.populateHeader()]);
66
63
  };
67
64
  };
68
65
  exports.default = init;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA2E;AAwBlE,qGAxBA,2BAAoB,OAwBA;AAvB7B,+CAAiC;AAuBmD,sBAAK;AArBzF,uCAAmE;AAqBE,8FArBnD,uBAAa,OAqBmD;AAR3E,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,IAAI;QACF,OAAO,IAAI,wBAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;KAChD;IAAC,OAAO,KAAU,EAAE,GAAE;IAEvB,OAAO,IAAI,uBAAa,EAAE,CAAC;AAC7B,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B;AAMW,QAAA,cAAc,GAAY,IAAA,yBAAiB,GAAE,CAAC;AAE9C,QA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,CAAA;QACvE,GAAG,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAEvD,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;IAC7D,CAAC,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,IAAI,CAAA;AAEnB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;CACrD"}
package/lib/storage.js CHANGED
@@ -9,7 +9,7 @@ class MemoryStorage {
9
9
  return Promise.resolve(this.store[key]);
10
10
  }
11
11
  setItem(key, value) {
12
- return Promise.resolve(this.store[key] = value);
12
+ return Promise.resolve((this.store[key] = value));
13
13
  }
14
14
  removeItem(key) {
15
15
  const value = this.store[key];
@@ -1 +1 @@
1
- {"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";;;AAMA,MAAa,aAAa;IAGxB;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,OAAO,CAAE,GAAW;QAClB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,CAAE,GAAW,EAAE,KAAU;QAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,UAAU,CAAE,GAAW;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEvB,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;I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c;IAGzB,YAAY,OAAY;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,OAAO,CAAC,GAAW;QACjB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,OAAO,CAAC,GAAW,EAAE,KAAU;QAC7B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;IAC1D,CAAC;IAED,UAAU,CAAC,GAAW;QACpB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;IACtD,CAAC;CACF;AAlBD,wCAkBC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@feathersjs/authentication-client",
3
3
  "description": "The authentication plugin for feathers-client",
4
- "version": "5.0.0-pre.21",
4
+ "version": "5.0.0-pre.24",
5
5
  "homepage": "https://feathersjs.com",
6
6
  "main": "lib/",
7
7
  "types": "lib/",
@@ -52,25 +52,25 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@feathersjs/authentication": "^5.0.0-pre.21",
56
- "@feathersjs/commons": "^5.0.0-pre.20",
57
- "@feathersjs/errors": "^5.0.0-pre.21",
58
- "@feathersjs/feathers": "^5.0.0-pre.21"
55
+ "@feathersjs/authentication": "^5.0.0-pre.24",
56
+ "@feathersjs/commons": "^5.0.0-pre.24",
57
+ "@feathersjs/errors": "^5.0.0-pre.24",
58
+ "@feathersjs/feathers": "^5.0.0-pre.24"
59
59
  },
60
60
  "devDependencies": {
61
- "@feathersjs/authentication-local": "^5.0.0-pre.21",
62
- "@feathersjs/express": "^5.0.0-pre.21",
63
- "@feathersjs/memory": "^5.0.0-pre.21",
64
- "@feathersjs/rest-client": "^5.0.0-pre.21",
65
- "@feathersjs/socketio": "^5.0.0-pre.21",
66
- "@feathersjs/socketio-client": "^5.0.0-pre.21",
61
+ "@feathersjs/authentication-local": "^5.0.0-pre.24",
62
+ "@feathersjs/express": "^5.0.0-pre.24",
63
+ "@feathersjs/memory": "^5.0.0-pre.24",
64
+ "@feathersjs/rest-client": "^5.0.0-pre.24",
65
+ "@feathersjs/socketio": "^5.0.0-pre.24",
66
+ "@feathersjs/socketio-client": "^5.0.0-pre.24",
67
67
  "@types/mocha": "^9.1.1",
68
- "@types/node": "^17.0.31",
68
+ "@types/node": "^17.0.40",
69
69
  "axios": "^0.27.2",
70
70
  "mocha": "^10.0.0",
71
71
  "shx": "^0.3.4",
72
- "ts-node": "^10.7.0",
73
- "typescript": "^4.6.4"
72
+ "ts-node": "^10.8.1",
73
+ "typescript": "^4.7.3"
74
74
  },
75
- "gitHead": "ac3baed231f72370a80a06c5944538915479b96e"
75
+ "gitHead": "72779fa2938f43d7b345b6861ff0035481a07de3"
76
76
  }
package/src/core.ts CHANGED
@@ -1,200 +1,199 @@
1
- import { NotAuthenticated, FeathersError } from '@feathersjs/errors';
2
- import { Application, Params } from '@feathersjs/feathers';
3
- import { AuthenticationRequest, AuthenticationResult } from '@feathersjs/authentication';
4
- import { Storage, StorageWrapper } from './storage';
1
+ import { NotAuthenticated, FeathersError } from '@feathersjs/errors'
2
+ import { Application, Params } from '@feathersjs/feathers'
3
+ import { AuthenticationRequest, AuthenticationResult } from '@feathersjs/authentication'
4
+ import { Storage, StorageWrapper } from './storage'
5
5
 
6
6
  class OauthError extends FeathersError {
7
- constructor (message: string, data?: any) {
8
- super(message, 'OauthError', 401, 'oauth-error', data);
7
+ constructor(message: string, data?: any) {
8
+ super(message, 'OauthError', 401, 'oauth-error', data)
9
9
  }
10
10
  }
11
11
 
12
- const getMatch = (location: Location, key: string): [ string, RegExp ] => {
13
- const regex = new RegExp(`(?:\&?)${key}=([^&]*)`);
14
- const match = location.hash ? location.hash.match(regex) : null;
12
+ const getMatch = (location: Location, key: string): [string, RegExp] => {
13
+ const regex = new RegExp(`(?:\&?)${key}=([^&]*)`)
14
+ const match = location.hash ? location.hash.match(regex) : null
15
15
 
16
16
  if (match !== null) {
17
- const [ , value ] = match;
17
+ const [, value] = match
18
18
 
19
- return [ value, regex ];
19
+ return [value, regex]
20
20
  }
21
21
 
22
- return [ null, regex ];
23
- };
22
+ return [null, regex]
23
+ }
24
24
 
25
- export type ClientConstructor = new (app: Application, options: AuthenticationClientOptions)
26
- => AuthenticationClient;
25
+ export type ClientConstructor = new (
26
+ app: Application,
27
+ options: AuthenticationClientOptions
28
+ ) => AuthenticationClient
27
29
 
28
30
  export interface AuthenticationClientOptions {
29
- storage: Storage;
30
- header: string;
31
- scheme: string;
32
- storageKey: string;
33
- locationKey: string;
34
- locationErrorKey: string;
35
- jwtStrategy: string;
36
- path: string;
37
- Authentication: ClientConstructor;
31
+ storage: Storage
32
+ header: string
33
+ scheme: string
34
+ storageKey: string
35
+ locationKey: string
36
+ locationErrorKey: string
37
+ jwtStrategy: string
38
+ path: string
39
+ Authentication: ClientConstructor
38
40
  }
39
41
 
40
42
  export class AuthenticationClient {
41
- app: Application;
42
- authenticated: boolean;
43
- options: AuthenticationClientOptions;
43
+ app: Application
44
+ authenticated: boolean
45
+ options: AuthenticationClientOptions
44
46
 
45
- constructor (app: Application, options: AuthenticationClientOptions) {
46
- const socket = app.io;
47
- const storage = new StorageWrapper(app.get('storage') || options.storage);
47
+ constructor(app: Application, options: AuthenticationClientOptions) {
48
+ const socket = app.io
49
+ const storage = new StorageWrapper(app.get('storage') || options.storage)
48
50
 
49
- this.app = app;
50
- this.options = options;
51
- this.authenticated = false;
52
- this.app.set('storage', storage);
51
+ this.app = app
52
+ this.options = options
53
+ this.authenticated = false
54
+ this.app.set('storage', storage)
53
55
 
54
56
  if (socket) {
55
- this.handleSocket(socket);
57
+ this.handleSocket(socket)
56
58
  }
57
59
  }
58
60
 
59
- get service () {
60
- return this.app.service(this.options.path);
61
+ get service() {
62
+ return this.app.service(this.options.path)
61
63
  }
62
64
 
63
- get storage () {
64
- return this.app.get('storage') as Storage;
65
+ get storage() {
66
+ return this.app.get('storage') as Storage
65
67
  }
66
68
 
67
- handleSocket (socket: any) {
69
+ handleSocket(socket: any) {
68
70
  // Connection events happen on every reconnect
69
- const connected = this.app.io ? 'connect' : 'open';
70
- const disconnected = this.app.io ? 'disconnect' : 'disconnection';
71
+ const connected = this.app.io ? 'connect' : 'open'
72
+ const disconnected = this.app.io ? 'disconnect' : 'disconnection'
71
73
 
72
74
  socket.on(disconnected, () => {
73
- const authPromise = new Promise(resolve =>
74
- socket.once(connected, (data: any) => resolve(data))
75
- )
76
- // Only reconnect when `reAuthenticate()` or `authenticate()`
77
- // has been called explicitly first
78
- // Force reauthentication with the server
79
- .then(() => this.authenticated ? this.reAuthenticate(true) : null);
80
-
81
- this.app.set('authentication', authPromise);
82
- });
75
+ const authPromise = new Promise((resolve) => socket.once(connected, (data: any) => resolve(data)))
76
+ // Only reconnect when `reAuthenticate()` or `authenticate()`
77
+ // has been called explicitly first
78
+ // Force reauthentication with the server
79
+ .then(() => (this.authenticated ? this.reAuthenticate(true) : null))
80
+
81
+ this.app.set('authentication', authPromise)
82
+ })
83
83
  }
84
84
 
85
- getFromLocation (location: Location) {
86
- const [ accessToken, tokenRegex ] = getMatch(location, this.options.locationKey);
85
+ getFromLocation(location: Location) {
86
+ const [accessToken, tokenRegex] = getMatch(location, this.options.locationKey)
87
87
 
88
88
  if (accessToken !== null) {
89
- location.hash = location.hash.replace(tokenRegex, '');
89
+ location.hash = location.hash.replace(tokenRegex, '')
90
90
 
91
- return Promise.resolve(accessToken);
91
+ return Promise.resolve(accessToken)
92
92
  }
93
93
 
94
- const [ message, errorRegex ] = getMatch(location, this.options.locationErrorKey);
94
+ const [message, errorRegex] = getMatch(location, this.options.locationErrorKey)
95
95
 
96
96
  if (message !== null) {
97
- location.hash = location.hash.replace(errorRegex, '');
97
+ location.hash = location.hash.replace(errorRegex, '')
98
98
 
99
- return Promise.reject(new OauthError(decodeURIComponent(message)));
99
+ return Promise.reject(new OauthError(decodeURIComponent(message)))
100
100
  }
101
101
 
102
- return Promise.resolve(null);
102
+ return Promise.resolve(null)
103
103
  }
104
104
 
105
- setAccessToken (accessToken: string) {
106
- return this.storage.setItem(this.options.storageKey, accessToken);
105
+ setAccessToken(accessToken: string) {
106
+ return this.storage.setItem(this.options.storageKey, accessToken)
107
107
  }
108
108
 
109
- getAccessToken (): Promise<string|null> {
110
- return this.storage.getItem(this.options.storageKey)
111
- .then((accessToken: string) => {
112
- if (!accessToken && typeof window !== 'undefined' && window.location) {
113
- return this.getFromLocation(window.location);
114
- }
109
+ getAccessToken(): Promise<string | null> {
110
+ return this.storage.getItem(this.options.storageKey).then((accessToken: string) => {
111
+ if (!accessToken && typeof window !== 'undefined' && window.location) {
112
+ return this.getFromLocation(window.location)
113
+ }
115
114
 
116
- return accessToken || null;
117
- });
115
+ return accessToken || null
116
+ })
118
117
  }
119
118
 
120
- removeAccessToken () {
121
- return this.storage.removeItem(this.options.storageKey);
119
+ removeAccessToken() {
120
+ return this.storage.removeItem(this.options.storageKey)
122
121
  }
123
122
 
124
- reset () {
125
- this.app.set('authentication', null);
126
- this.authenticated = false;
123
+ reset() {
124
+ this.app.set('authentication', null)
125
+ this.authenticated = false
127
126
 
128
- return Promise.resolve(null);
127
+ return Promise.resolve(null)
129
128
  }
130
129
 
131
- handleError (error: FeathersError, type: 'authenticate'|'logout') {
130
+ handleError(error: FeathersError, type: 'authenticate' | 'logout') {
132
131
  if (error.code === 401 || error.code === 403) {
133
- const promise = this.removeAccessToken().then(() => this.reset());
132
+ const promise = this.removeAccessToken().then(() => this.reset())
134
133
 
135
- return type === 'logout' ? promise : promise.then(() => Promise.reject(error));
134
+ return type === 'logout' ? promise : promise.then(() => Promise.reject(error))
136
135
  }
137
136
 
138
- return Promise.reject(error);
137
+ return Promise.reject(error)
139
138
  }
140
139
 
141
- reAuthenticate (force = false, strategy?: string): Promise<AuthenticationResult> {
140
+ reAuthenticate(force = false, strategy?: string): Promise<AuthenticationResult> {
142
141
  // Either returns the authentication state or
143
142
  // tries to re-authenticate with the stored JWT and strategy
144
- const authPromise = this.app.get('authentication');
143
+ const authPromise = this.app.get('authentication')
145
144
 
146
145
  if (!authPromise || force === true) {
147
- return this.getAccessToken().then(accessToken => {
146
+ return this.getAccessToken().then((accessToken) => {
148
147
  if (!accessToken) {
149
- throw new NotAuthenticated('No accessToken found in storage');
148
+ throw new NotAuthenticated('No accessToken found in storage')
150
149
  }
151
150
 
152
151
  return this.authenticate({
153
152
  strategy: strategy || this.options.jwtStrategy,
154
153
  accessToken
155
- });
156
- });
154
+ })
155
+ })
157
156
  }
158
157
 
159
- return authPromise;
158
+ return authPromise
160
159
  }
161
160
 
162
- authenticate (authentication?: AuthenticationRequest, params?: Params): Promise<AuthenticationResult> {
161
+ authenticate(authentication?: AuthenticationRequest, params?: Params): Promise<AuthenticationResult> {
163
162
  if (!authentication) {
164
- return this.reAuthenticate();
163
+ return this.reAuthenticate()
165
164
  }
166
165
 
167
- const promise = this.service.create(authentication, params)
166
+ const promise = this.service
167
+ .create(authentication, params)
168
168
  .then((authResult: AuthenticationResult) => {
169
- const { accessToken } = authResult;
169
+ const { accessToken } = authResult
170
170
 
171
- this.authenticated = true;
172
- this.app.emit('login', authResult);
173
- this.app.emit('authenticated', authResult);
171
+ this.authenticated = true
172
+ this.app.emit('login', authResult)
173
+ this.app.emit('authenticated', authResult)
174
174
 
175
- return this.setAccessToken(accessToken).then(() => authResult);
176
- }).catch((error: FeathersError) =>
177
- this.handleError(error, 'authenticate')
178
- );
175
+ return this.setAccessToken(accessToken).then(() => authResult)
176
+ })
177
+ .catch((error: FeathersError) => this.handleError(error, 'authenticate'))
179
178
 
180
- this.app.set('authentication', promise);
179
+ this.app.set('authentication', promise)
181
180
 
182
- return promise;
181
+ return promise
183
182
  }
184
183
 
185
- logout (): Promise<AuthenticationResult | null> {
184
+ logout(): Promise<AuthenticationResult | null> {
186
185
  return Promise.resolve(this.app.get('authentication'))
187
- .then(() => this.service.remove(null)
188
- .then((authResult: AuthenticationResult) => this.removeAccessToken()
189
- .then(() => this.reset())
190
- .then(() => {
191
- this.app.emit('logout', authResult);
192
-
193
- return authResult;
194
- })
195
- ))
196
- .catch((error: FeathersError) =>
197
- this.handleError(error, 'logout')
198
- );
186
+ .then(() =>
187
+ this.service.remove(null).then((authResult: AuthenticationResult) =>
188
+ this.removeAccessToken()
189
+ .then(() => this.reset())
190
+ .then(() => {
191
+ this.app.emit('logout', authResult)
192
+
193
+ return authResult
194
+ })
195
+ )
196
+ )
197
+ .catch((error: FeathersError) => this.handleError(error, 'logout'))
199
198
  }
200
199
  }
@@ -1,18 +1,26 @@
1
- import { HookContext, NextFunction } from '@feathersjs/feathers';
2
- import { stripSlashes } from '@feathersjs/commons';
1
+ import { HookContext, NextFunction } from '@feathersjs/feathers'
2
+ import { stripSlashes } from '@feathersjs/commons'
3
3
 
4
4
  export const authentication = () => {
5
5
  return (context: HookContext, next: NextFunction) => {
6
- const { app, params, path, method, app: { authentication: service } } = context;
6
+ const {
7
+ app,
8
+ params,
9
+ path,
10
+ method,
11
+ app: { authentication: service }
12
+ } = context
7
13
 
8
14
  if (stripSlashes(service.options.path) === path && method === 'create') {
9
- return next();
15
+ return next()
10
16
  }
11
17
 
12
- return Promise.resolve(app.get('authentication')).then(authResult => {
13
- if (authResult) {
14
- context.params = Object.assign({}, authResult, params);
15
- }
16
- }).then(next);
17
- };
18
- };
18
+ return Promise.resolve(app.get('authentication'))
19
+ .then((authResult) => {
20
+ if (authResult) {
21
+ context.params = Object.assign({}, authResult, params)
22
+ }
23
+ })
24
+ .then(next)
25
+ }
26
+ }
@@ -1,2 +1,2 @@
1
- export { authentication } from './authentication';
2
- export { populateHeader } from './populate-header';
1
+ export { authentication } from './authentication'
2
+ export { populateHeader } from './populate-header'
@@ -1,20 +1,27 @@
1
- import { HookContext, NextFunction } from '@feathersjs/feathers';
1
+ import { HookContext, NextFunction } from '@feathersjs/feathers'
2
2
 
3
3
  export const populateHeader = () => {
4
4
  return (context: HookContext, next: NextFunction) => {
5
- const { app, params: { accessToken } } = context;
6
- const authentication = app.authentication;
5
+ const {
6
+ app,
7
+ params: { accessToken }
8
+ } = context
9
+ const authentication = app.authentication
7
10
 
8
11
  // Set REST header if necessary
9
12
  if (app.rest && accessToken) {
10
- const { scheme, header } = authentication.options;
11
- const authHeader = `${scheme} ${accessToken}`;
13
+ const { scheme, header } = authentication.options
14
+ const authHeader = `${scheme} ${accessToken}`
12
15
 
13
- context.params.headers = Object.assign({}, {
14
- [header]: authHeader
15
- }, context.params.headers);
16
+ context.params.headers = Object.assign(
17
+ {},
18
+ {
19
+ [header]: authHeader
20
+ },
21
+ context.params.headers
22
+ )
16
23
  }
17
24
 
18
- return next();
19
- };
20
- };
25
+ return next()
26
+ }
27
+ }
package/src/index.ts CHANGED
@@ -1,32 +1,36 @@
1
- import { AuthenticationClient, AuthenticationClientOptions } from './core';
2
- import * as hooks from './hooks';
3
- import { Application } from '@feathersjs/feathers';
4
- import { Storage, MemoryStorage, StorageWrapper } from './storage';
1
+ import { AuthenticationClient, AuthenticationClientOptions } from './core'
2
+ import * as hooks from './hooks'
3
+ import { Application } from '@feathersjs/feathers'
4
+ import { Storage, MemoryStorage, StorageWrapper } from './storage'
5
5
 
6
6
  declare module '@feathersjs/feathers/lib/declarations' {
7
- interface Application<Services, Settings> { // eslint-disable-line
8
- io?: any;
9
- rest?: any;
10
- authentication: AuthenticationClient;
11
- authenticate: AuthenticationClient['authenticate'];
12
- reAuthenticate: AuthenticationClient['reAuthenticate'];
13
- logout: AuthenticationClient['logout'];
7
+ interface Application<Services, Settings> {
8
+ // eslint-disable-line
9
+ io?: any
10
+ rest?: any
11
+ authentication: AuthenticationClient
12
+ authenticate: AuthenticationClient['authenticate']
13
+ reAuthenticate: AuthenticationClient['reAuthenticate']
14
+ logout: AuthenticationClient['logout']
14
15
  }
15
16
  }
16
17
 
17
18
  export const getDefaultStorage = () => {
18
19
  try {
19
- return new StorageWrapper(window.localStorage);
20
+ return new StorageWrapper(window.localStorage)
20
21
  } catch (error: any) {}
21
22
 
22
- return new MemoryStorage();
23
- };
23
+ return new MemoryStorage()
24
+ }
24
25
 
25
- export { AuthenticationClient, AuthenticationClientOptions, Storage, MemoryStorage, hooks };
26
+ export { AuthenticationClient, AuthenticationClientOptions, Storage, MemoryStorage, hooks }
26
27
 
27
- export type ClientConstructor = new (app: Application, options: AuthenticationClientOptions) => AuthenticationClient;
28
+ export type ClientConstructor = new (
29
+ app: Application,
30
+ options: AuthenticationClientOptions
31
+ ) => AuthenticationClient
28
32
 
29
- export const defaultStorage: Storage = getDefaultStorage();
33
+ export const defaultStorage: Storage = getDefaultStorage()
30
34
 
31
35
  export const defaults: AuthenticationClientOptions = {
32
36
  header: 'Authorization',
@@ -38,29 +42,26 @@ export const defaults: AuthenticationClientOptions = {
38
42
  path: '/authentication',
39
43
  Authentication: AuthenticationClient,
40
44
  storage: defaultStorage
41
- };
45
+ }
42
46
 
43
47
  const init = (_options: Partial<AuthenticationClientOptions> = {}) => {
44
- const options: AuthenticationClientOptions = Object.assign({}, defaults, _options);
45
- const { Authentication } = options;
48
+ const options: AuthenticationClientOptions = Object.assign({}, defaults, _options)
49
+ const { Authentication } = options
46
50
 
47
51
  return (app: Application) => {
48
- const authentication = new Authentication(app, options);
52
+ const authentication = new Authentication(app, options)
49
53
 
50
- app.authentication = authentication;
51
- app.authenticate = authentication.authenticate.bind(authentication);
52
- app.reAuthenticate = authentication.reAuthenticate.bind(authentication);
53
- app.logout = authentication.logout.bind(authentication);
54
+ app.authentication = authentication
55
+ app.authenticate = authentication.authenticate.bind(authentication)
56
+ app.reAuthenticate = authentication.reAuthenticate.bind(authentication)
57
+ app.logout = authentication.logout.bind(authentication)
54
58
 
55
- app.hooks([
56
- hooks.authentication(),
57
- hooks.populateHeader()
58
- ]);
59
- };
60
- };
59
+ app.hooks([hooks.authentication(), hooks.populateHeader()])
60
+ }
61
+ }
61
62
 
62
- export default init;
63
+ export default init
63
64
 
64
65
  if (typeof module !== 'undefined') {
65
- module.exports = Object.assign(init, module.exports);
66
+ module.exports = Object.assign(init, module.exports)
66
67
  }
package/src/storage.ts CHANGED
@@ -1,49 +1,49 @@
1
1
  export interface Storage {
2
- getItem (key: string): any;
3
- setItem? (key: string, value: any): any;
4
- removeItem? (key: string): any;
2
+ getItem(key: string): any
3
+ setItem?(key: string, value: any): any
4
+ removeItem?(key: string): any
5
5
  }
6
6
 
7
7
  export class MemoryStorage implements Storage {
8
- store: { [key: string]: any };
8
+ store: { [key: string]: any }
9
9
 
10
- constructor () {
11
- this.store = {};
10
+ constructor() {
11
+ this.store = {}
12
12
  }
13
13
 
14
- getItem (key: string) {
15
- return Promise.resolve(this.store[key]);
14
+ getItem(key: string) {
15
+ return Promise.resolve(this.store[key])
16
16
  }
17
17
 
18
- setItem (key: string, value: any) {
19
- return Promise.resolve(this.store[key] = value);
18
+ setItem(key: string, value: any) {
19
+ return Promise.resolve((this.store[key] = value))
20
20
  }
21
21
 
22
- removeItem (key: string) {
23
- const value = this.store[key];
22
+ removeItem(key: string) {
23
+ const value = this.store[key]
24
24
 
25
- delete this.store[key];
25
+ delete this.store[key]
26
26
 
27
- return Promise.resolve(value);
27
+ return Promise.resolve(value)
28
28
  }
29
29
  }
30
30
 
31
31
  export class StorageWrapper implements Storage {
32
- storage: any;
32
+ storage: any
33
33
 
34
- constructor (storage: any) {
35
- this.storage = storage;
34
+ constructor(storage: any) {
35
+ this.storage = storage
36
36
  }
37
37
 
38
- getItem (key: string) {
39
- return Promise.resolve(this.storage.getItem(key));
38
+ getItem(key: string) {
39
+ return Promise.resolve(this.storage.getItem(key))
40
40
  }
41
41
 
42
- setItem (key: string, value: any) {
43
- return Promise.resolve(this.storage.setItem(key, value));
42
+ setItem(key: string, value: any) {
43
+ return Promise.resolve(this.storage.setItem(key, value))
44
44
  }
45
45
 
46
- removeItem (key: string) {
47
- return Promise.resolve(this.storage.removeItem(key));
46
+ removeItem(key: string) {
47
+ return Promise.resolve(this.storage.removeItem(key))
48
48
  }
49
49
  }