1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-24 16:49:26 +01:00

[PS-1093] Move Organization Api Calls (#3243)

* Move organization api calls into seperate service

* Remove unneeded unknown

* Address PR feedback
This commit is contained in:
Justin Baur 2022-08-24 12:33:05 -04:00 committed by GitHub
parent 364d2f311e
commit 7145b13df1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 545 additions and 414 deletions

View File

@ -6,6 +6,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
@ -30,7 +31,8 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
policyService: PolicyService,
router: Router,
syncService: SyncService,
route: ActivatedRoute
route: ActivatedRoute,
organizationApiService: OrganizationApiServiceAbstraction
) {
super(
i18nService,
@ -44,7 +46,8 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
apiService,
syncService,
route,
stateService
stateService,
organizationApiService
);
}
}

View File

@ -5,6 +5,7 @@ import * as program from "commander";
import * as jsdom from "jsdom";
import { InternalFolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { ClientType } from "@bitwarden/common/enums/clientType";
import { KeySuffixOptions } from "@bitwarden/common/enums/keySuffixOptions";
import { LogLevelType } from "@bitwarden/common/enums/logLevelType";
@ -30,6 +31,7 @@ import { KeyConnectorService } from "@bitwarden/common/services/keyConnector.ser
import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.service";
import { NoopMessagingService } from "@bitwarden/common/services/noopMessaging.service";
import { OrganizationService } from "@bitwarden/common/services/organization.service";
import { OrganizationApiService } from "@bitwarden/common/services/organization/organization-api.service";
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
import { PolicyService } from "@bitwarden/common/services/policy/policy.service";
import { ProviderService } from "@bitwarden/common/services/provider.service";
@ -58,7 +60,7 @@ import { NodeEnvSecureStorageService } from "./services/nodeEnvSecureStorage.ser
import { VaultProgram } from "./vault.program";
// Polyfills
(global as any).DOMParser = new jsdom.JSDOM().window.DOMParser;
global.DOMParser = new jsdom.JSDOM().window.DOMParser;
// eslint-disable-next-line
const packageJson = require("../package.json");
@ -108,6 +110,7 @@ export class Main {
broadcasterService: BroadcasterService;
folderApiService: FolderApiService;
userVerificationApiService: UserVerificationApiService;
organizationApiService: OrganizationApiServiceAbstraction;
constructor() {
let p = null;
@ -185,6 +188,9 @@ export class Main {
async (expired: boolean) => await this.logout(),
customUserAgent
);
this.organizationApiService = new OrganizationApiService(this.apiService);
this.containerService = new ContainerService(this.cryptoService);
this.settingsService = new SettingsService(this.stateService);

View File

@ -1,18 +1,18 @@
import * as inquirer from "inquirer";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
import { Response } from "@bitwarden/node/cli/models/response";
import { MessageResponse } from "@bitwarden/node/cli/models/response/messageResponse";
export class ConvertToKeyConnectorCommand {
constructor(
private apiService: ApiService,
private keyConnectorService: KeyConnectorService,
private environmentService: EnvironmentService,
private syncService: SyncService,
private organizationApiService: OrganizationApiServiceAbstraction,
private logout: () => Promise<void>
) {}
@ -72,7 +72,7 @@ export class ConvertToKeyConnectorCommand {
return Response.success();
} else if (answer.convert === "leave") {
await this.apiService.postLeaveOrganization(organization.id);
await this.organizationApiService.leave(organization.id);
await this.keyConnectorService.removeConvertAccountRequired();
await this.syncService.fullSync(true);
return Response.success();

View File

@ -121,6 +121,7 @@ export class ServeCommand {
this.main.keyConnectorService,
this.main.environmentService,
this.main.syncService,
this.main.organizationApiService,
async () => await this.main.logout()
);

View File

@ -3,6 +3,7 @@ import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { CryptoFunctionService } from "@bitwarden/common/abstractions/cryptoFunction.service";
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { StateService } from "@bitwarden/common/abstractions/state.service";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
import { HashPurpose } from "@bitwarden/common/enums/hashPurpose";
@ -26,6 +27,7 @@ export class UnlockCommand {
private keyConnectorService: KeyConnectorService,
private environmentService: EnvironmentService,
private syncService: SyncService,
private organizationApiService: OrganizationApiServiceAbstraction,
private logout: () => Promise<void>
) {}
@ -78,10 +80,10 @@ export class UnlockCommand {
if (await this.keyConnectorService.getConvertAccountRequired()) {
const convertToKeyConnectorCommand = new ConvertToKeyConnectorCommand(
this.apiService,
this.keyConnectorService,
this.environmentService,
this.syncService,
this.organizationApiService,
this.logout
);
const convertResponse = await convertToKeyConnectorCommand.run();

View File

@ -260,6 +260,7 @@ export class Program extends BaseProgram {
this.main.keyConnectorService,
this.main.environmentService,
this.main.syncService,
this.main.organizationApiService,
async () => await this.main.logout()
);
const response = await command.run(password, cmd);
@ -534,6 +535,7 @@ export class Program extends BaseProgram {
this.main.keyConnectorService,
this.main.environmentService,
this.main.syncService,
this.main.organizationApiService,
this.main.logout
);
const response = await command.run(null, null);

View File

@ -7,6 +7,7 @@ import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.s
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
@ -35,7 +36,8 @@ export class SetPasswordComponent extends BaseSetPasswordComponent implements On
route: ActivatedRoute,
private broadcasterService: BroadcasterService,
private ngZone: NgZone,
stateService: StateService
stateService: StateService,
organizationApiService: OrganizationApiServiceAbstraction
) {
super(
i18nService,
@ -49,13 +51,14 @@ export class SetPasswordComponent extends BaseSetPasswordComponent implements On
apiService,
syncService,
route,
stateService
stateService,
organizationApiService
);
}
async ngOnInit() {
await super.ngOnInit();
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message) => {
this.ngZone.run(() => {
switch (message.command) {
case "windowHidden":

View File

@ -5,6 +5,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
@ -34,7 +35,8 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
private cryptoService: CryptoService,
private policyApiService: PolicyApiServiceAbstraction,
private policyService: PolicyService,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {
super(router, platformUtilsService, i18nService, route, stateService);
}
@ -74,7 +76,7 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
request.token = qParams.token;
if (await this.performResetPasswordAutoEnroll(qParams)) {
const response = await this.apiService.getOrganizationKeys(qParams.organizationId);
const response = await this.organizationApiService.getKeys(qParams.organizationId);
if (response == null) {
throw new Error(this.i18nService.t("resetPasswordOrgKeysError"));
@ -92,7 +94,7 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
return request;
}
private async performResetPasswordAutoEnroll(qParams: any): Promise<boolean> {
private async performResetPasswordAutoEnroll(qParams: Params): Promise<boolean> {
let policyList: Policy[] = null;
try {
const policies = await this.policyApiService.getPoliciesByToken(

View File

@ -6,6 +6,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
@ -30,7 +31,8 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
router: Router,
syncService: SyncService,
route: ActivatedRoute,
stateService: StateService
stateService: StateService,
organizationApiService: OrganizationApiServiceAbstraction
) {
super(
i18nService,
@ -44,7 +46,8 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
apiService,
syncService,
route,
stateService
stateService,
organizationApiService
);
}
}

View File

@ -8,6 +8,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
@ -34,7 +35,8 @@ export class BillingComponent extends OrganizationPlansComponent {
organizationService: OrganizationService,
logService: LogService,
messagingService: MessagingService,
formBuilder: UntypedFormBuilder
formBuilder: UntypedFormBuilder,
organizationApiService: OrganizationApiServiceAbstraction
) {
super(
apiService,
@ -47,7 +49,8 @@ export class BillingComponent extends OrganizationPlansComponent {
organizationService,
logService,
messagingService,
formBuilder
formBuilder,
organizationApiService
);
}

View File

@ -85,7 +85,7 @@ export abstract class BasePeopleComponent<
users: UserType[] = [];
pagedUsers: UserType[] = [];
searchText: string;
actionPromise: Promise<any>;
actionPromise: Promise<void>;
protected allUsers: UserType[] = [];
protected activeUsers: UserType[] = [];
@ -111,11 +111,11 @@ export abstract class BasePeopleComponent<
abstract edit(user: UserType): void;
abstract getUsers(): Promise<ListResponse<UserType>>;
abstract deleteUser(id: string): Promise<any>;
abstract revokeUser(id: string): Promise<any>;
abstract restoreUser(id: string): Promise<any>;
abstract reinviteUser(id: string): Promise<any>;
abstract confirmUser(user: UserType, publicKey: Uint8Array): Promise<any>;
abstract deleteUser(id: string): Promise<void>;
abstract revokeUser(id: string): Promise<void>;
abstract restoreUser(id: string): Promise<void>;
abstract reinviteUser(id: string): Promise<void>;
abstract confirmUser(user: UserType, publicKey: Uint8Array): Promise<void>;
async load() {
const response = await this.getUsers();

View File

@ -11,6 +11,7 @@ import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
@ -92,7 +93,8 @@ export class PeopleComponent
userNamePipe: UserNamePipe,
private syncService: SyncService,
stateService: StateService,
private organizationService: OrganizationService
private organizationService: OrganizationService,
private organizationApiService: OrganizationApiServiceAbstraction
) {
super(
apiService,
@ -125,7 +127,7 @@ export class PeopleComponent
const orgShareKey = await this.cryptoService.getOrgKey(this.organizationId);
const orgKeys = await this.cryptoService.makeKeyPair(orgShareKey);
const request = new OrganizationKeysRequest(orgKeys[0], orgKeys[1].encryptedString);
const response = await this.apiService.postOrganizationKeys(this.organizationId, request);
const response = await this.organizationApiService.updateKeys(this.organizationId, request);
if (response != null) {
this.orgHasKeys = response.publicKey != null && response.privateKey != null;
await this.syncService.fullSync(true); // Replace oganizations with new data
@ -161,26 +163,26 @@ export class PeopleComponent
return this.apiService.getOrganizationUsers(this.organizationId);
}
deleteUser(id: string): Promise<any> {
deleteUser(id: string): Promise<void> {
return this.apiService.deleteOrganizationUser(this.organizationId, id);
}
revokeUser(id: string): Promise<any> {
revokeUser(id: string): Promise<void> {
return this.apiService.revokeOrganizationUser(this.organizationId, id);
}
restoreUser(id: string): Promise<any> {
restoreUser(id: string): Promise<void> {
return this.apiService.restoreOrganizationUser(this.organizationId, id);
}
reinviteUser(id: string): Promise<any> {
reinviteUser(id: string): Promise<void> {
return this.apiService.postOrganizationUserReinvite(this.organizationId, id);
}
async confirmUser(
user: OrganizationUserUserDetailsResponse,
publicKey: Uint8Array
): Promise<any> {
): Promise<void> {
const orgKey = await this.cryptoService.getOrgKey(this.organizationId);
const key = await this.cryptoService.rsaEncrypt(orgKey.key, publicKey.buffer);
const request = new OrganizationUserConfirmRequest();

View File

@ -7,6 +7,7 @@ import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
import { OrganizationKeysRequest } from "@bitwarden/common/models/request/organizationKeysRequest";
@ -39,8 +40,8 @@ export class AccountComponent {
loading = true;
canUseApi = false;
org: OrganizationResponse;
formPromise: Promise<any>;
taxFormPromise: Promise<any>;
formPromise: Promise<boolean>;
taxFormPromise: Promise<unknown>;
private organizationId: string;
@ -54,7 +55,8 @@ export class AccountComponent {
private cryptoService: CryptoService,
private logService: LogService,
private router: Router,
private organizationService: OrganizationService
private organizationService: OrganizationService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit() {
@ -66,7 +68,7 @@ export class AccountComponent {
await this.organizationService.get(this.organizationId)
).canManageBilling;
try {
this.org = await this.apiService.getOrganization(this.organizationId);
this.org = await this.organizationApiService.get(this.organizationId);
this.canUseApi = this.org.useApi;
} catch (e) {
this.logService.error(e);
@ -90,7 +92,7 @@ export class AccountComponent {
request.keys = new OrganizationKeysRequest(orgKeys[0], orgKeys[1].encryptedString);
}
this.formPromise = this.apiService.putOrganization(this.organizationId, request).then(() => {
this.formPromise = this.organizationApiService.save(this.organizationId, request).then(() => {
return this.syncService.fullSync(true);
});
await this.formPromise;
@ -133,7 +135,9 @@ export class AccountComponent {
await this.modalService.openViewRef(ApiKeyComponent, this.apiKeyModalRef, (comp) => {
comp.keyType = "organization";
comp.entityId = this.organizationId;
comp.postKey = this.apiService.postOrganizationApiKey.bind(this.apiService);
comp.postKey = this.organizationApiService.getOrCreateApiKey.bind(
this.organizationApiService
);
comp.scope = "api.organization";
comp.grantType = "client_credentials";
comp.apiKeyTitle = "apiKey";
@ -147,7 +151,7 @@ export class AccountComponent {
comp.keyType = "organization";
comp.isRotation = true;
comp.entityId = this.organizationId;
comp.postKey = this.apiService.postOrganizationRotateApiKey.bind(this.apiService);
comp.postKey = this.organizationApiService.rotateApiKey.bind(this.organizationApiService);
comp.scope = "api.organization";
comp.grantType = "client_credentials";
comp.apiKeyTitle = "apiKey";

View File

@ -1,8 +1,8 @@
import { Component, EventEmitter, Input, Output } from "@angular/core";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { OrganizationSubscriptionUpdateRequest } from "@bitwarden/common/models/request/organizationSubscriptionUpdateRequest";
@ -18,16 +18,16 @@ export class AdjustSubscription {
@Input() interval = "year";
@Output() onAdjusted = new EventEmitter();
formPromise: Promise<any>;
formPromise: Promise<void>;
limitSubscription: boolean;
newSeatCount: number;
newMaxSeats: number;
constructor(
private apiService: ApiService,
private i18nService: I18nService,
private platformUtilsService: PlatformUtilsService,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
ngOnInit() {
@ -40,7 +40,7 @@ export class AdjustSubscription {
try {
const seatAdjustment = this.newSeatCount - this.currentSeatCount;
const request = new OrganizationSubscriptionUpdateRequest(seatAdjustment, this.newMaxSeats);
this.formPromise = this.apiService.postOrganizationUpdateSubscription(
this.formPromise = this.organizationApiService.updateSubscription(
this.organizationId,
request
);

View File

@ -2,6 +2,7 @@ import { Component } from "@angular/core";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
import { OrganizationApiKeyType } from "@bitwarden/common/enums/organizationApiKeyType";
@ -28,7 +29,8 @@ export class BillingSyncApiKeyComponent {
private userVerificationService: UserVerificationService,
private apiService: ApiService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService
private i18nService: I18nService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
copy() {
@ -41,7 +43,7 @@ export class BillingSyncApiKeyComponent {
.buildRequest(this.masterPassword, OrganizationApiKeyRequest)
.then((request) => {
request.type = OrganizationApiKeyType.BillingSync;
return this.apiService.postOrganizationRotateApiKey(this.organizationId, request);
return this.organizationApiService.rotateApiKey(this.organizationId, request);
});
const response = await this.formPromise;
await this.load(response);
@ -56,7 +58,7 @@ export class BillingSyncApiKeyComponent {
.buildRequest(this.masterPassword, OrganizationApiKeyRequest)
.then((request) => {
request.type = OrganizationApiKeyType.BillingSync;
return this.apiService.postOrganizationApiKey(this.organizationId, request);
return this.organizationApiService.getOrCreateApiKey(this.organizationId, request);
});
const response = await this.formPromise;
await this.load(response);

View File

@ -1,10 +1,10 @@
import { Component, EventEmitter, OnInit, Output } from "@angular/core";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
import { CipherType } from "@bitwarden/common/enums/cipherType";
@ -53,19 +53,19 @@ export class DeleteOrganizationComponent implements OnInit {
deleteOrganizationRequestType: "InvalidFamiliesForEnterprise" | "RegularDelete" = "RegularDelete";
organizationName: string;
organizationContentSummary: OrganizationContentSummary = new OrganizationContentSummary();
@Output() onSuccess: EventEmitter<unknown> = new EventEmitter();
@Output() onSuccess: EventEmitter<void> = new EventEmitter();
masterPassword: Verification;
formPromise: Promise<unknown>;
formPromise: Promise<void>;
constructor(
private apiService: ApiService,
private i18nService: I18nService,
private platformUtilsService: PlatformUtilsService,
private userVerificationService: UserVerificationService,
private logService: LogService,
private cipherService: CipherService,
private organizationService: OrganizationService
private organizationService: OrganizationService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit(): Promise<void> {
@ -76,7 +76,7 @@ export class DeleteOrganizationComponent implements OnInit {
try {
this.formPromise = this.userVerificationService
.buildRequest(this.masterPassword)
.then((request) => this.apiService.deleteOrganization(this.organizationId, request));
.then((request) => this.organizationApiService.delete(this.organizationId, request));
await this.formPromise;
this.platformUtilsService.showToast(
"success",

View File

@ -1,8 +1,8 @@
import { Component, EventEmitter, Input, Output } from "@angular/core";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
@Component({
selector: "app-download-license",
@ -14,12 +14,12 @@ export class DownloadLicenseComponent {
@Output() onCanceled = new EventEmitter();
installationId: string;
formPromise: Promise<any>;
formPromise: Promise<unknown>;
constructor(
private apiService: ApiService,
private fileDownloadService: FileDownloadService,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async submit() {
@ -28,7 +28,7 @@ export class DownloadLicenseComponent {
}
try {
this.formPromise = this.apiService.getOrganizationLicense(
this.formPromise = this.organizationApiService.getLicense(
this.organizationId,
this.installationId
);

View File

@ -1,9 +1,9 @@
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PaymentMethodType } from "@bitwarden/common/enums/paymentMethodType";
import { TransactionType } from "@bitwarden/common/enums/transactionType";
@ -26,16 +26,16 @@ export class OrganizationBillingComponent implements OnInit {
verifyAmount1: number;
verifyAmount2: number;
verifyBankPromise: Promise<any>;
verifyBankPromise: Promise<void>;
// TODO - Make sure to properly split out the billing/invoice and payment method/account during org admin refresh
constructor(
private apiService: ApiService,
private i18nService: I18nService,
private route: ActivatedRoute,
private platformUtilsService: PlatformUtilsService,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit() {
@ -52,7 +52,7 @@ export class OrganizationBillingComponent implements OnInit {
}
this.loading = true;
if (this.organizationId != null) {
this.billing = await this.apiService.getOrganizationBilling(this.organizationId);
this.billing = await this.organizationApiService.getBilling(this.organizationId);
}
this.loading = false;
}
@ -66,10 +66,7 @@ export class OrganizationBillingComponent implements OnInit {
const request = new VerifyBankRequest();
request.amount1 = this.verifyAmount1;
request.amount2 = this.verifyAmount2;
this.verifyBankPromise = this.apiService.postOrganizationVerifyBank(
this.organizationId,
request
);
this.verifyBankPromise = this.organizationApiService.verifyBank(this.organizationId, request);
await this.verifyBankPromise;
this.platformUtilsService.showToast(
"success",

View File

@ -8,6 +8,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { OrganizationApiKeyType } from "@bitwarden/common/enums/organizationApiKeyType";
import { OrganizationConnectionType } from "@bitwarden/common/enums/organizationConnectionType";
@ -48,9 +49,9 @@ export class OrganizationSubscriptionComponent implements OnInit {
userOrg: Organization;
existingBillingSyncConnection: OrganizationConnectionResponse<BillingSyncConfigApi>;
removeSponsorshipPromise: Promise<any>;
cancelPromise: Promise<any>;
reinstatePromise: Promise<any>;
removeSponsorshipPromise: Promise<void>;
cancelPromise: Promise<void>;
reinstatePromise: Promise<void>;
@ViewChild("rotateBillingSyncKeyTemplate", { read: ViewContainerRef, static: true })
billingSyncKeyViewContainerRef: ViewContainerRef;
@ -64,7 +65,8 @@ export class OrganizationSubscriptionComponent implements OnInit {
private route: ActivatedRoute,
private organizationService: OrganizationService,
private logService: LogService,
private modalService: ModalService
private modalService: ModalService,
private organizationApiService: OrganizationApiServiceAbstraction
) {
this.selfHosted = platformUtilsService.isSelfHost();
}
@ -85,9 +87,9 @@ export class OrganizationSubscriptionComponent implements OnInit {
this.loading = true;
this.userOrg = await this.organizationService.get(this.organizationId);
if (this.userOrg.canManageBilling) {
this.sub = await this.apiService.getOrganizationSubscription(this.organizationId);
this.sub = await this.organizationApiService.getSubscription(this.organizationId);
}
const apiKeyResponse = await this.apiService.getOrganizationApiKeyInformation(
const apiKeyResponse = await this.organizationApiService.getApiKeyInformation(
this.organizationId
);
this.hasBillingSyncToken = apiKeyResponse.data.some(
@ -125,7 +127,7 @@ export class OrganizationSubscriptionComponent implements OnInit {
}
try {
this.reinstatePromise = this.apiService.postOrganizationReinstate(this.organizationId);
this.reinstatePromise = this.organizationApiService.reinstate(this.organizationId);
await this.reinstatePromise;
this.platformUtilsService.showToast("success", null, this.i18nService.t("reinstated"));
this.load();
@ -151,7 +153,7 @@ export class OrganizationSubscriptionComponent implements OnInit {
}
try {
this.cancelPromise = this.apiService.postOrganizationCancel(this.organizationId);
this.cancelPromise = this.organizationApiService.cancel(this.organizationId);
await this.cancelPromise;
this.platformUtilsService.showToast(
"success",

View File

@ -6,6 +6,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
@ -33,7 +34,8 @@ export class EnrollMasterPasswordReset {
private syncService: SyncService,
private logService: LogService,
private modalRef: ModalRef,
config: ModalConfig
config: ModalConfig,
private organizationApiService: OrganizationApiServiceAbstraction
) {
this.organization = config.data.organization;
}
@ -48,7 +50,7 @@ export class EnrollMasterPasswordReset {
let keyString: string = null;
// Retrieve Public Key
const orgKeys = await this.apiService.getOrganizationKeys(this.organization.id);
const orgKeys = await this.organizationApiService.getKeys(this.organization.id);
if (orgKeys == null) {
throw new Error(this.i18nService.t("resetPasswordOrgKeysError"));
}

View File

@ -3,6 +3,7 @@ import { Component, EventEmitter, Input, Output, ViewChild } from "@angular/core
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PaymentMethodType } from "@bitwarden/common/enums/paymentMethodType";
import { PaymentRequest } from "@bitwarden/common/models/request/paymentRequest";
@ -24,13 +25,14 @@ export class AdjustPaymentComponent {
@Output() onCanceled = new EventEmitter();
paymentMethodType = PaymentMethodType;
formPromise: Promise<any>;
formPromise: Promise<void>;
constructor(
private apiService: ApiService,
private i18nService: I18nService,
private platformUtilsService: PlatformUtilsService,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async submit() {
@ -50,7 +52,7 @@ export class AdjustPaymentComponent {
request.line2 = this.taxInfoComponent.taxInfo.line2;
request.city = this.taxInfoComponent.taxInfo.city;
request.state = this.taxInfoComponent.taxInfo.state;
return this.apiService.postOrganizationPayment(this.organizationId, request);
return this.organizationApiService.updatePayment(this.organizationId, request);
}
});
await this.formPromise;

View File

@ -4,6 +4,7 @@ import { ActivatedRoute, Router } from "@angular/router";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { StorageRequest } from "@bitwarden/common/models/request/storageRequest";
import { PaymentResponse } from "@bitwarden/common/models/response/paymentResponse";
@ -25,7 +26,7 @@ export class AdjustStorageComponent {
@ViewChild(PaymentComponent, { static: true }) paymentComponent: PaymentComponent;
storageAdjustment = 0;
formPromise: Promise<any>;
formPromise: Promise<PaymentResponse | void>;
constructor(
private apiService: ApiService,
@ -33,7 +34,8 @@ export class AdjustStorageComponent {
private platformUtilsService: PlatformUtilsService,
private router: Router,
private activatedRoute: ActivatedRoute,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async submit() {
@ -50,7 +52,7 @@ export class AdjustStorageComponent {
if (this.organizationId == null) {
response = this.formPromise = this.apiService.postAccountStorage(request);
} else {
response = this.formPromise = this.apiService.postOrganizationStorage(
response = this.formPromise = this.organizationApiService.updateStorage(
this.organizationId,
request
);

View File

@ -11,6 +11,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
@ -53,7 +54,8 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
private sendService: SendService,
private organizationService: OrganizationService,
private keyConnectorService: KeyConnectorService,
private router: Router
private router: Router,
private organizationApiService: OrganizationApiServiceAbstraction
) {
super(
i18nService,
@ -267,7 +269,7 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
}
// Retrieve public key
const response = await this.apiService.getOrganizationKeys(org.id);
const response = await this.organizationApiService.getKeys(org.id);
const publicKey = Utils.fromB64ToArray(response?.publicKey);
// Re-enroll - encrpyt user's encKey.key with organization public key

View File

@ -8,6 +8,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
@ -26,6 +27,10 @@ import { PlanResponse } from "@bitwarden/common/models/response/planResponse";
import { PaymentComponent } from "./payment.component";
import { TaxInfoComponent } from "./tax-info.component";
interface OnSuccessArgs {
organizationId: string;
}
@Component({
selector: "app-organization-plans",
templateUrl: "organization-plans.component.html",
@ -41,14 +46,14 @@ export class OrganizationPlansComponent implements OnInit {
@Input() product: ProductType = ProductType.Free;
@Input() plan: PlanType = PlanType.Free;
@Input() providerId: string;
@Output() onSuccess = new EventEmitter();
@Output() onCanceled = new EventEmitter();
@Output() onSuccess = new EventEmitter<OnSuccessArgs>();
@Output() onCanceled = new EventEmitter<void>();
@Output() onTrialBillingSuccess = new EventEmitter();
loading = true;
selfHosted = false;
productTypes = ProductType;
formPromise: Promise<any>;
formPromise: Promise<string>;
singleOrgPolicyBlock = false;
isInTrialFlow = false;
discount = 0;
@ -79,7 +84,8 @@ export class OrganizationPlansComponent implements OnInit {
private organizationService: OrganizationService,
private logService: LogService,
private messagingService: MessagingService,
private formBuilder: UntypedFormBuilder
private formBuilder: UntypedFormBuilder,
private organizationApiService: OrganizationApiServiceAbstraction
) {
this.selfHosted = platformUtilsService.isSelfHost();
}
@ -372,7 +378,7 @@ export class OrganizationPlansComponent implements OnInit {
request.keys = new OrganizationKeysRequest(orgKeys[0], orgKeys[1].encryptedString);
}
const result = await this.apiService.postOrganizationUpgrade(this.organizationId, request);
const result = await this.organizationApiService.upgrade(this.organizationId, request);
if (!result.success && result.paymentIntentClientSecret != null) {
await this.paymentComponent.handleStripeCardPayment(result.paymentIntentClientSecret, null);
}
@ -434,7 +440,7 @@ export class OrganizationPlansComponent implements OnInit {
return orgId;
} else {
return (await this.apiService.postOrganization(request)).id;
return (await this.organizationApiService.create(request)).id;
}
}
@ -449,14 +455,14 @@ export class OrganizationPlansComponent implements OnInit {
fd.append("license", files[0]);
fd.append("key", key);
fd.append("collectionName", collectionCt);
const response = await this.apiService.postOrganizationLicense(fd);
const response = await this.organizationApiService.createLicense(fd);
const orgId = response.id;
await this.apiService.refreshIdentityToken();
// Org Keys live outside of the OrganizationLicense - add the keys to the org here
const request = new OrganizationKeysRequest(orgKeys[0], orgKeys[1].encryptedString);
await this.apiService.postOrganizationKeys(orgId, request);
await this.organizationApiService.updateKeys(orgId, request);
return orgId;
}

View File

@ -3,10 +3,17 @@ import { ActivatedRoute } from "@angular/router";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { OrganizationTaxInfoUpdateRequest } from "@bitwarden/common/models/request/organizationTaxInfoUpdateRequest";
import { TaxInfoUpdateRequest } from "@bitwarden/common/models/request/taxInfoUpdateRequest";
import { TaxInfoResponse } from "@bitwarden/common/models/response/taxInfoResponse";
import { TaxRateResponse } from "@bitwarden/common/models/response/taxRateResponse";
type TaxInfoView = Omit<TaxInfoResponse, "taxIdType"> & {
includeTaxId: boolean;
[key: string]: unknown;
};
@Component({
selector: "app-tax-info",
templateUrl: "tax-info.component.html",
@ -17,7 +24,7 @@ export class TaxInfoComponent {
loading = true;
organizationId: string;
taxInfo: any = {
taxInfo: TaxInfoView = {
taxId: null,
line1: null,
line2: null,
@ -30,7 +37,7 @@ export class TaxInfoComponent {
taxRates: TaxRateResponse[];
private pristine: any = {
private pristine: TaxInfoView = {
taxId: null,
line1: null,
line2: null,
@ -44,7 +51,8 @@ export class TaxInfoComponent {
constructor(
private apiService: ApiService,
private route: ActivatedRoute,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit() {
@ -52,7 +60,7 @@ export class TaxInfoComponent {
this.organizationId = params.organizationId;
if (this.organizationId) {
try {
const taxInfo = await this.apiService.getOrganizationTaxInfo(this.organizationId);
const taxInfo = await this.organizationApiService.getTaxInfo(this.organizationId);
if (taxInfo) {
this.taxInfo.taxId = taxInfo.taxId;
this.taxInfo.state = taxInfo.state;
@ -140,7 +148,7 @@ export class TaxInfoComponent {
}
const request = this.getTaxInfoRequest();
return this.organizationId
? this.apiService.putOrganizationTaxInfo(
? this.organizationApiService.updateTaxInfo(
this.organizationId,
request as OrganizationTaxInfoUpdateRequest
)

View File

@ -3,6 +3,7 @@ import { Component, EventEmitter, Input, Output } from "@angular/core";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
@Component({
@ -14,13 +15,14 @@ export class UpdateLicenseComponent {
@Output() onUpdated = new EventEmitter();
@Output() onCanceled = new EventEmitter();
formPromise: Promise<any>;
formPromise: Promise<void>;
constructor(
private apiService: ApiService,
private i18nService: I18nService,
private platformUtilsService: PlatformUtilsService,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async submit() {
@ -39,11 +41,11 @@ export class UpdateLicenseComponent {
const fd = new FormData();
fd.append("license", files[0]);
let updatePromise: Promise<any> = null;
let updatePromise: Promise<void | unknown> = null;
if (this.organizationId == null) {
updatePromise = this.apiService.postAccountLicense(fd);
} else {
updatePromise = this.apiService.postOrganizationLicenseUpdate(this.organizationId, fd);
updatePromise = this.organizationApiService.updateLicense(this.organizationId, fd);
}
this.formPromise = updatePromise.then(() => {

View File

@ -4,6 +4,7 @@ import { ModalService } from "@bitwarden/angular/services/modal.service";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
@ -19,7 +20,7 @@ import { EnrollMasterPasswordReset } from "../../../organizations/users/enroll-m
templateUrl: "organization-options.component.html",
})
export class OrganizationOptionsComponent {
actionPromise: Promise<any>;
actionPromise: Promise<void | boolean>;
policies: Policy[];
loaded = false;
@ -32,7 +33,8 @@ export class OrganizationOptionsComponent {
private syncService: SyncService,
private policyService: PolicyService,
private modalService: ModalService,
private logService: LogService
private logService: LogService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit() {
@ -100,7 +102,7 @@ export class OrganizationOptionsComponent {
}
try {
this.actionPromise = this.apiService.postLeaveOrganization(org.id).then(() => {
this.actionPromise = this.organizationApiService.leave(org.id).then(() => {
return this.syncService.fullSync(true);
});
await this.actionPromise;

View File

@ -5,6 +5,7 @@ import { ActivatedRoute } from "@angular/router";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { OrganizationApiKeyType } from "@bitwarden/common/enums/organizationApiKeyType";
import { OrganizationConnectionType } from "@bitwarden/common/enums/organizationConnectionType";
@ -12,6 +13,7 @@ import { ScimConfigApi } from "@bitwarden/common/models/api/scimConfigApi";
import { OrganizationApiKeyRequest } from "@bitwarden/common/models/request/organizationApiKeyRequest";
import { OrganizationConnectionRequest } from "@bitwarden/common/models/request/organizationConnectionRequest";
import { ScimConfigRequest } from "@bitwarden/common/models/request/scimConfigRequest";
import { ApiKeyResponse } from "@bitwarden/common/models/response/apiKeyResponse";
import { OrganizationConnectionResponse } from "@bitwarden/common/models/response/organizationConnectionResponse";
@Component({
@ -22,8 +24,8 @@ export class ScimComponent implements OnInit {
loading = true;
organizationId: string;
existingConnectionId: string;
formPromise: Promise<any>;
rotatePromise: Promise<any>;
formPromise: Promise<OrganizationConnectionResponse<ScimConfigApi>>;
rotatePromise: Promise<ApiKeyResponse>;
enabled = new FormControl(false);
showScimSettings = false;
@ -38,7 +40,8 @@ export class ScimComponent implements OnInit {
private apiService: ApiService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService,
private environmentService: EnvironmentService
private environmentService: EnvironmentService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit() {
@ -61,7 +64,7 @@ export class ScimComponent implements OnInit {
const apiKeyRequest = new OrganizationApiKeyRequest();
apiKeyRequest.type = OrganizationApiKeyType.Scim;
apiKeyRequest.masterPasswordHash = "N/A";
const apiKeyResponse = await this.apiService.postOrganizationApiKey(
const apiKeyResponse = await this.organizationApiService.getOrCreateApiKey(
this.organizationId,
apiKeyRequest
);
@ -91,7 +94,7 @@ export class ScimComponent implements OnInit {
request.type = OrganizationApiKeyType.Scim;
request.masterPasswordHash = "N/A";
this.rotatePromise = this.apiService.postOrganizationRotateApiKey(this.organizationId, request);
this.rotatePromise = this.organizationApiService.rotateApiKey(this.organizationId, request);
try {
const response = await this.rotatePromise;

View File

@ -7,6 +7,7 @@ import { dirtyRequired } from "@bitwarden/angular/validators/dirty.validator";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import {
OpenIdConnectRedirectBehavior,
@ -79,7 +80,7 @@ export class SsoComponent implements OnInit {
haveTestedKeyConnector = false;
organizationId: string;
organization: Organization;
formPromise: Promise<any>;
formPromise: Promise<OrganizationSsoResponse>;
callbackPath: string;
signedOutCallbackPath: string;
@ -147,7 +148,8 @@ export class SsoComponent implements OnInit {
private apiService: ApiService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService,
private organizationService: OrganizationService
private organizationService: OrganizationService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit() {
@ -178,7 +180,7 @@ export class SsoComponent implements OnInit {
async load() {
this.organization = await this.organizationService.get(this.organizationId);
const ssoSettings = await this.apiService.getOrganizationSso(this.organizationId);
const ssoSettings = await this.organizationApiService.getSso(this.organizationId);
this.populateForm(ssoSettings);
this.callbackPath = ssoSettings.urls.callbackPath;
@ -206,7 +208,7 @@ export class SsoComponent implements OnInit {
request.enabled = this.enabled.value;
request.data = SsoConfigApi.fromView(this.ssoConfigForm.value as SsoConfigView);
this.formPromise = this.apiService.postOrganizationSso(this.organizationId, request);
this.formPromise = this.organizationApiService.updateSso(this.organizationId, request);
try {
const response = await this.formPromise;

View File

@ -8,6 +8,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { ProviderService } from "@bitwarden/common/abstractions/provider.service";
import { SearchService } from "@bitwarden/common/abstractions/search.service";
@ -32,7 +33,7 @@ const DisallowedPlanTypes = [
export class ClientsComponent implements OnInit {
@ViewChild("add", { read: ViewContainerRef, static: true }) addModalRef: ViewContainerRef;
providerId: any;
providerId: string;
searchText: string;
addableOrganizations: Organization[];
loading = true;
@ -44,7 +45,7 @@ export class ClientsComponent implements OnInit {
protected didScroll = false;
protected pageSize = 100;
protected actionPromise: Promise<any>;
protected actionPromise: Promise<unknown>;
private pagedClientsCount = 0;
constructor(
@ -58,7 +59,8 @@ export class ClientsComponent implements OnInit {
private webProviderService: WebProviderService,
private logService: LogService,
private modalService: ModalService,
private organizationService: OrganizationService
private organizationService: OrganizationService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit() {
@ -82,7 +84,7 @@ export class ClientsComponent implements OnInit {
(o) => o.isOwner && o.providerId == null
);
const allowedOrgsIds = await Promise.all(
candidateOrgs.map((o) => this.apiService.getOrganization(o.id))
candidateOrgs.map((o) => this.organizationApiService.get(o.id))
).then((orgs) =>
orgs.filter((o) => !DisallowedPlanTypes.includes(o.planType)).map((o) => o.id)
);

View File

@ -4,6 +4,7 @@ import { Router } from "@angular/router";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { StateService } from "@bitwarden/common/abstractions/state.service";
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
@ -11,7 +12,7 @@ import { Organization } from "@bitwarden/common/models/domain/organization";
@Directive()
export class RemovePasswordComponent implements OnInit {
actionPromise: Promise<any>;
actionPromise: Promise<void | boolean>;
continuing = false;
leaving = false;
@ -26,7 +27,8 @@ export class RemovePasswordComponent implements OnInit {
private syncService: SyncService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService,
private keyConnectorService: KeyConnectorService
private keyConnectorService: KeyConnectorService,
private organizationApiService: OrganizationApiServiceAbstraction
) {}
async ngOnInit() {
@ -68,7 +70,7 @@ export class RemovePasswordComponent implements OnInit {
try {
this.leaving = true;
this.actionPromise = this.apiService.postLeaveOrganization(this.organization.id).then(() => {
this.actionPromise = this.organizationApiService.leave(this.organization.id).then(() => {
return this.syncService.fullSync(true);
});
await this.actionPromise;

View File

@ -6,6 +6,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
@ -32,7 +33,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
orgId: string;
resetPasswordAutoEnroll = false;
onSuccessfulChangePassword: () => Promise<any>;
onSuccessfulChangePassword: () => Promise<void>;
successRoute = "vault";
constructor(
@ -47,7 +48,8 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
private apiService: ApiService,
private syncService: SyncService,
private route: ActivatedRoute,
stateService: StateService
stateService: StateService,
private organizationApiService: OrganizationApiServiceAbstraction
) {
super(
i18nService,
@ -73,7 +75,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
// Automatic Enrollment Detection
if (this.identifier != null) {
try {
const response = await this.apiService.getOrganizationAutoEnrollStatus(this.identifier);
const response = await this.organizationApiService.getAutoEnrollStatus(this.identifier);
this.orgId = response.id;
this.resetPasswordAutoEnroll = response.resetPasswordEnabled;
this.enforcedPolicyOptions =
@ -113,7 +115,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
.setPassword(request)
.then(async () => {
await this.onSetPasswordSuccess(key, encKey, keys);
return this.apiService.getOrganizationKeys(this.orgId);
return this.organizationApiService.getKeys(this.orgId);
})
.then(async (response) => {
if (response == null) {

View File

@ -30,6 +30,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
import { MessagingService as MessagingServiceAbstraction } from "@bitwarden/common/abstractions/messaging.service";
import { NotificationsService as NotificationsServiceAbstraction } from "@bitwarden/common/abstractions/notifications.service";
import { OrganizationService as OrganizationServiceAbstraction } from "@bitwarden/common/abstractions/organization.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { PasswordGenerationService as PasswordGenerationServiceAbstraction } from "@bitwarden/common/abstractions/passwordGeneration.service";
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/abstractions/passwordReprompt.service";
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/abstractions/platformUtils.service";
@ -77,6 +78,7 @@ import { FormValidationErrorsService } from "@bitwarden/common/services/formVali
import { KeyConnectorService } from "@bitwarden/common/services/keyConnector.service";
import { NotificationsService } from "@bitwarden/common/services/notifications.service";
import { OrganizationService } from "@bitwarden/common/services/organization.service";
import { OrganizationApiService } from "@bitwarden/common/services/organization/organization-api.service";
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
import { PolicyApiService } from "@bitwarden/common/services/policy/policy-api.service";
import { PolicyService } from "@bitwarden/common/services/policy/policy.service";
@ -513,6 +515,11 @@ export const LOG_MAC_FAILURES = new InjectionToken<string>("LOG_MAC_FAILURES");
useClass: UserVerificationApiService,
deps: [ApiServiceAbstraction],
},
{
provide: OrganizationApiServiceAbstraction,
useClass: OrganizationApiService,
deps: [ApiServiceAbstraction],
},
],
})
export class JslibServicesModule {}

View File

@ -1,4 +1,3 @@
import { OrganizationApiKeyType } from "../enums/organizationApiKeyType";
import { OrganizationConnectionType } from "../enums/organizationConnectionType";
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
import { AttachmentRequest } from "../models/request/attachmentRequest";
@ -28,23 +27,14 @@ import { ApiTokenRequest } from "../models/request/identityToken/apiTokenRequest
import { PasswordTokenRequest } from "../models/request/identityToken/passwordTokenRequest";
import { SsoTokenRequest } from "../models/request/identityToken/ssoTokenRequest";
import { ImportCiphersRequest } from "../models/request/importCiphersRequest";
import { ImportDirectoryRequest } from "../models/request/importDirectoryRequest";
import { ImportOrganizationCiphersRequest } from "../models/request/importOrganizationCiphersRequest";
import { KdfRequest } from "../models/request/kdfRequest";
import { KeyConnectorUserKeyRequest } from "../models/request/keyConnectorUserKeyRequest";
import { KeysRequest } from "../models/request/keysRequest";
import { OrganizationSponsorshipCreateRequest } from "../models/request/organization/organizationSponsorshipCreateRequest";
import { OrganizationSponsorshipRedeemRequest } from "../models/request/organization/organizationSponsorshipRedeemRequest";
import { OrganizationSsoRequest } from "../models/request/organization/organizationSsoRequest";
import { OrganizationApiKeyRequest } from "../models/request/organizationApiKeyRequest";
import { OrganizationConnectionRequest } from "../models/request/organizationConnectionRequest";
import { OrganizationCreateRequest } from "../models/request/organizationCreateRequest";
import { OrganizationImportRequest } from "../models/request/organizationImportRequest";
import { OrganizationKeysRequest } from "../models/request/organizationKeysRequest";
import { OrganizationSubscriptionUpdateRequest } from "../models/request/organizationSubscriptionUpdateRequest";
import { OrganizationTaxInfoUpdateRequest } from "../models/request/organizationTaxInfoUpdateRequest";
import { OrganizationUpdateRequest } from "../models/request/organizationUpdateRequest";
import { OrganizationUpgradeRequest } from "../models/request/organizationUpgradeRequest";
import { OrganizationUserAcceptRequest } from "../models/request/organizationUserAcceptRequest";
import { OrganizationUserBulkConfirmRequest } from "../models/request/organizationUserBulkConfirmRequest";
import { OrganizationUserBulkRequest } from "../models/request/organizationUserBulkRequest";
@ -69,7 +59,6 @@ import { ProviderUserConfirmRequest } from "../models/request/provider/providerU
import { ProviderUserInviteRequest } from "../models/request/provider/providerUserInviteRequest";
import { ProviderUserUpdateRequest } from "../models/request/provider/providerUserUpdateRequest";
import { RegisterRequest } from "../models/request/registerRequest";
import { SeatRequest } from "../models/request/seatRequest";
import { SecretVerificationRequest } from "../models/request/secretVerificationRequest";
import { SelectionReadOnlyRequest } from "../models/request/selectionReadOnlyRequest";
import { SendAccessRequest } from "../models/request/sendAccessRequest";
@ -90,7 +79,6 @@ import { UpdateTwoFactorEmailRequest } from "../models/request/updateTwoFactorEm
import { UpdateTwoFactorWebAuthnDeleteRequest } from "../models/request/updateTwoFactorWebAuthnDeleteRequest";
import { UpdateTwoFactorWebAuthnRequest } from "../models/request/updateTwoFactorWebAuthnRequest";
import { UpdateTwoFactorYubioOtpRequest } from "../models/request/updateTwoFactorYubioOtpRequest";
import { VerifyBankRequest } from "../models/request/verifyBankRequest";
import { VerifyDeleteRecoverRequest } from "../models/request/verifyDeleteRecoverRequest";
import { VerifyEmailRequest } from "../models/request/verifyEmailRequest";
import { ApiKeyResponse } from "../models/response/apiKeyResponse";
@ -98,7 +86,6 @@ import { AttachmentResponse } from "../models/response/attachmentResponse";
import { AttachmentUploadDataResponse } from "../models/response/attachmentUploadDataResponse";
import { BillingHistoryResponse } from "../models/response/billingHistoryResponse";
import { BillingPaymentResponse } from "../models/response/billingPaymentResponse";
import { BillingResponse } from "../models/response/billingResponse";
import { BreachAccountResponse } from "../models/response/breachAccountResponse";
import { CipherResponse } from "../models/response/cipherResponse";
import {
@ -120,18 +107,12 @@ import { IdentityTokenResponse } from "../models/response/identityTokenResponse"
import { IdentityTwoFactorResponse } from "../models/response/identityTwoFactorResponse";
import { KeyConnectorUserKeyResponse } from "../models/response/keyConnectorUserKeyResponse";
import { ListResponse } from "../models/response/listResponse";
import { OrganizationSsoResponse } from "../models/response/organization/organizationSsoResponse";
import { OrganizationApiKeyInformationResponse } from "../models/response/organizationApiKeyInformationResponse";
import { OrganizationAutoEnrollStatusResponse } from "../models/response/organizationAutoEnrollStatusResponse";
import {
OrganizationConnectionConfigApis,
OrganizationConnectionResponse,
} from "../models/response/organizationConnectionResponse";
import { OrganizationExportResponse } from "../models/response/organizationExportResponse";
import { OrganizationKeysResponse } from "../models/response/organizationKeysResponse";
import { OrganizationResponse } from "../models/response/organizationResponse";
import { OrganizationSponsorshipSyncStatusResponse } from "../models/response/organizationSponsorshipSyncStatusResponse";
import { OrganizationSubscriptionResponse } from "../models/response/organizationSubscriptionResponse";
import { OrganizationUserBulkPublicKeyResponse } from "../models/response/organizationUserBulkPublicKeyResponse";
import { OrganizationUserBulkResponse } from "../models/response/organizationUserBulkResponse";
import {
@ -214,7 +195,7 @@ export abstract class ApiService {
postReinstatePremium: () => Promise<any>;
postCancelPremium: () => Promise<any>;
postAccountStorage: (request: StorageRequest) => Promise<PaymentResponse>;
postAccountPayment: (request: PaymentRequest) => Promise<any>;
postAccountPayment: (request: PaymentRequest) => Promise<void>;
postAccountLicense: (data: FormData) => Promise<any>;
postAccountKey: (request: UpdateKeyRequest) => Promise<any>;
postAccountKeys: (request: KeysRequest) => Promise<any>;
@ -415,7 +396,7 @@ export abstract class ApiService {
organizationId: string,
userId: string,
request: OrganizationUserResetPasswordEnrollmentRequest
) => Promise<any>;
) => Promise<void>;
putOrganizationUserResetPassword: (
organizationId: string,
id: string,
@ -438,7 +419,6 @@ export abstract class ApiService {
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
getSync: () => Promise<SyncResponse>;
postImportDirectory: (organizationId: string, request: ImportDirectoryRequest) => Promise<any>;
postPublicImportDirectory: (request: OrganizationImportRequest) => Promise<any>;
getSettingsDomains: () => Promise<DomainsResponse>;
@ -511,10 +491,6 @@ export abstract class ApiService {
request: EmergencyAccessPasswordRequest
) => Promise<any>;
postEmergencyAccessView: (id: string) => Promise<EmergencyAccessViewResponse>;
getOrganization: (id: string) => Promise<OrganizationResponse>;
getOrganizationBilling: (id: string) => Promise<BillingResponse>;
getOrganizationSubscription: (id: string) => Promise<OrganizationSubscriptionResponse>;
getCloudCommunicationsEnabled: () => Promise<boolean>;
abstract getOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
id: string,
@ -531,59 +507,8 @@ export abstract class ApiService {
organizationConnectionId: string
): Promise<OrganizationConnectionResponse<TConfig>>;
deleteOrganizationConnection: (id: string) => Promise<void>;
getOrganizationLicense: (id: string, installationId: string) => Promise<any>;
getOrganizationTaxInfo: (id: string) => Promise<TaxInfoResponse>;
getOrganizationAutoEnrollStatus: (
identifier: string
) => Promise<OrganizationAutoEnrollStatusResponse>;
getOrganizationSso: (id: string) => Promise<OrganizationSsoResponse>;
postOrganization: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
putOrganization: (
id: string,
request: OrganizationUpdateRequest
) => Promise<OrganizationResponse>;
putOrganizationTaxInfo: (id: string, request: OrganizationTaxInfoUpdateRequest) => Promise<any>;
postLeaveOrganization: (id: string) => Promise<any>;
postOrganizationLicense: (data: FormData) => Promise<OrganizationResponse>;
postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise<any>;
postOrganizationApiKey: (
id: string,
request: OrganizationApiKeyRequest
) => Promise<ApiKeyResponse>;
getOrganizationApiKeyInformation: (
id: string,
type?: OrganizationApiKeyType
) => Promise<ListResponse<OrganizationApiKeyInformationResponse>>;
postOrganizationRotateApiKey: (
id: string,
request: OrganizationApiKeyRequest
) => Promise<ApiKeyResponse>;
postOrganizationSso: (
id: string,
request: OrganizationSsoRequest
) => Promise<OrganizationSsoResponse>;
postOrganizationUpgrade: (
id: string,
request: OrganizationUpgradeRequest
) => Promise<PaymentResponse>;
postOrganizationUpdateSubscription: (
id: string,
request: OrganizationSubscriptionUpdateRequest
) => Promise<void>;
postOrganizationSeat: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
postOrganizationStorage: (id: string, request: StorageRequest) => Promise<any>;
postOrganizationPayment: (id: string, request: PaymentRequest) => Promise<any>;
postOrganizationVerifyBank: (id: string, request: VerifyBankRequest) => Promise<any>;
postOrganizationCancel: (id: string) => Promise<any>;
postOrganizationReinstate: (id: string) => Promise<any>;
deleteOrganization: (id: string, request: SecretVerificationRequest) => Promise<any>;
getPlans: () => Promise<ListResponse<PlanResponse>>;
getTaxRates: () => Promise<ListResponse<TaxRateResponse>>;
getOrganizationKeys: (id: string) => Promise<OrganizationKeysResponse>;
postOrganizationKeys: (
id: string,
request: OrganizationKeysRequest
) => Promise<OrganizationKeysResponse>;
postProviderSetup: (id: string, request: ProviderSetupRequest) => Promise<ProviderResponse>;
getProvider: (id: string) => Promise<ProviderResponse>;
@ -673,7 +598,7 @@ export abstract class ApiService {
) => Promise<ListResponse<EventResponse>>;
postEventsCollect: (request: EventRequest[]) => Promise<any>;
deleteSsoUser: (organizationId: string) => Promise<any>;
deleteSsoUser: (organizationId: string) => Promise<void>;
getSsoUserIdentifier: () => Promise<string>;
getUserPublicKey: (id: string) => Promise<UserKeyResponse>;

View File

@ -1,5 +1,9 @@
export interface MessageBase {
command: string;
}
export abstract class BroadcasterService {
send: (message: any, id?: string) => void;
subscribe: (id: string, messageCallback: (message: any) => any) => void;
send: (message: MessageBase, id?: string) => void;
subscribe: (id: string, messageCallback: (message: MessageBase) => void) => void;
unsubscribe: (id: string) => void;
}

View File

@ -0,0 +1,61 @@
import { OrganizationApiKeyType } from "../../enums/organizationApiKeyType";
import { ImportDirectoryRequest } from "../../models/request/importDirectoryRequest";
import { OrganizationSsoRequest } from "../../models/request/organization/organizationSsoRequest";
import { OrganizationApiKeyRequest } from "../../models/request/organizationApiKeyRequest";
import { OrganizationCreateRequest } from "../../models/request/organizationCreateRequest";
import { OrganizationKeysRequest } from "../../models/request/organizationKeysRequest";
import { OrganizationSubscriptionUpdateRequest } from "../../models/request/organizationSubscriptionUpdateRequest";
import { OrganizationTaxInfoUpdateRequest } from "../../models/request/organizationTaxInfoUpdateRequest";
import { OrganizationUpdateRequest } from "../../models/request/organizationUpdateRequest";
import { OrganizationUpgradeRequest } from "../../models/request/organizationUpgradeRequest";
import { PaymentRequest } from "../../models/request/paymentRequest";
import { SeatRequest } from "../../models/request/seatRequest";
import { SecretVerificationRequest } from "../../models/request/secretVerificationRequest";
import { StorageRequest } from "../../models/request/storageRequest";
import { VerifyBankRequest } from "../../models/request/verifyBankRequest";
import { ApiKeyResponse } from "../../models/response/apiKeyResponse";
import { BillingResponse } from "../../models/response/billingResponse";
import { ListResponse } from "../../models/response/listResponse";
import { OrganizationSsoResponse } from "../../models/response/organization/organizationSsoResponse";
import { OrganizationApiKeyInformationResponse } from "../../models/response/organizationApiKeyInformationResponse";
import { OrganizationAutoEnrollStatusResponse } from "../../models/response/organizationAutoEnrollStatusResponse";
import { OrganizationKeysResponse } from "../../models/response/organizationKeysResponse";
import { OrganizationResponse } from "../../models/response/organizationResponse";
import { OrganizationSubscriptionResponse } from "../../models/response/organizationSubscriptionResponse";
import { PaymentResponse } from "../../models/response/paymentResponse";
import { TaxInfoResponse } from "../../models/response/taxInfoResponse";
export class OrganizationApiServiceAbstraction {
get: (id: string) => Promise<OrganizationResponse>;
getBilling: (id: string) => Promise<BillingResponse>;
getSubscription: (id: string) => Promise<OrganizationSubscriptionResponse>;
getLicense: (id: string, installationId: string) => Promise<unknown>;
getAutoEnrollStatus: (identifier: string) => Promise<OrganizationAutoEnrollStatusResponse>;
create: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
createLicense: (data: FormData) => Promise<OrganizationResponse>;
save: (id: string, request: OrganizationUpdateRequest) => Promise<OrganizationResponse>;
updatePayment: (id: string, request: PaymentRequest) => Promise<void>;
upgrade: (id: string, request: OrganizationUpgradeRequest) => Promise<PaymentResponse>;
updateSubscription: (id: string, request: OrganizationSubscriptionUpdateRequest) => Promise<void>;
updateSeats: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
updateStorage: (id: string, request: StorageRequest) => Promise<PaymentResponse>;
verifyBank: (id: string, request: VerifyBankRequest) => Promise<void>;
cancel: (id: string) => Promise<void>;
reinstate: (id: string) => Promise<void>;
leave: (id: string) => Promise<void>;
delete: (id: string, request: SecretVerificationRequest) => Promise<void>;
updateLicense: (id: string, data: FormData) => Promise<void>;
importDirectory: (organizationId: string, request: ImportDirectoryRequest) => Promise<void>;
getOrCreateApiKey: (id: string, request: OrganizationApiKeyRequest) => Promise<ApiKeyResponse>;
getApiKeyInformation: (
id: string,
organizationApiKeyType?: OrganizationApiKeyType
) => Promise<ListResponse<OrganizationApiKeyInformationResponse>>;
rotateApiKey: (id: string, request: OrganizationApiKeyRequest) => Promise<ApiKeyResponse>;
getTaxInfo: (id: string) => Promise<TaxInfoResponse>;
updateTaxInfo: (id: string, request: OrganizationTaxInfoUpdateRequest) => Promise<void>;
getKeys: (id: string) => Promise<OrganizationKeysResponse>;
updateKeys: (id: string, request: OrganizationKeysRequest) => Promise<OrganizationKeysResponse>;
getSso: (id: string) => Promise<OrganizationSsoResponse>;
updateSso: (id: string, request: OrganizationSsoRequest) => Promise<OrganizationSsoResponse>;
}

View File

@ -4,7 +4,6 @@ import { EnvironmentService } from "../abstractions/environment.service";
import { PlatformUtilsService } from "../abstractions/platformUtils.service";
import { TokenService } from "../abstractions/token.service";
import { DeviceType } from "../enums/deviceType";
import { OrganizationApiKeyType } from "../enums/organizationApiKeyType";
import { OrganizationConnectionType } from "../enums/organizationConnectionType";
import { Utils } from "../misc/utils";
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
@ -36,23 +35,14 @@ import { PasswordTokenRequest } from "../models/request/identityToken/passwordTo
import { SsoTokenRequest } from "../models/request/identityToken/ssoTokenRequest";
import { TokenRequestTwoFactor } from "../models/request/identityToken/tokenRequestTwoFactor";
import { ImportCiphersRequest } from "../models/request/importCiphersRequest";
import { ImportDirectoryRequest } from "../models/request/importDirectoryRequest";
import { ImportOrganizationCiphersRequest } from "../models/request/importOrganizationCiphersRequest";
import { KdfRequest } from "../models/request/kdfRequest";
import { KeyConnectorUserKeyRequest } from "../models/request/keyConnectorUserKeyRequest";
import { KeysRequest } from "../models/request/keysRequest";
import { OrganizationSponsorshipCreateRequest } from "../models/request/organization/organizationSponsorshipCreateRequest";
import { OrganizationSponsorshipRedeemRequest } from "../models/request/organization/organizationSponsorshipRedeemRequest";
import { OrganizationSsoRequest } from "../models/request/organization/organizationSsoRequest";
import { OrganizationApiKeyRequest } from "../models/request/organizationApiKeyRequest";
import { OrganizationConnectionRequest } from "../models/request/organizationConnectionRequest";
import { OrganizationCreateRequest } from "../models/request/organizationCreateRequest";
import { OrganizationImportRequest } from "../models/request/organizationImportRequest";
import { OrganizationKeysRequest } from "../models/request/organizationKeysRequest";
import { OrganizationSubscriptionUpdateRequest } from "../models/request/organizationSubscriptionUpdateRequest";
import { OrganizationTaxInfoUpdateRequest } from "../models/request/organizationTaxInfoUpdateRequest";
import { OrganizationUpdateRequest } from "../models/request/organizationUpdateRequest";
import { OrganizationUpgradeRequest } from "../models/request/organizationUpgradeRequest";
import { OrganizationUserAcceptRequest } from "../models/request/organizationUserAcceptRequest";
import { OrganizationUserBulkConfirmRequest } from "../models/request/organizationUserBulkConfirmRequest";
import { OrganizationUserBulkRequest } from "../models/request/organizationUserBulkRequest";
@ -77,7 +67,6 @@ import { ProviderUserConfirmRequest } from "../models/request/provider/providerU
import { ProviderUserInviteRequest } from "../models/request/provider/providerUserInviteRequest";
import { ProviderUserUpdateRequest } from "../models/request/provider/providerUserUpdateRequest";
import { RegisterRequest } from "../models/request/registerRequest";
import { SeatRequest } from "../models/request/seatRequest";
import { SecretVerificationRequest } from "../models/request/secretVerificationRequest";
import { SelectionReadOnlyRequest } from "../models/request/selectionReadOnlyRequest";
import { SendAccessRequest } from "../models/request/sendAccessRequest";
@ -98,7 +87,6 @@ import { UpdateTwoFactorEmailRequest } from "../models/request/updateTwoFactorEm
import { UpdateTwoFactorWebAuthnDeleteRequest } from "../models/request/updateTwoFactorWebAuthnDeleteRequest";
import { UpdateTwoFactorWebAuthnRequest } from "../models/request/updateTwoFactorWebAuthnRequest";
import { UpdateTwoFactorYubioOtpRequest } from "../models/request/updateTwoFactorYubioOtpRequest";
import { VerifyBankRequest } from "../models/request/verifyBankRequest";
import { VerifyDeleteRecoverRequest } from "../models/request/verifyDeleteRecoverRequest";
import { VerifyEmailRequest } from "../models/request/verifyEmailRequest";
import { ApiKeyResponse } from "../models/response/apiKeyResponse";
@ -106,7 +94,6 @@ import { AttachmentResponse } from "../models/response/attachmentResponse";
import { AttachmentUploadDataResponse } from "../models/response/attachmentUploadDataResponse";
import { BillingHistoryResponse } from "../models/response/billingHistoryResponse";
import { BillingPaymentResponse } from "../models/response/billingPaymentResponse";
import { BillingResponse } from "../models/response/billingResponse";
import { BreachAccountResponse } from "../models/response/breachAccountResponse";
import { CipherResponse } from "../models/response/cipherResponse";
import {
@ -129,18 +116,12 @@ import { IdentityTokenResponse } from "../models/response/identityTokenResponse"
import { IdentityTwoFactorResponse } from "../models/response/identityTwoFactorResponse";
import { KeyConnectorUserKeyResponse } from "../models/response/keyConnectorUserKeyResponse";
import { ListResponse } from "../models/response/listResponse";
import { OrganizationSsoResponse } from "../models/response/organization/organizationSsoResponse";
import { OrganizationApiKeyInformationResponse } from "../models/response/organizationApiKeyInformationResponse";
import { OrganizationAutoEnrollStatusResponse } from "../models/response/organizationAutoEnrollStatusResponse";
import {
OrganizationConnectionConfigApis,
OrganizationConnectionResponse,
} from "../models/response/organizationConnectionResponse";
import { OrganizationExportResponse } from "../models/response/organizationExportResponse";
import { OrganizationKeysResponse } from "../models/response/organizationKeysResponse";
import { OrganizationResponse } from "../models/response/organizationResponse";
import { OrganizationSponsorshipSyncStatusResponse } from "../models/response/organizationSponsorshipSyncStatusResponse";
import { OrganizationSubscriptionResponse } from "../models/response/organizationSubscriptionResponse";
import { OrganizationUserBulkPublicKeyResponse } from "../models/response/organizationUserBulkPublicKeyResponse";
import { OrganizationUserBulkResponse } from "../models/response/organizationUserBulkResponse";
import {
@ -391,7 +372,7 @@ export class ApiService implements ApiServiceAbstraction {
return new PaymentResponse(r);
}
postAccountPayment(request: PaymentRequest): Promise<any> {
postAccountPayment(request: PaymentRequest): Promise<void> {
return this.send("POST", "/accounts/payment", request, true, false);
}
@ -431,7 +412,7 @@ export class ApiService implements ApiServiceAbstraction {
return this.send("POST", "/accounts/kdf", request, true, false);
}
async deleteSsoUser(organizationId: string): Promise<any> {
async deleteSsoUser(organizationId: string): Promise<void> {
return this.send("DELETE", "/accounts/sso/" + organizationId, null, true, false);
}
@ -1067,19 +1048,6 @@ export class ApiService implements ApiServiceAbstraction {
return new OrganizationUserResetPasswordDetailsReponse(r);
}
async getOrganizationAutoEnrollStatus(
identifier: string
): Promise<OrganizationAutoEnrollStatusResponse> {
const r = await this.send(
"GET",
"/organizations/" + identifier + "/auto-enroll-status",
null,
true,
true
);
return new OrganizationAutoEnrollStatusResponse(r);
}
postOrganizationUserInvite(
organizationId: string,
request: OrganizationUserInviteRequest
@ -1205,7 +1173,7 @@ export class ApiService implements ApiServiceAbstraction {
organizationId: string,
userId: string,
request: OrganizationUserResetPasswordEnrollmentRequest
): Promise<any> {
): Promise<void> {
return this.send(
"PUT",
"/organizations/" + organizationId + "/users/" + userId + "/reset-password-enrollment",
@ -1308,10 +1276,6 @@ export class ApiService implements ApiServiceAbstraction {
return new ListResponse(r, PlanResponse);
}
async postImportDirectory(organizationId: string, request: ImportDirectoryRequest): Promise<any> {
return this.send("POST", "/organizations/" + organizationId + "/import", request, true, false);
}
async postPublicImportDirectory(request: OrganizationImportRequest): Promise<any> {
return this.send("POST", "/public/organization/import", request, true, false);
}
@ -1614,21 +1578,6 @@ export class ApiService implements ApiServiceAbstraction {
// Organization APIs
async getOrganization(id: string): Promise<OrganizationResponse> {
const r = await this.send("GET", "/organizations/" + id, null, true, true);
return new OrganizationResponse(r);
}
async getOrganizationBilling(id: string): Promise<BillingResponse> {
const r = await this.send("GET", "/organizations/" + id + "/billing", null, true, true);
return new BillingResponse(r);
}
async getOrganizationSubscription(id: string): Promise<OrganizationSubscriptionResponse> {
const r = await this.send("GET", "/organizations/" + id + "/subscription", null, true, true);
return new OrganizationSubscriptionResponse(r);
}
async getCloudCommunicationsEnabled(): Promise<boolean> {
const r = await this.send("GET", "/organizations/connections/enabled", null, true, true);
return r as boolean;
@ -1670,159 +1619,6 @@ export class ApiService implements ApiServiceAbstraction {
return this.send("DELETE", "/organizations/connections/" + id, null, true, false);
}
async getOrganizationLicense(id: string, installationId: string): Promise<any> {
return this.send(
"GET",
"/organizations/" + id + "/license?installationId=" + installationId,
null,
true,
true
);
}
async getOrganizationTaxInfo(id: string): Promise<TaxInfoResponse> {
const r = await this.send("GET", "/organizations/" + id + "/tax", null, true, true);
return new TaxInfoResponse(r);
}
async getOrganizationSso(id: string): Promise<OrganizationSsoResponse> {
const r = await this.send("GET", "/organizations/" + id + "/sso", null, true, true);
return new OrganizationSsoResponse(r);
}
async postOrganization(request: OrganizationCreateRequest): Promise<OrganizationResponse> {
const r = await this.send("POST", "/organizations", request, true, true);
return new OrganizationResponse(r);
}
async putOrganization(
id: string,
request: OrganizationUpdateRequest
): Promise<OrganizationResponse> {
const r = await this.send("PUT", "/organizations/" + id, request, true, true);
return new OrganizationResponse(r);
}
async putOrganizationTaxInfo(
id: string,
request: OrganizationTaxInfoUpdateRequest
): Promise<any> {
return this.send("PUT", "/organizations/" + id + "/tax", request, true, false);
}
postLeaveOrganization(id: string): Promise<any> {
return this.send("POST", "/organizations/" + id + "/leave", null, true, false);
}
async postOrganizationLicense(data: FormData): Promise<OrganizationResponse> {
const r = await this.send("POST", "/organizations/license", data, true, true);
return new OrganizationResponse(r);
}
async postOrganizationLicenseUpdate(id: string, data: FormData): Promise<any> {
return this.send("POST", "/organizations/" + id + "/license", data, true, false);
}
async postOrganizationApiKey(
id: string,
request: OrganizationApiKeyRequest
): Promise<ApiKeyResponse> {
const r = await this.send("POST", "/organizations/" + id + "/api-key", request, true, true);
return new ApiKeyResponse(r);
}
async getOrganizationApiKeyInformation(
id: string,
type: OrganizationApiKeyType = null
): Promise<ListResponse<OrganizationApiKeyInformationResponse>> {
const uri =
type === null
? "/organizations/" + id + "/api-key-information"
: "/organizations/" + id + "/api-key-information/" + type;
const r = await this.send("GET", uri, null, true, true);
return new ListResponse(r, OrganizationApiKeyInformationResponse);
}
async postOrganizationRotateApiKey(
id: string,
request: OrganizationApiKeyRequest
): Promise<ApiKeyResponse> {
const r = await this.send(
"POST",
"/organizations/" + id + "/rotate-api-key",
request,
true,
true
);
return new ApiKeyResponse(r);
}
async postOrganizationSso(
id: string,
request: OrganizationSsoRequest
): Promise<OrganizationSsoResponse> {
const r = await this.send("POST", "/organizations/" + id + "/sso", request, true, true);
return new OrganizationSsoResponse(r);
}
async postOrganizationUpgrade(
id: string,
request: OrganizationUpgradeRequest
): Promise<PaymentResponse> {
const r = await this.send("POST", "/organizations/" + id + "/upgrade", request, true, true);
return new PaymentResponse(r);
}
async postOrganizationUpdateSubscription(
id: string,
request: OrganizationSubscriptionUpdateRequest
): Promise<void> {
return this.send("POST", "/organizations/" + id + "/subscription", request, true, false);
}
async postOrganizationSeat(id: string, request: SeatRequest): Promise<PaymentResponse> {
const r = await this.send("POST", "/organizations/" + id + "/seat", request, true, true);
return new PaymentResponse(r);
}
async postOrganizationStorage(id: string, request: StorageRequest): Promise<PaymentResponse> {
const r = await this.send("POST", "/organizations/" + id + "/storage", request, true, true);
return new PaymentResponse(r);
}
postOrganizationPayment(id: string, request: PaymentRequest): Promise<any> {
return this.send("POST", "/organizations/" + id + "/payment", request, true, false);
}
postOrganizationVerifyBank(id: string, request: VerifyBankRequest): Promise<any> {
return this.send("POST", "/organizations/" + id + "/verify-bank", request, true, false);
}
postOrganizationCancel(id: string): Promise<any> {
return this.send("POST", "/organizations/" + id + "/cancel", null, true, false);
}
postOrganizationReinstate(id: string): Promise<any> {
return this.send("POST", "/organizations/" + id + "/reinstate", null, true, false);
}
deleteOrganization(id: string, request: SecretVerificationRequest): Promise<any> {
return this.send("DELETE", "/organizations/" + id, request, true, false);
}
async getOrganizationKeys(id: string): Promise<OrganizationKeysResponse> {
const r = await this.send("GET", "/organizations/" + id + "/keys", null, true, true);
return new OrganizationKeysResponse(r);
}
async postOrganizationKeys(
id: string,
request: OrganizationKeysRequest
): Promise<OrganizationKeysResponse> {
const r = await this.send("POST", "/organizations/" + id + "/keys", request, true, true);
return new OrganizationKeysResponse(r);
}
// Provider APIs
async postProviderSetup(id: string, request: ProviderSetupRequest) {

View File

@ -1,9 +1,15 @@
import { BroadcasterService as BroadcasterServiceAbstraction } from "../abstractions/broadcaster.service";
import {
BroadcasterService as BroadcasterServiceAbstraction,
MessageBase,
} from "../abstractions/broadcaster.service";
export class BroadcasterService implements BroadcasterServiceAbstraction {
subscribers: Map<string, (message: any) => any> = new Map<string, (message: any) => any>();
subscribers: Map<string, (message: MessageBase) => void> = new Map<
string,
(message: MessageBase) => void
>();
send(message: any, id?: string) {
send(message: MessageBase, id?: string) {
if (id != null) {
if (this.subscribers.has(id)) {
this.subscribers.get(id)(message);
@ -16,7 +22,7 @@ export class BroadcasterService implements BroadcasterServiceAbstraction {
});
}
subscribe(id: string, messageCallback: (message: any) => any) {
subscribe(id: string, messageCallback: (message: MessageBase) => void) {
this.subscribers.set(id, messageCallback);
}

View File

@ -0,0 +1,263 @@
import { ApiService } from "../../abstractions/api.service";
import { OrganizationApiServiceAbstraction } from "../../abstractions/organization/organization-api.service.abstraction";
import { OrganizationApiKeyType } from "../../enums/organizationApiKeyType";
import { ImportDirectoryRequest } from "../../models/request/importDirectoryRequest";
import { OrganizationSsoRequest } from "../../models/request/organization/organizationSsoRequest";
import { OrganizationApiKeyRequest } from "../../models/request/organizationApiKeyRequest";
import { OrganizationCreateRequest } from "../../models/request/organizationCreateRequest";
import { OrganizationKeysRequest } from "../../models/request/organizationKeysRequest";
import { OrganizationSubscriptionUpdateRequest } from "../../models/request/organizationSubscriptionUpdateRequest";
import { OrganizationTaxInfoUpdateRequest } from "../../models/request/organizationTaxInfoUpdateRequest";
import { OrganizationUpdateRequest } from "../../models/request/organizationUpdateRequest";
import { OrganizationUpgradeRequest } from "../../models/request/organizationUpgradeRequest";
import { PaymentRequest } from "../../models/request/paymentRequest";
import { SeatRequest } from "../../models/request/seatRequest";
import { SecretVerificationRequest } from "../../models/request/secretVerificationRequest";
import { StorageRequest } from "../../models/request/storageRequest";
import { VerifyBankRequest } from "../../models/request/verifyBankRequest";
import { ApiKeyResponse } from "../../models/response/apiKeyResponse";
import { BillingResponse } from "../../models/response/billingResponse";
import { ListResponse } from "../../models/response/listResponse";
import { OrganizationSsoResponse } from "../../models/response/organization/organizationSsoResponse";
import { OrganizationApiKeyInformationResponse } from "../../models/response/organizationApiKeyInformationResponse";
import { OrganizationAutoEnrollStatusResponse } from "../../models/response/organizationAutoEnrollStatusResponse";
import { OrganizationKeysResponse } from "../../models/response/organizationKeysResponse";
import { OrganizationResponse } from "../../models/response/organizationResponse";
import { OrganizationSubscriptionResponse } from "../../models/response/organizationSubscriptionResponse";
import { PaymentResponse } from "../../models/response/paymentResponse";
import { TaxInfoResponse } from "../../models/response/taxInfoResponse";
export class OrganizationApiService implements OrganizationApiServiceAbstraction {
constructor(private apiService: ApiService) {}
async get(id: string): Promise<OrganizationResponse> {
const r = await this.apiService.send("GET", "/organizations/" + id, null, true, true);
return new OrganizationResponse(r);
}
async getBilling(id: string): Promise<BillingResponse> {
const r = await this.apiService.send(
"GET",
"/organizations/" + id + "/billing",
null,
true,
true
);
return new BillingResponse(r);
}
async getSubscription(id: string): Promise<OrganizationSubscriptionResponse> {
const r = await this.apiService.send(
"GET",
"/organizations/" + id + "/subscription",
null,
true,
true
);
return new OrganizationSubscriptionResponse(r);
}
async getLicense(id: string, installationId: string): Promise<unknown> {
return this.apiService.send(
"GET",
"/organizations/" + id + "/license?installationId=" + installationId,
null,
true,
true
);
}
async getAutoEnrollStatus(identifier: string): Promise<OrganizationAutoEnrollStatusResponse> {
const r = await this.apiService.send(
"GET",
"/organizations/" + identifier + "/auto-enroll-status",
null,
true,
true
);
return new OrganizationAutoEnrollStatusResponse(r);
}
async create(request: OrganizationCreateRequest): Promise<OrganizationResponse> {
const r = await this.apiService.send("POST", "/organizations", request, true, true);
return new OrganizationResponse(r);
}
async createLicense(data: FormData): Promise<OrganizationResponse> {
const r = await this.apiService.send("POST", "/organizations/license", data, true, true);
return new OrganizationResponse(r);
}
async save(id: string, request: OrganizationUpdateRequest): Promise<OrganizationResponse> {
const r = await this.apiService.send("PUT", "/organizations/" + id, request, true, true);
return new OrganizationResponse(r);
}
async updatePayment(id: string, request: PaymentRequest): Promise<void> {
return this.apiService.send("POST", "/organizations/" + id + "/payment", request, true, false);
}
async upgrade(id: string, request: OrganizationUpgradeRequest): Promise<PaymentResponse> {
const r = await this.apiService.send(
"POST",
"/organizations/" + id + "/upgrade",
request,
true,
true
);
return new PaymentResponse(r);
}
async updateSubscription(
id: string,
request: OrganizationSubscriptionUpdateRequest
): Promise<void> {
return this.apiService.send(
"POST",
"/organizations/" + id + "/subscription",
request,
true,
false
);
}
async updateSeats(id: string, request: SeatRequest): Promise<PaymentResponse> {
const r = await this.apiService.send(
"POST",
"/organizations/" + id + "/seat",
request,
true,
true
);
return new PaymentResponse(r);
}
async updateStorage(id: string, request: StorageRequest): Promise<PaymentResponse> {
const r = await this.apiService.send(
"POST",
"/organizations/" + id + "/storage",
request,
true,
true
);
return new PaymentResponse(r);
}
async verifyBank(id: string, request: VerifyBankRequest): Promise<void> {
return this.apiService.send(
"POST",
"/organizations/" + id + "/verify-bank",
request,
true,
false
);
}
async cancel(id: string): Promise<void> {
return this.apiService.send("POST", "/organizations/" + id + "/cancel", null, true, false);
}
async reinstate(id: string): Promise<void> {
return this.apiService.send("POST", "/organizations/" + id + "/reinstate", null, true, false);
}
async leave(id: string): Promise<void> {
return this.apiService.send("POST", "/organizations/" + id + "/leave", null, true, false);
}
async delete(id: string, request: SecretVerificationRequest): Promise<void> {
return this.apiService.send("DELETE", "/organizations/" + id, request, true, false);
}
async updateLicense(id: string, data: FormData): Promise<void> {
return this.apiService.send("POST", "/organizations/" + id + "/license", data, true, false);
}
async importDirectory(organizationId: string, request: ImportDirectoryRequest): Promise<void> {
return this.apiService.send(
"POST",
"/organizations/" + organizationId + "/import",
request,
true,
false
);
}
async getOrCreateApiKey(id: string, request: OrganizationApiKeyRequest): Promise<ApiKeyResponse> {
const r = await this.apiService.send(
"POST",
"/organizations/" + id + "/api-key",
request,
true,
true
);
return new ApiKeyResponse(r);
}
async getApiKeyInformation(
id: string,
organizationApiKeyType: OrganizationApiKeyType = null
): Promise<ListResponse<OrganizationApiKeyInformationResponse>> {
const uri =
organizationApiKeyType === null
? "/organizations/" + id + "/api-key-information"
: "/organizations/" + id + "/api-key-information/" + organizationApiKeyType;
const r = await this.apiService.send("GET", uri, null, true, true);
return new ListResponse(r, OrganizationApiKeyInformationResponse);
}
async rotateApiKey(id: string, request: OrganizationApiKeyRequest): Promise<ApiKeyResponse> {
const r = await this.apiService.send(
"POST",
"/organizations/" + id + "/rotate-api-key",
request,
true,
true
);
return new ApiKeyResponse(r);
}
async getTaxInfo(id: string): Promise<TaxInfoResponse> {
const r = await this.apiService.send("GET", "/organizations/" + id + "/tax", null, true, true);
return new TaxInfoResponse(r);
}
async updateTaxInfo(id: string, request: OrganizationTaxInfoUpdateRequest): Promise<void> {
return this.apiService.send("PUT", "/organizations/" + id + "/tax", request, true, false);
}
async getKeys(id: string): Promise<OrganizationKeysResponse> {
const r = await this.apiService.send("GET", "/organizations/" + id + "/keys", null, true, true);
return new OrganizationKeysResponse(r);
}
async updateKeys(
id: string,
request: OrganizationKeysRequest
): Promise<OrganizationKeysResponse> {
const r = await this.apiService.send(
"POST",
"/organizations/" + id + "/keys",
request,
true,
true
);
return new OrganizationKeysResponse(r);
}
async getSso(id: string): Promise<OrganizationSsoResponse> {
const r = await this.apiService.send("GET", "/organizations/" + id + "/sso", null, true, true);
return new OrganizationSsoResponse(r);
}
async updateSso(id: string, request: OrganizationSsoRequest): Promise<OrganizationSsoResponse> {
const r = await this.apiService.send(
"POST",
"/organizations/" + id + "/sso",
request,
true,
true
);
return new OrganizationSsoResponse(r);
}
}