@boxyhq/saml-jackson 0.3.0-beta.248 → 0.3.0-beta.249

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,22 +1,10 @@
1
- import { IdPConfig, ISAMLConfig, OAuth } from '../typings';
2
- export declare class SAMLConfig implements ISAMLConfig {
1
+ import { IdPConfig, IAPIController, OAuth } from '../typings';
2
+ export declare class APIController implements IAPIController {
3
3
  private configStore;
4
4
  constructor({ configStore }: {
5
5
  configStore: any;
6
6
  });
7
7
  private _validateIdPConfig;
8
- create(body: IdPConfig): Promise<OAuth>;
9
- get(body: {
10
- clientID: string;
11
- tenant: string;
12
- product: string;
13
- }): Promise<Partial<OAuth>>;
14
- delete(body: {
15
- clientID: string;
16
- clientSecret: string;
17
- tenant: string;
18
- product: string;
19
- }): Promise<void>;
20
8
  config(body: IdPConfig): Promise<OAuth>;
21
9
  getConfig(body: {
22
10
  clientID: string;
@@ -31,14 +31,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  return (mod && mod.__esModule) ? mod : { "default": mod };
32
32
  };
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.SAMLConfig = void 0;
34
+ exports.APIController = void 0;
35
35
  const crypto_1 = __importDefault(require("crypto"));
36
36
  const dbutils = __importStar(require("../db/utils"));
37
37
  const saml_1 = __importDefault(require("../saml/saml"));
38
38
  const x509_1 = __importDefault(require("../saml/x509"));
39
39
  const error_1 = require("./error");
40
40
  const utils_1 = require("./utils");
41
- class SAMLConfig {
41
+ class APIController {
42
42
  constructor({ configStore }) {
43
43
  this.configStore = configStore;
44
44
  }
@@ -60,7 +60,7 @@ class SAMLConfig {
60
60
  throw new error_1.JacksonError('Please provide product', 400);
61
61
  }
62
62
  }
63
- create(body) {
63
+ config(body) {
64
64
  return __awaiter(this, void 0, void 0, function* () {
65
65
  const { rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product } = body;
66
66
  this._validateIdPConfig(body);
@@ -109,7 +109,7 @@ class SAMLConfig {
109
109
  };
110
110
  });
111
111
  }
112
- get(body) {
112
+ getConfig(body) {
113
113
  return __awaiter(this, void 0, void 0, function* () {
114
114
  const { clientID, tenant, product } = body;
115
115
  if (clientID) {
@@ -129,7 +129,7 @@ class SAMLConfig {
129
129
  throw new error_1.JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
130
130
  });
131
131
  }
132
- delete(body) {
132
+ deleteConfig(body) {
133
133
  return __awaiter(this, void 0, void 0, function* () {
134
134
  const { clientID, clientSecret, tenant, product } = body;
135
135
  if (clientID && clientSecret) {
@@ -161,24 +161,8 @@ class SAMLConfig {
161
161
  throw new error_1.JacksonError('Please provide `clientID` and `clientSecret` or `tenant` and `product`.', 400);
162
162
  });
163
163
  }
164
- // Ensure backward compatibility
165
- config(body) {
166
- return __awaiter(this, void 0, void 0, function* () {
167
- return this.create(body);
168
- });
169
- }
170
- getConfig(body) {
171
- return __awaiter(this, void 0, void 0, function* () {
172
- return this.get(body);
173
- });
174
- }
175
- deleteConfig(body) {
176
- return __awaiter(this, void 0, void 0, function* () {
177
- return this.delete(body);
178
- });
179
- }
180
164
  }
181
- exports.SAMLConfig = SAMLConfig;
165
+ exports.APIController = APIController;
182
166
  const extractHostName = (url) => {
183
167
  try {
184
168
  const pUrl = new URL(url);
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { JacksonOption } from './typings';
2
- import { SAMLConfig } from './controller/api';
2
+ import { APIController } from './controller/api';
3
3
  import { OAuthController } from './controller/oauth';
4
4
  export declare const controllers: (opts: JacksonOption) => Promise<{
5
- apiController: SAMLConfig;
5
+ apiController: APIController;
6
6
  oauthController: OAuthController;
7
7
  }>;
8
8
  export default controllers;
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
54
54
  const sessionStore = db.store('oauth:session', opts.db.ttl);
55
55
  const codeStore = db.store('oauth:code', opts.db.ttl);
56
56
  const tokenStore = db.store('oauth:token', opts.db.ttl);
57
- const apiController = new api_1.SAMLConfig({ configStore });
57
+ const apiController = new api_1.APIController({ configStore });
58
58
  const oauthController = new oauth_1.OAuthController({
59
59
  configStore,
60
60
  sessionStore,
package/dist/typings.d.ts CHANGED
@@ -10,7 +10,7 @@ export interface OAuth {
10
10
  client_secret: string;
11
11
  provider: string;
12
12
  }
13
- export interface ISAMLConfig {
13
+ export interface IAPIController {
14
14
  config(body: IdPConfig): Promise<OAuth>;
15
15
  getConfig(body: {
16
16
  clientID: string;
@@ -23,18 +23,6 @@ export interface ISAMLConfig {
23
23
  tenant: string;
24
24
  product: string;
25
25
  }): Promise<void>;
26
- create(body: IdPConfig): Promise<OAuth>;
27
- get(body: {
28
- clientID: string;
29
- tenant: string;
30
- product: string;
31
- }): Promise<Partial<OAuth>>;
32
- delete(body: {
33
- clientID: string;
34
- clientSecret: string;
35
- tenant: string;
36
- product: string;
37
- }): Promise<void>;
38
26
  }
39
27
  export interface IOAuthController {
40
28
  authorize(body: OAuthReqBody): Promise<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.3.0-beta.248",
3
+ "version": "0.3.0-beta.249",
4
4
  "license": "Apache 2.0",
5
5
  "description": "SAML 2.0 service",
6
6
  "main": "dist/index.js",