@boxyhq/saml-jackson 0.3.6-beta.509 → 0.3.6-beta.515

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.
@@ -34,7 +34,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
34
34
  exports.APIController = void 0;
35
35
  const crypto_1 = __importDefault(require("crypto"));
36
36
  const dbutils = __importStar(require("../db/utils"));
37
- const metrics = __importStar(require("../opentelemetry/metrics"));
38
37
  const saml_1 = __importDefault(require("../saml/saml"));
39
38
  const x509_1 = __importDefault(require("../saml/x509"));
40
39
  const error_1 = require("./error");
@@ -125,7 +124,6 @@ class APIController {
125
124
  config(body) {
126
125
  return __awaiter(this, void 0, void 0, function* () {
127
126
  const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product } = body;
128
- metrics.increment('createConfig');
129
127
  this._validateIdPConfig(body);
130
128
  let metaData = rawMetadata;
131
129
  if (encodedRawMetadata) {
@@ -216,7 +214,6 @@ class APIController {
216
214
  getConfig(body) {
217
215
  return __awaiter(this, void 0, void 0, function* () {
218
216
  const { clientID, tenant, product } = body;
219
- metrics.increment('getConfig');
220
217
  if (clientID) {
221
218
  const samlConfig = yield this.configStore.get(clientID);
222
219
  return samlConfig ? { provider: samlConfig.idpMetadata.provider } : {};
@@ -274,7 +271,6 @@ class APIController {
274
271
  deleteConfig(body) {
275
272
  return __awaiter(this, void 0, void 0, function* () {
276
273
  const { clientID, clientSecret, tenant, product } = body;
277
- metrics.increment('deleteConfig');
278
274
  if (clientID && clientSecret) {
279
275
  const samlConfig = yield this.configStore.get(clientID);
280
276
  if (!samlConfig) {
@@ -33,16 +33,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
34
  exports.OAuthController = void 0;
35
35
  const crypto_1 = __importDefault(require("crypto"));
36
- const util_1 = require("util");
37
- const zlib_1 = require("zlib");
38
36
  const dbutils = __importStar(require("../db/utils"));
39
- const metrics = __importStar(require("../opentelemetry/metrics"));
40
37
  const saml_1 = __importDefault(require("../saml/saml"));
41
38
  const error_1 = require("./error");
42
39
  const allowed = __importStar(require("./oauth/allowed"));
43
40
  const codeVerifier = __importStar(require("./oauth/code-verifier"));
44
41
  const redirect = __importStar(require("./oauth/redirect"));
45
42
  const utils_1 = require("./utils");
43
+ const util_1 = require("util");
44
+ const zlib_1 = require("zlib");
46
45
  const deflateRawAsync = (0, util_1.promisify)(zlib_1.deflateRaw);
47
46
  const relayStatePrefix = 'boxyhq_jackson_';
48
47
  function getEncodedClientId(client_id) {
@@ -75,7 +74,6 @@ class OAuthController {
75
74
  const { response_type = 'code', client_id, redirect_uri, state, tenant, product, code_challenge, code_challenge_method = '',
76
75
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
77
76
  provider = 'saml', } = body;
78
- metrics.increment('oauthAuthorize');
79
77
  if (!redirect_uri) {
80
78
  throw new error_1.JacksonError('Please specify a redirect URL.', 400);
81
79
  }
@@ -264,7 +262,6 @@ class OAuthController {
264
262
  token(body) {
265
263
  return __awaiter(this, void 0, void 0, function* () {
266
264
  const { client_id, client_secret, code_verifier, code, grant_type = 'authorization_code' } = body;
267
- metrics.increment('oauthToken');
268
265
  if (grant_type !== 'authorization_code') {
269
266
  throw new error_1.JacksonError('Unsupported grant_type', 400);
270
267
  }
@@ -342,7 +339,6 @@ class OAuthController {
342
339
  userInfo(token) {
343
340
  return __awaiter(this, void 0, void 0, function* () {
344
341
  const rsp = yield this.tokenStore.get(token);
345
- metrics.increment('oauthUserInfo');
346
342
  if (!rsp || !rsp.claims) {
347
343
  throw new error_1.JacksonError('Invalid token', 403);
348
344
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { JacksonOption } from './typings';
1
2
  import { APIController } from './controller/api';
2
3
  import { OAuthController } from './controller/oauth';
3
- import { JacksonOption } from './typings';
4
4
  export declare const controllers: (opts: JacksonOption) => Promise<{
5
5
  apiController: APIController;
6
6
  oauthController: OAuthController;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.3.6-beta.509",
3
+ "version": "0.3.6-beta.515",
4
4
  "description": "SAML 2.0 service",
5
5
  "keywords": [
6
6
  "SAML 2.0"
@@ -32,7 +32,6 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@boxyhq/saml20": "0.2.0",
35
- "@opentelemetry/api-metrics": "0.27.0",
36
35
  "@peculiar/webcrypto": "1.2.3",
37
36
  "@peculiar/x509": "1.6.1",
38
37
  "cors": "2.8.5",
@@ -1,2 +0,0 @@
1
- declare const increment: (action: string) => void;
2
- export { increment };
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.increment = void 0;
4
- const api_metrics_1 = require("@opentelemetry/api-metrics");
5
- const counters = {
6
- createConfig: {
7
- name: 'saml.config.create',
8
- description: 'Number of SAML config create requests',
9
- },
10
- getConfig: {
11
- name: 'saml.config.get',
12
- description: 'Number of SAML config get requests',
13
- },
14
- deleteConfig: {
15
- name: 'saml.config.delete',
16
- description: 'Number of SAML config delete requests',
17
- },
18
- oauthAuthorize: {
19
- name: 'saml.oauth.authorize',
20
- description: 'Number of SAML oauth authorize requests',
21
- },
22
- oauthToken: {
23
- name: 'saml.oauth.token',
24
- description: 'Number of SAML oauth token requests',
25
- },
26
- oauthUserInfo: {
27
- name: 'saml.oauth.userinfo',
28
- description: 'Number of SAML oauth user info requests',
29
- }
30
- };
31
- const createCounter = (action) => {
32
- const meter = api_metrics_1.metrics.getMeterProvider().getMeter('saml-jackson');
33
- const counter = counters[action];
34
- return meter.createCounter(counter.name, {
35
- description: counter.description,
36
- });
37
- };
38
- const increment = (action) => {
39
- const counter = createCounter(action);
40
- counter.add(1);
41
- };
42
- exports.increment = increment;