hcloud-sdk 22.54.0 → 22.56.0

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/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
- ## [22.54.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.53.1...v22.54.0) (2026-10-12)
1
+ ## [22.56.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.55.0...v22.56.0) (2026-10-12)
2
2
 
3
3
  ### Features
4
4
 
5
- * add shortMessage to error codes ([cb4a69a](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/cb4a69a752b178f3f2448fc038a927cd8ac3f679))
5
+ * add support for IDP organization domains in NATS subjects ([300b89b](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/300b89bd76e5e947f572dffa683ed6b3247b6e6d))
@@ -4,7 +4,6 @@ export * from "./organization/member";
4
4
  export * from "./organization/member/invitations";
5
5
  export * from "./organization/service-accounts";
6
6
  export * from "./organization/settings/domain";
7
- export * from "./organization/settings/domain/saml";
8
7
  export * from "./organization/settings/oauthApp";
9
8
  export * from "./organization/team";
10
9
  export * from "./user";
@@ -21,7 +21,6 @@ __exportStar(require("./organization/member"), exports);
21
21
  __exportStar(require("./organization/member/invitations"), exports);
22
22
  __exportStar(require("./organization/service-accounts"), exports);
23
23
  __exportStar(require("./organization/settings/domain"), exports);
24
- __exportStar(require("./organization/settings/domain/saml"), exports);
25
24
  __exportStar(require("./organization/settings/oauthApp"), exports);
26
25
  __exportStar(require("./organization/team"), exports);
27
26
  __exportStar(require("./user"), exports);
@@ -1,12 +1,57 @@
1
1
  import { ReducedOrganization } from "../..";
2
2
  import { ReducedUser } from "../../../user";
3
- import { OIDCProvider } from "./oidc";
4
- import { FullSAMLProvider } from "./saml";
5
3
  export declare enum VerificationStatus {
6
4
  verified = "verified",
7
5
  waiting = "waiting",
8
6
  error = "error"
9
7
  }
