@thzero/library_server 0.14.1 → 0.14.2

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.
@@ -1,5 +1,4 @@
1
1
  import LibraryConstants from '../constants';
2
- import LibraryCommonConstants from '@thzero/library_common/constants';
3
2
  import LibraryCommonServiceConstants from '@thzero/library_common_service/constants';
4
3
 
5
4
  import injector from '@thzero/library_common/utility/injector';
@@ -37,7 +36,7 @@ const authentication = (required) => {
37
36
  const service = injector.getService(LibraryConstants.InjectorKeys.SERVICE_AUTH);
38
37
  const results = await service.verifyToken(ctx.correlationId, token);
39
38
  logger.debug('middleware', 'authentication', 'results', results, ctx.correlationId);
40
- if (this._hasFailed(results)) {
39
+ if (!results || !results.success) {
41
40
  logger.warn('middleware', 'authentication', 'Unauthenticated... invalid token', null, ctx.correlationId);
42
41
  ctx.throw(401);
43
42
  return;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@thzero/library_server",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "version_major": 0,
5
5
  "version_minor": 14,
6
- "version_patch": 1,
6
+ "version_patch": 2,
7
7
  "version_date": "10/02/2021",
8
8
  "description": "An opinionated library of common functionality to bootstrap a Koa based API application using MongoDb and Firebase.",
9
9
  "author": "thZero",
@@ -107,6 +107,14 @@ class Repository {
107
107
  return Response.error(clazz, method, message, err, code, errors, correlationId);
108
108
  }
109
109
 
110
+ _hasFailed(response) {
111
+ return Response.hasFailed(response);
112
+ }
113
+
114
+ _hasSucceeded(response) {
115
+ return Response.hasSucceeded(response);
116
+ }
117
+
110
118
  _initResponse(correlationId) {
111
119
  return new Response(correlationId);
112
120
  }