@kronos-integration/service-authenticator 4.1.6 → 4.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/service-authenticator",
3
- "version": "4.1.6",
3
+ "version": "4.1.8",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -30,8 +30,8 @@
30
30
  "lint:docs": "documentation lint ./src**/*.mjs"
31
31
  },
32
32
  "dependencies": {
33
- "@kronos-integration/endpoint": "^11.0.6",
34
- "@kronos-integration/service": "^15.2.0",
33
+ "@kronos-integration/endpoint": "^11.0.7",
34
+ "@kronos-integration/service": "^15.2.3",
35
35
  "jsonwebtoken": "^9.0.3"
36
36
  },
37
37
  "devDependencies": {
@@ -2,11 +2,11 @@ import { promisify } from "node:util";
2
2
  import jwt from "jsonwebtoken";
3
3
  import {
4
4
  prepareAttributesDefinitions,
5
- default_attribute,
6
5
  public_key_attribute,
7
6
  private_key_attribute,
8
7
  object_attribute,
9
- duration_ms_attribute
8
+ duration_ms_attribute,
9
+ string_attribute
10
10
  } from "pacc";
11
11
  import { Service } from "@kronos-integration/service";
12
12
 
@@ -20,7 +20,7 @@ export const verifyJWT = promisify(jwt.verify);
20
20
  * @property {number} expires_in seconds the access token is valid
21
21
  */
22
22
 
23
- const algorithm = { ...default_attribute, default: "RS256" };
23
+ const algorithm = { ...string_attribute, default: "RS256" };
24
24
 
25
25
  /**
26
26
  *
@@ -58,8 +58,8 @@ export class ServiceAuthenticator extends Service {
58
58
  claims: {
59
59
  ...object_attribute,
60
60
  attributes: {
61
- iss: default_attribute,
62
- aud: default_attribute
61
+ iss: string_attribute,
62
+ aud: string_attribute
63
63
  }
64
64
  },
65
65
  access_token: {
@@ -96,23 +96,9 @@ export class ServiceAuthenticator extends Service {
96
96
  };
97
97
  }
98
98
 
99
- /*
100
- _configure(config) {
101
- this.getCredentials().then(credentials => {
102
- // TODO automatically read credentials
103
- this.jwt ||= {};
104
-
105
- if (credentials["jwt.private"]) {
106
- this.jwt.private = credentials["jwt.private"];
107
- }
108
- if (credentials["jwt.public"]) {
109
- this.jwt.public = credentials["jwt.public"];
110
- }
111
- });
112
-
113
- return super._configure(config);
99
+ get autostart() {
100
+ return true;
114
101
  }
115
- */
116
102
 
117
103
  /**
118
104
  * Endpoints used to send password change requests to.
@@ -198,9 +184,9 @@ export class ServiceAuthenticator extends Service {
198
184
  } else {
199
185
  throw new Error("Not authorized");
200
186
  }
201
- } catch (e) {
202
- this.error(e);
203
- throw new Error("Authentication failed");
187
+ } catch (cause) {
188
+ this.error(cause);
189
+ throw new Error("Authentication failed", { cause });
204
190
  }
205
191
  }
206
192
  }