@riocrypto/common-server 1.0.1491 → 1.0.1493

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,7 +1,7 @@
1
1
  declare class FogbenderClient {
2
2
  private secret;
3
3
  constructor(secret: string);
4
- createToken(customerId: string, userId: string, userEmail: string, userName: string): Promise<string>;
4
+ createToken(customerId: string, userId: string, userEmail: string, userName: string, customerName: string): Promise<string>;
5
5
  }
6
6
  export declare const buildFogbenderClient: () => Promise<FogbenderClient>;
7
7
  export {};
@@ -20,13 +20,14 @@ class FogbenderClient {
20
20
  constructor(secret) {
21
21
  this.secret = secret;
22
22
  }
23
- createToken(customerId, userId, userEmail, userName) {
23
+ createToken(customerId, userId, userEmail, userName, customerName) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
25
  const response = yield axios_1.default.post(`https://api.fogbender.com/tokens`, JSON.stringify({
26
26
  customerId,
27
27
  userId,
28
28
  userEmail,
29
29
  userName,
30
+ customerName,
30
31
  }), {
31
32
  headers: {
32
33
  Authorization: `Bearer ${this.secret}`,
@@ -18,7 +18,7 @@ const authRoleOrder = [
18
18
  ];
19
19
  const requireMinRole = (req, res, next, minRole) => __awaiter(void 0, void 0, void 0, function* () {
20
20
  var _a;
21
- if (!req.admin) {
21
+ if (!req.admin && !req.validClusterApiKey) {
22
22
  if (authRoleOrder.indexOf((_a = req.auth) === null || _a === void 0 ? void 0 : _a.role) < authRoleOrder.indexOf(minRole)) {
23
23
  throw new common_1.GenericInputError(`Insufficient permissions. This endpoint requires at least the ${minRole} role. Contact your account owner to change your access role.`);
24
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1491",
3
+ "version": "1.0.1493",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",