1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-03 09:03:32 +00:00

Remove Business Portal, add SSO configuration models (#506)

This commit is contained in:
Oscar Hinton
2021-10-06 19:36:20 +02:00
committed by GitHub
parent 91c5393ae7
commit bfa9a1e1bc
14 changed files with 175 additions and 65 deletions

View File

@@ -33,6 +33,7 @@ import { ImportDirectoryRequest } from '../models/request/importDirectoryRequest
import { ImportOrganizationCiphersRequest } from '../models/request/importOrganizationCiphersRequest';
import { KdfRequest } from '../models/request/kdfRequest';
import { KeysRequest } from '../models/request/keysRequest';
import { OrganizationSsoRequest } from '../models/request/organization/organizationSsoRequest';
import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest';
import { OrganizationImportRequest } from '../models/request/organizationImportRequest';
import { OrganizationKeysRequest } from '../models/request/organizationKeysRequest';
@@ -117,9 +118,11 @@ import {
GroupDetailsResponse,
GroupResponse,
} from '../models/response/groupResponse';
import { IdentityCaptchaResponse } from '../models/response/identityCaptchaResponse';
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
import { ListResponse } from '../models/response/listResponse';
import { OrganizationSsoResponse } from '../models/response/organization/organizationSsoResponse';
import { OrganizationAutoEnrollStatusResponse } from '../models/response/organizationAutoEnrollStatusResponse';
import { OrganizationKeysResponse } from '../models/response/organizationKeysResponse';
import { OrganizationResponse } from '../models/response/organizationResponse';
@@ -163,7 +166,6 @@ import { ChallengeResponse } from '../models/response/twoFactorWebAuthnResponse'
import { TwoFactorYubiKeyResponse } from '../models/response/twoFactorYubiKeyResponse';
import { UserKeyResponse } from '../models/response/userKeyResponse';
import { IdentityCaptchaResponse } from '../models/response/identityCaptchaResponse';
import { SendAccessView } from '../models/view/sendAccessView';
export class ApiService implements ApiServiceAbstraction {
@@ -370,11 +372,6 @@ export class ApiService implements ApiServiceAbstraction {
return this.send('POST', '/accounts/kdf', request, true, false);
}
async getEnterprisePortalSignInToken(): Promise<string> {
const r = await this.send('GET', '/accounts/enterprise-portal-signin-token', null, true, true);
return r as string;
}
async deleteSsoUser(organizationId: string): Promise<any> {
return this.send('DELETE', '/accounts/sso/' + organizationId, null, true, false);
}
@@ -1151,6 +1148,11 @@ export class ApiService implements ApiServiceAbstraction {
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);
@@ -1188,6 +1190,11 @@ export class ApiService implements ApiServiceAbstraction {
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);

View File

@@ -19,7 +19,6 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
private iconsUrl: string;
private notificationsUrl: string;
private eventsUrl: string;
private enterpriseUrl: string;
constructor(private storageService: StorageService) {}
@@ -39,18 +38,6 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
return 'https://notifications.bitwarden.com';
}
getEnterpriseUrl() {
if (this.enterpriseUrl != null) {
return this.enterpriseUrl;
}
if (this.baseUrl != null) {
return this.baseUrl + '/portal';
}
return 'https://portal.bitwarden.com';
}
getWebVaultUrl() {
if (this.webVaultUrl != null) {
return this.webVaultUrl;
@@ -126,7 +113,6 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
notifications: null,
events: null,
webVault: null,
enterprise: null,
};
const envUrls = new EnvironmentUrls();
@@ -142,7 +128,6 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
this.iconsUrl = urls.icons;
this.notificationsUrl = urls.notifications;
this.eventsUrl = envUrls.events = urls.events;
this.enterpriseUrl = urls.enterprise;
}
async setUrls(urls: Urls, saveSettings: boolean = true): Promise<any> {
@@ -153,7 +138,6 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
urls.icons = this.formatUrl(urls.icons);
urls.notifications = this.formatUrl(urls.notifications);
urls.events = this.formatUrl(urls.events);
urls.enterprise = this.formatUrl(urls.enterprise);
if (saveSettings) {
await this.storageService.save(ConstantsService.environmentUrlsKey, {
@@ -164,7 +148,6 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
icons: urls.icons,
notifications: urls.notifications,
events: urls.events,
enterprise: urls.enterprise,
});
}
@@ -175,7 +158,6 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
this.iconsUrl = urls.icons;
this.notificationsUrl = urls.notifications;
this.eventsUrl = urls.events;
this.enterpriseUrl = urls.enterprise;
this.urlsSubject.next(urls);
@@ -191,7 +173,6 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
icons: this.iconsUrl,
notifications: this.notificationsUrl,
events: this.eventsUrl,
enterprise: this.enterpriseUrl,
};
}