8
+ /**
9
+ * Single sign-on configuration of a Domain as returned by the API. The OIDC client secret is never returned.
10
+ */
11
+ export type SSOProvider = {
12
+ type: "oidc";
13
+ clientId: string;
14
+ discoveryEndpoint?: string;
15
+ authorizationEndpoint?: string;
16
+ tokenEndpoint?: string;
17
+ } | {
18
+ type: "saml";
19
+ ssoLoginURL: string;
20
+ ssoLogoutURL: string;
21
+ /** PEM encoded certificates of the identity provider */
22
+ certificates: string[];
23
+ allowUnencryptedAssertion: boolean;
24
+ };
25
+ /**
26
+ * Single sign-on configuration to set on a Domain. Setting it replaces the whole previous configuration.
27
+ */
28
+ export type DomainSSOConfig = ({
29
+ type: "oidc";
30
+ clientId: string;
31
+ /** Required for a new OIDC configuration, left out on updates it keeps the stored secret */
32
+ clientSecret?: string;
33
+ } & ({
34
+ discoveryEndpoint: string;
35
+ authorizationEndpoint?: never;
36
+ tokenEndpoint?: never;
37
+ } | {
38
+ authorizationEndpoint: string;
39
+ tokenEndpoint: string;
40
+ discoveryEndpoint?: never;
41
+ })) | {
42
+ type: "saml";
43
+ ssoLoginURL: string;
44
+ ssoLogoutURL: string;
45
+ /** PEM encoded certificates, one string may contain several certificates */
46
+ certificates: string[];
47
+ allowUnencryptedAssertion?: boolean;
48
+ };
49
+ export interface DomainPatch {
50
+ /** New name, the renamed Domain has to be verified again */
51
+ name?: string;
52
+ /** New single sign-on configuration, null removes it */
53
+ sso?: DomainSSOConfig | null;
54
+ }
10
55
  export interface Domain {
11
56
  _id: string;
12
57
  name: string;
@@ -15,11 +60,8 @@ export interface Domain {
15
60
  verificationStatus: VerificationStatus;
16
61
  uuid: string;
17
62
  creator: ReducedUser;
63
+ /** Only used for login once the Domain is verified */
64
+ sso?: SSOProvider;
18
65
  createDate: number;
19
66
  modifyDate: number;
20
67
  }
21
- export type SSOProvider = (FullSAMLProvider & {
22
- type: "saml";
23
- }) | (OIDCProvider & {
24
- type: "oidc";
25
- });
@@ -25,6 +25,7 @@ declare enum NatsSubject {
25
25
  IDP_ORGANIZATION_SETTINGS_OAUTHAPP = "hcloud.idp.organization.${base64orgName}.settings.oauthapp.${oAuthAppId}",
26
26
  IDP_ORGANIZATION_SERVICE_ACCOUNTS = "hcloud.idp.organization.${base64orgName}.serviceAccounts",
27
27
  IDP_ORGANIZATION_STORAGE = "hcloud.idp.organization.${base64orgName}.storage",
28
+ IDP_ORGANIZATION_DOMAINS = "hcloud.idp.organization.${base64orgName}.domains",
28
29
  HIGH5_SPACES = "hcloud.high5.organization.${base64orgName}.spaces",
29
30
  HIGH5_SPACE_PERMISSIONS = "hcloud.high5.organization.${base64orgName}.spaces.${base64spaceName}.permissions",
30
31
  HIGH5_STREAM_EXECUTE = "hcloud.high5.organization.${organizationId}.stream.execute.${base64email}",
@@ -94,6 +95,7 @@ declare enum NatsObjectType {
94
95
  NOTIFICATIONS = "NOTIFICATIONS",
95
96
  GENERAL_SETTINGS = "GENERAL_SETTINGS",
96
97
  STORAGE = "STORAGE",
98
+ DOMAIN = "DOMAIN",
97
99
  SPACE = "SPACE",
98
100
  SPACE_PERMISSION = "SPACE_PERMISSION",
99
101
  DESIGN = "DESIGN",
@@ -152,6 +154,7 @@ interface NatsObject extends NatsNameObject, NatsIdObject, NatsMemberObject, Nat
152
154
  [NatsSubject.IDP_ORGANIZATION_TEAM_MEMBERS]: NatsIdObject;
153
155
  [NatsSubject.IDP_ORGANIZATION_LICENSE]: NatsLicenseObject;
154
156
  [NatsSubject.IDP_ORGANIZATION_STORAGE]: NatsIdObject;
157
+ [NatsSubject.IDP_ORGANIZATION_DOMAINS]: NatsIdObject;
155
158
  [NatsSubject.HIGH5_SPACES]: NatsNameObject;
156
159
  [NatsSubject.HIGH5_SPACE_PERMISSIONS]: NatsIdObject;
157
160
  [NatsSubject.HIGH5_STREAM_EXECUTE]: High5ExecuteOnAgentRequest | High5ExecutionCancelRequest;
@@ -285,6 +288,7 @@ declare class NatsSubjects {
285
288
  Organization: {
286
289
  new (): {};
287
290
  STORAGE: (organizationName: string) => string;
291
+ DOMAINS: (organizationName: string) => string;
288
292
  INVITATIONS: (organizationName: string) => string;
289
293
  MEMBERS: (organizationName: string) => string & {
290
294
  EXECUTION_TARGET: (email: string) => string;
@@ -28,6 +28,7 @@ var NatsSubject;
28
28
  NatsSubject["IDP_ORGANIZATION_SETTINGS_OAUTHAPP"] = "hcloud.idp.organization.${base64orgName}.settings.oauthapp.${oAuthAppId}";
29
29
  NatsSubject["IDP_ORGANIZATION_SERVICE_ACCOUNTS"] = "hcloud.idp.organization.${base64orgName}.serviceAccounts";
30
30
  NatsSubject["IDP_ORGANIZATION_STORAGE"] = "hcloud.idp.organization.${base64orgName}.storage";
31
+ NatsSubject["IDP_ORGANIZATION_DOMAINS"] = "hcloud.idp.organization.${base64orgName}.domains";
31
32
  NatsSubject["HIGH5_SPACES"] = "hcloud.high5.organization.${base64orgName}.spaces";
32
33
  NatsSubject["HIGH5_SPACE_PERMISSIONS"] = "hcloud.high5.organization.${base64orgName}.spaces.${base64spaceName}.permissions";
33
34
  NatsSubject["HIGH5_STREAM_EXECUTE"] = "hcloud.high5.organization.${organizationId}.stream.execute.${base64email}";
@@ -99,6 +100,7 @@ var NatsObjectType;
99
100
  NatsObjectType["NOTIFICATIONS"] = "NOTIFICATIONS";
100
101
  NatsObjectType["GENERAL_SETTINGS"] = "GENERAL_SETTINGS";
101
102
  NatsObjectType["STORAGE"] = "STORAGE";
103
+ NatsObjectType["DOMAIN"] = "DOMAIN";
102
104
  NatsObjectType["SPACE"] = "SPACE";
103
105
  NatsObjectType["SPACE_PERMISSION"] = "SPACE_PERMISSION";
104
106
  NatsObjectType["DESIGN"] = "DESIGN";
@@ -199,6 +201,9 @@ NatsSubjects.IDP = (_a = class {
199
201
  _d.STORAGE = (organizationName) => {
200
202
  return NatsSubjects.replace(NatsSubject.IDP_ORGANIZATION_STORAGE, { organizationName });
201
203
  },
204
+ _d.DOMAINS = (organizationName) => {
205
+ return NatsSubjects.replace(NatsSubject.IDP_ORGANIZATION_DOMAINS, { organizationName });
206
+ },
202
207
  _d.INVITATIONS = (organizationName) => {
203
208
  return NatsSubjects.replace(NatsSubject.IDP_ORGANIZATION_INVITATIONS, { organizationName });
204
209
  },
@@ -1,18 +1,6 @@
1
1
  import Base, { MaybeRaw } from "../../../../../Base";
2
- import { Domain, SSOProvider } from "../../../../../interfaces/idp/organization/settings/domain";
3
- import { IdpOIDCProvider } from "./oidc";
4
- import { IdpSAMLProvider } from "./saml";
2
+ import { Domain, DomainPatch, DomainSSOConfig } from "../../../../../interfaces/idp/organization/settings/domain";
5
3
  export declare class IdpDomain extends Base {
6
- /**
7
- * Handles everything around a SAML provider of a domain.
8
- */
9
- get samlProvider(): IdpSAMLProvider;
10
- private _samlProvider?;
11
- /**
12
- * Handles everything around an OIDC provider of a domain.
13
- */
14
- get oidcProvider(): IdpOIDCProvider;
15
- private _oidcProvider?;
16
4
  /**
17
5
  * Retrieves all the Domains associated with a given Organization.
18
6
  * @param orgName Name of Organization
@@ -25,9 +13,10 @@ export declare class IdpDomain extends Base {
25
13
  * Creates a new Domain for the given Organization
26
14
  * @param orgName Name of the Organization
27
15
  * @param domainName Name of the Domain
16
+ * @param sso Optional single sign-on configuration, only used for login once the Domain is verified
28
17
  * @returns the created Domain
29
18
  */
30
- createDomain<R extends boolean = false>(orgName: string, domainName: string, raw?: {
19
+ createDomain<R extends boolean = false>(orgName: string, domainName: string, sso?: DomainSSOConfig, raw?: {
31
20
  raw: R;
32
21
  }): Promise<MaybeRaw<R, Domain>>;
33
22
  /**
@@ -40,24 +29,17 @@ export declare class IdpDomain extends Base {
40
29
  raw: R;
41
30
  }): Promise<MaybeRaw<R, Domain>>;
42
31
  /**
43
- * Renames a Domain. The renamed Domain is no longer verified and has to be verified again with the same uuid.
32
+ * Renames a Domain and/or changes its single sign-on configuration.
33
+ * A renamed Domain is no longer verified and has to be verified again with the same uuid, its SSO configuration is kept.
34
+ * Setting `sso` replaces the whole configuration, `null` removes it. A left out OIDC `clientSecret` keeps the stored one.
44
35
  * @param orgName Name of the organization
45
36
  * @param domainName Current name of the Domain
46
- * @param newDomainName New name of the Domain
47
- * @returns the renamed Domain
37
+ * @param patch New name and/or SSO configuration
38
+ * @returns the updated Domain
48
39
  */
49
- renameDomain<R extends boolean = false>(orgName: string, domainName: string, newDomainName: string, raw?: {
40
+ patchDomain<R extends boolean = false>(orgName: string, domainName: string, patch: DomainPatch, raw?: {
50
41
  raw: R;
51
42
  }): Promise<MaybeRaw<R, Domain>>;
52
- /**
53
- * Retrieves the SSO provider of a Domain.
54
- * @param orgName Name of the organization
55
- * @param domainName Name of the Domain
56
- * @returns The SAML or OIDC provider of the Domain (check `type`), or null if it has none
57
- */
58
- getProvider<R extends boolean = false>(orgName: string, domainName: string, raw?: {
59
- raw: R;
60
- }): Promise<MaybeRaw<R, SSOProvider | null>>;
61
43
  /**
62
44
  * Deletes a domain.
63
45
  * @param orgName Name of the organization
@@ -14,27 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.IdpDomain = void 0;
16
16
  const Base_1 = __importDefault(require("../../../../../Base"));
17
- const oidc_1 = require("./oidc");
18
- const saml_1 = require("./saml");
19
17
  class IdpDomain extends Base_1.default {
20
- /**
21
- * Handles everything around a SAML provider of a domain.
22
- */
23
- get samlProvider() {
24
- if (this._samlProvider === undefined) {
25
- this._samlProvider = new saml_1.IdpSAMLProvider(this.options, this.axios);
26
- }
27
- return this._samlProvider;
28
- }
29
- /**
30
- * Handles everything around an OIDC provider of a domain.
31
- */
32
- get oidcProvider() {
33
- if (this._oidcProvider === undefined) {
34
- this._oidcProvider = new oidc_1.IdpOIDCProvider(this.options, this.axios);
35
- }
36
- return this._oidcProvider;
37
- }
38
18
  /**
39
19
  * Retrieves all the Domains associated with a given Organization.
40
20
  * @param orgName Name of Organization
@@ -50,12 +30,14 @@ class IdpDomain extends Base_1.default {
50
30
  * Creates a new Domain for the given Organization
51
31
  * @param orgName Name of the Organization
52
32
  * @param domainName Name of the Domain
33
+ * @param sso Optional single sign-on configuration, only used for login once the Domain is verified
53
34
  * @returns the created Domain
54
35
  */
55
- createDomain(orgName, domainName, raw) {
36
+ createDomain(orgName, domainName, sso, raw) {
56
37
  return __awaiter(this, void 0, void 0, function* () {
57
38
  const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/settings/domains`), {
58
39
  name: domainName,
40
+ sso,
59
41
  });
60
42
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
61
43
  });
@@ -73,29 +55,17 @@ class IdpDomain extends Base_1.default {
73
55
  });
74
56
  }
75
57
  /**
76
- * Renames a Domain. The renamed Domain is no longer verified and has to be verified again with the same uuid.
58
+ * Renames a Domain and/or changes its single sign-on configuration.
59
+ * A renamed Domain is no longer verified and has to be verified again with the same uuid, its SSO configuration is kept.
60
+ * Setting `sso` replaces the whole configuration, `null` removes it. A left out OIDC `clientSecret` keeps the stored one.
77
61
  * @param orgName Name of the organization
78
62
  * @param domainName Current name of the Domain
79
- * @param newDomainName New name of the Domain
80
- * @returns the renamed Domain
81
- */
82
- renameDomain(orgName, domainName, newDomainName, raw) {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}`), {
85
- name: newDomainName,
86
- });
87
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
88
- });
89
- }
90
- /**
91
- * Retrieves the SSO provider of a Domain.
92
- * @param orgName Name of the organization
93
- * @param domainName Name of the Domain
94
- * @returns The SAML or OIDC provider of the Domain (check `type`), or null if it has none
63
+ * @param patch New name and/or SSO configuration
64
+ * @returns the updated Domain
95
65
  */
96
- getProvider(orgName, domainName, raw) {
66
+ patchDomain(orgName, domainName, patch, raw) {
97
67
  return __awaiter(this, void 0, void 0, function* () {
98
- const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/provider`));
68
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}`), patch);
99
69
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
100
70
  });
101
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "22.54.0",
3
+ "version": "22.56.0",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,17 +0,0 @@
1
- export interface OIDCProvider {
2
- clientId: string;
3
- authorizationEndpoint?: string;
4
- tokenEndpoint?: string;
5
- discoveryEndpoint?: string;
6
- }
7
- export type OIDCProviderCreateDto = Pick<OIDCProvider, "clientId"> & {
8
- clientSecret: string;
9
- } & ({
10
- discoveryEndpoint: string;
11
- authorizationEndpoint?: never;
12
- tokenEndpoint?: never;
13
- } | {
14
- authorizationEndpoint: string;
15
- tokenEndpoint: string;
16
- discoveryEndpoint?: never;
17
- });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- export interface SAMLProvider {
2
- ssoLoginURL: string;
3
- ssoLogoutURL: string;
4
- certificates: string[];
5
- allowUnencryptedAssertion: boolean;
6
- }
7
- export interface FullSAMLProvider extends SAMLProvider {
8
- domainName: string;
9
- }
10
- export type SAMLProviderCreateDto = Omit<SAMLProvider, "allowUnencryptedAssertion"> & Partial<Pick<SAMLProvider, "allowUnencryptedAssertion">>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,41 +0,0 @@
1
- import Base, { MaybeRaw } from "../../../../../../Base";
2
- import { OIDCProvider, OIDCProviderCreateDto } from "../../../../../../interfaces/idp/organization/settings/domain/oidc";
3
- export declare class IdpOIDCProvider extends Base {
4
- /**
5
- * Retrieves all OIDC providers associated with a given Organization.
6
- * @param orgName Name of the Organization
7
- * @returns Array of OIDC providers
8
- */
9
- getAllOIDCProvidersOfOrganization<R extends boolean = false>(orgName: string, raw?: {
10
- raw: R;
11
- }): Promise<MaybeRaw<R, OIDCProvider[]>>;
12
- /**
13
- * Creates a new OIDC provider for the specified domain.
14
- * @param orgName Name of the Organization
15
- * @param domainName Name of the Domain
16
- * @param provider OIDC provider object containing the login URL, logout URL, certificates and a boolean to allow unencrypted assertion
17
- * @returns The created OIDC provider
18
- */
19
- createProvider<R extends boolean = false>(orgName: string, domainName: string, provider: OIDCProviderCreateDto, raw?: {
20
- raw: R;
21
- }): Promise<MaybeRaw<R, OIDCProvider>>;
22
- /**
23
- * Patches a OIDC provider for the specified domain
24
- * @param orgName Name of the Organization
25
- * @param domainName Name of the Domain
26
- * @param provider Parial OIDC provider object
27
- * @returns The updated OIDC provider
28
- */
29
- patchProvider<R extends boolean = false>(orgName: string, domainName: string, provider: Partial<OIDCProviderCreateDto>, raw?: {
30
- raw: R;
31
- }): Promise<MaybeRaw<R, OIDCProvider>>;
32
- /**
33
- * Removes a OIDC provider from the specified domain
34
- * @param orgName Name of the Organization
35
- * @param domainName Name of the Domain
36
- */
37
- deleteProvider<R extends boolean = false>(orgName: string, domainName: string, raw?: {
38
- raw: R;
39
- }): Promise<MaybeRaw<R, void>>;
40
- protected getEndpoint(endpoint: string): string;
41
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.IdpOIDCProvider = void 0;
16
- const Base_1 = __importDefault(require("../../../../../../Base"));
17
- class IdpOIDCProvider extends Base_1.default {
18
- /**
19
- * Retrieves all OIDC providers associated with a given Organization.
20
- * @param orgName Name of the Organization
21
- * @returns Array of OIDC providers
22
- */
23
- getAllOIDCProvidersOfOrganization(orgName, raw) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/settings/domains/oidc`));
26
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
27
- });
28
- }
29
- /**
30
- * Creates a new OIDC provider for the specified domain.
31
- * @param orgName Name of the Organization
32
- * @param domainName Name of the Domain
33
- * @param provider OIDC provider object containing the login URL, logout URL, certificates and a boolean to allow unencrypted assertion
34
- * @returns The created OIDC provider
35
- */
36
- createProvider(orgName, domainName, provider, raw) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/oidc`), provider);
39
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
40
- });
41
- }
42
- /**
43
- * Patches a OIDC provider for the specified domain
44
- * @param orgName Name of the Organization
45
- * @param domainName Name of the Domain
46
- * @param provider Parial OIDC provider object
47
- * @returns The updated OIDC provider
48
- */
49
- patchProvider(orgName, domainName, provider, raw) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/oidc`), provider);
52
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
53
- });
54
- }
55
- /**
56
- * Removes a OIDC provider from the specified domain
57
- * @param orgName Name of the Organization
58
- * @param domainName Name of the Domain
59
- */
60
- deleteProvider(orgName, domainName, raw) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/oidc`));
63
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
64
- });
65
- }
66
- getEndpoint(endpoint) {
67
- return `${this.options.server}/api/account${endpoint}`;
68
- }
69
- }
70
- exports.IdpOIDCProvider = IdpOIDCProvider;
@@ -1,53 +0,0 @@
1
- import Base, { MaybeRaw } from "../../../../../../Base";
2
- import { FullSAMLProvider, SAMLProvider, SAMLProviderCreateDto } from "../../../../../../interfaces/idp/organization/settings/domain/saml";
3
- export declare class IdpSAMLProvider extends Base {
4
- /**
5
- * Retrieves all SAML providers associated with a given Organization.
6
- * @param orgName Name of the Organization
7
- * @returns Array of SAML providers
8
- */
9
- getAllSAMLProvidersOfOrganization<R extends boolean = false>(orgName: string, raw?: {
10
- raw: R;
11
- }): Promise<MaybeRaw<R, FullSAMLProvider[]>>;
12
- /**
13
- * Creates a new SAML provider for the specified domain.
14
- * @param orgName Name of the Organization
15
- * @param domainName Name of the Domain
16
- * @param provider SAML provider object containing the login URL, logout URL, certificates and a boolean to allow unencrypted assertion
17
- * @returns The created SAML provider
18
- */
19
- createProvider<R extends boolean = false>(orgName: string, domainName: string, provider: SAMLProviderCreateDto, raw?: {
20
- raw: R;
21
- }): Promise<MaybeRaw<R, SAMLProvider>>;
22
- /**
23
- * Updates a SAML provider for the specified domain
24
- * @param orgName Name of the Organization
25
- * @param domainName Name of the Domain
26
- * @param provider SAML provider object containing the login URL, logout URL, certificates and a boolean to allow unencrypted assertion
27
- * @returns The updated SAML provider
28
- */
29
- updateProvider<R extends boolean = false>(orgName: string, domainName: string, provider: SAMLProviderCreateDto, raw?: {
30
- raw: R;
31
- }): Promise<MaybeRaw<R, SAMLProvider>>;
32
- /**
33
- * Adds certificates to a SAML provider
34
- * @param orgName Name of the Organization
35
- * @param domainName Name of the Domain
36
- * @param certificates Certificates to add
37
- * @returns The updated SAML provider
38
- */
39
- addCertificatesToProvider<R extends boolean = false>(orgName: string, domainName: string, certificates: string[], raw?: {
40
- raw: R;
41
- }): Promise<MaybeRaw<R, SAMLProvider>>;
42
- /**
43
- * Removes a SAML provider from the specified domain
44
- * @param orgName Name of the Organization
45
- * @param domainName Name of the Domain
46
- */
47
- deleteProvider<R extends boolean = false>(orgName: string, domainName: string, raw?: {
48
- raw: R;
49
- }): Promise<MaybeRaw<R, SAMLProvider>>;
50
- private convertProviderToFormData;
51
- private createFileFromString;
52
- protected getEndpoint(endpoint: string): string;
53
- }
@@ -1,102 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.IdpSAMLProvider = void 0;
16
- const Base_1 = __importDefault(require("../../../../../../Base"));
17
- class IdpSAMLProvider extends Base_1.default {
18
- constructor() {
19
- super(...arguments);
20
- this.createFileFromString = (certificate) => {
21
- const blob = new Blob([certificate]);
22
- return new File([blob], "certificate");
23
- };
24
- }
25
- /**
26
- * Retrieves all SAML providers associated with a given Organization.
27
- * @param orgName Name of the Organization
28
- * @returns Array of SAML providers
29
- */
30
- getAllSAMLProvidersOfOrganization(orgName, raw) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/settings/domains/saml`));
33
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
34
- });
35
- }
36
- /**
37
- * Creates a new SAML provider for the specified domain.
38
- * @param orgName Name of the Organization
39
- * @param domainName Name of the Domain
40
- * @param provider SAML provider object containing the login URL, logout URL, certificates and a boolean to allow unencrypted assertion
41
- * @returns The created SAML provider
42
- */
43
- createProvider(orgName, domainName, provider, raw) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- const formData = this.convertProviderToFormData(provider);
46
- const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/saml`), formData);
47
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
48
- });
49
- }
50
- /**
51
- * Updates a SAML provider for the specified domain
52
- * @param orgName Name of the Organization
53
- * @param domainName Name of the Domain
54
- * @param provider SAML provider object containing the login URL, logout URL, certificates and a boolean to allow unencrypted assertion
55
- * @returns The updated SAML provider
56
- */
57
- updateProvider(orgName, domainName, provider, raw) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const formData = this.convertProviderToFormData(provider);
60
- const resp = yield this.axios.put(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/saml`), formData);
61
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
62
- });
63
- }
64
- /**
65
- * Adds certificates to a SAML provider
66
- * @param orgName Name of the Organization
67
- * @param domainName Name of the Domain
68
- * @param certificates Certificates to add
69
- * @returns The updated SAML provider
70
- */
71
- addCertificatesToProvider(orgName, domainName, certificates, raw) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- const formData = new FormData();
74
- certificates.forEach(c => formData.append("certificate", this.createFileFromString(c)));
75
- const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/saml/certificates`), formData);
76
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
77
- });
78
- }
79
- /**
80
- * Removes a SAML provider from the specified domain
81
- * @param orgName Name of the Organization
82
- * @param domainName Name of the Domain
83
- */
84
- deleteProvider(orgName, domainName, raw) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}/saml`));
87
- return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
88
- });
89
- }
90
- convertProviderToFormData(provider) {
91
- const formData = new FormData();
92
- formData.append("ssoLoginURL", provider.ssoLoginURL);
93
- formData.append("ssoLogoutURL", provider.ssoLogoutURL);
94
- provider.certificates.forEach(c => formData.append("certificate", this.createFileFromString(c)));
95
- provider.allowUnencryptedAssertion && formData.append("allowUnencryptedAssertion", provider.allowUnencryptedAssertion.toString());
96
- return formData;
97
- }
98
- getEndpoint(endpoint) {
99
- return `${this.options.server}/api/account${endpoint}`;
100
- }
101
- }
102
- exports.IdpSAMLProvider = IdpSAMLProvider;