mirror of
https://github.com/bitwarden/jslib
synced 2025-12-15 07:43:45 +00:00
Remove Business Portal, add SSO configuration models (#506)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
export class PermissionsApi extends BaseResponse {
|
||||
accessBusinessPortal: boolean;
|
||||
accessEventLogs: boolean;
|
||||
accessImportExport: boolean;
|
||||
accessReports: boolean;
|
||||
@@ -32,7 +31,6 @@ export class PermissionsApi extends BaseResponse {
|
||||
if (data == null) {
|
||||
return this;
|
||||
}
|
||||
this.accessBusinessPortal = this.getResponseProperty('AccessBusinessPortal');
|
||||
this.accessEventLogs = this.getResponseProperty('AccessEventLogs');
|
||||
this.accessImportExport = this.getResponseProperty('AccessImportExport');
|
||||
this.accessReports = this.getResponseProperty('AccessReports');
|
||||
|
||||
112
common/src/models/api/ssoConfigApi.ts
Normal file
112
common/src/models/api/ssoConfigApi.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
import { BaseResponse } from '../response/baseResponse';
|
||||
|
||||
enum SsoType {
|
||||
OpenIdConnect = 1,
|
||||
Saml2 = 2,
|
||||
}
|
||||
|
||||
enum OpenIdConnectRedirectBehavior {
|
||||
RedirectGet = 0,
|
||||
FormPost = 1,
|
||||
}
|
||||
|
||||
enum Saml2BindingType {
|
||||
HttpRedirect = 1,
|
||||
HttpPost = 2,
|
||||
Artifact = 4,
|
||||
}
|
||||
|
||||
enum Saml2NameIdFormat {
|
||||
NotConfigured = 0,
|
||||
Unspecified = 1,
|
||||
EmailAddress = 2,
|
||||
X509SubjectName = 3,
|
||||
WindowsDomainQualifiedName = 4,
|
||||
KerberosPrincipalName = 5,
|
||||
EntityIdentifier = 6,
|
||||
Persistent = 7,
|
||||
Transient = 8,
|
||||
}
|
||||
|
||||
enum Saml2SigningBehavior {
|
||||
IfIdpWantAuthnRequestsSigned = 0,
|
||||
Always = 1,
|
||||
Never = 3,
|
||||
}
|
||||
|
||||
export class SsoConfigApi extends BaseResponse {
|
||||
configType: SsoType;
|
||||
|
||||
// OpenId
|
||||
authority: string;
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
metadataAddress: string;
|
||||
redirectBehavior: OpenIdConnectRedirectBehavior;
|
||||
getClaimsFromUserInfoEndpoint: boolean;
|
||||
additionalScopes: string;
|
||||
additionalUserIdClaimTypes: string;
|
||||
additionalEmailClaimTypes: string;
|
||||
additionalNameClaimTypes: string;
|
||||
acrValues: string;
|
||||
expectedReturnAcrValue: string;
|
||||
|
||||
// SAML
|
||||
spNameIdFormat: Saml2NameIdFormat;
|
||||
spOutboundSigningAlgorithm: string;
|
||||
spSigningBehavior: Saml2SigningBehavior;
|
||||
spMinIncomingSigningAlgorithm: boolean;
|
||||
spWantAssertionsSigned: boolean;
|
||||
spValidateCertificates: boolean;
|
||||
|
||||
idpEntityId: string;
|
||||
idpBindingType: Saml2BindingType;
|
||||
idpSingleSignOnServiceUrl: string;
|
||||
idpSingleLogoutServiceUrl: string;
|
||||
idpArtifactResolutionServiceUrl: string;
|
||||
idpX509PublicCert: string;
|
||||
idpOutboundSigningAlgorithm: string;
|
||||
idpAllowUnsolicitedAuthnResponse: boolean;
|
||||
idpDisableOutboundLogoutRequests: boolean;
|
||||
idpWantAuthnRequestsSigned: boolean;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.configType = this.getResponseProperty('ConfigType');
|
||||
|
||||
this.authority = this.getResponseProperty('Authority');
|
||||
this.clientId = this.getResponseProperty('ClientId');
|
||||
this.clientSecret = this.getResponseProperty('ClientSecret');
|
||||
this.metadataAddress = this.getResponseProperty('MetadataAddress');
|
||||
this.redirectBehavior = this.getResponseProperty('RedirectBehavior');
|
||||
this.getClaimsFromUserInfoEndpoint = this.getResponseProperty('GetClaimsFromUserInfoEndpoint');
|
||||
this.additionalScopes = this.getResponseProperty('AdditionalScopes');
|
||||
this.additionalUserIdClaimTypes = this.getResponseProperty('AdditionalUserIdClaimTypes');
|
||||
this.additionalEmailClaimTypes = this.getResponseProperty('AdditionalEmailClaimTypes');
|
||||
this.additionalNameClaimTypes = this.getResponseProperty('AdditionalNameClaimTypes');
|
||||
this.acrValues = this.getResponseProperty('AcrValues');
|
||||
this.expectedReturnAcrValue = this.getResponseProperty('ExpectedReturnAcrValue');
|
||||
|
||||
this.spNameIdFormat = this.getResponseProperty('SpNameIdFormat');
|
||||
this.spOutboundSigningAlgorithm = this.getResponseProperty('SpOutboundSigningAlgorithm');
|
||||
this.spSigningBehavior = this.getResponseProperty('SpSigningBehavior');
|
||||
this.spMinIncomingSigningAlgorithm = this.getResponseProperty('SpMinIncomingSigningAlgorithm');
|
||||
this.spWantAssertionsSigned = this.getResponseProperty('SpWantAssertionsSigned');
|
||||
this.spValidateCertificates = this.getResponseProperty('SpValidateCertificates');
|
||||
|
||||
this.idpEntityId = this.getResponseProperty('IdpEntityId');
|
||||
this.idpBindingType = this.getResponseProperty('IdpBindingType');
|
||||
this.idpSingleSignOnServiceUrl = this.getResponseProperty('IdpSingleSignOnServiceUrl');
|
||||
this.idpSingleLogoutServiceUrl = this.getResponseProperty('IdpSingleLogoutServiceUrl');
|
||||
this.idpArtifactResolutionServiceUrl = this.getResponseProperty('IdpArtifactResolutionServiceUrl');
|
||||
this.idpX509PublicCert = this.getResponseProperty('IdpX509PublicCert');
|
||||
this.idpOutboundSigningAlgorithm = this.getResponseProperty('IdpOutboundSigningAlgorithm');
|
||||
this.idpAllowUnsolicitedAuthnResponse = this.getResponseProperty('IdpAllowUnsolicitedAuthnResponse');
|
||||
this.idpDisableOutboundLogoutRequests = this.getResponseProperty('IdpDisableOutboundLogoutRequests');
|
||||
this.idpWantAuthnRequestsSigned = this.getResponseProperty('IdpWantAuthnRequestsSigned');
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ export class OrganizationData {
|
||||
useTotp: boolean;
|
||||
use2fa: boolean;
|
||||
useApi: boolean;
|
||||
useBusinessPortal: boolean;
|
||||
useSso: boolean;
|
||||
useResetPassword: boolean;
|
||||
selfHost: boolean;
|
||||
@@ -48,7 +47,6 @@ export class OrganizationData {
|
||||
this.useTotp = response.useTotp;
|
||||
this.use2fa = response.use2fa;
|
||||
this.useApi = response.useApi;
|
||||
this.useBusinessPortal = response.useBusinessPortal;
|
||||
this.useSso = response.useSso;
|
||||
this.useResetPassword = response.useResetPassword;
|
||||
this.selfHost = response.selfHost;
|
||||
|
||||
@@ -18,7 +18,6 @@ export class Organization {
|
||||
useTotp: boolean;
|
||||
use2fa: boolean;
|
||||
useApi: boolean;
|
||||
useBusinessPortal: boolean;
|
||||
useSso: boolean;
|
||||
useResetPassword: boolean;
|
||||
selfHost: boolean;
|
||||
@@ -53,7 +52,6 @@ export class Organization {
|
||||
this.useTotp = obj.useTotp;
|
||||
this.use2fa = obj.use2fa;
|
||||
this.useApi = obj.useApi;
|
||||
this.useBusinessPortal = obj.useBusinessPortal;
|
||||
this.useSso = obj.useSso;
|
||||
this.useResetPassword = obj.useResetPassword;
|
||||
this.selfHost = obj.selfHost;
|
||||
@@ -92,10 +90,6 @@ export class Organization {
|
||||
return this.type === OrganizationUserType.Owner || this.isProviderUser;
|
||||
}
|
||||
|
||||
get canAccessBusinessPortal() {
|
||||
return this.isAdmin || this.permissions.accessBusinessPortal;
|
||||
}
|
||||
|
||||
get canAccessEventLogs() {
|
||||
return this.isAdmin || this.permissions.accessEventLogs;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { SsoConfigApi } from '../../api/ssoConfigApi';
|
||||
|
||||
export class OrganizationSsoRequest {
|
||||
enabled: boolean = false;
|
||||
data: SsoConfigApi;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { SsoConfigApi } from '../../api/ssoConfigApi';
|
||||
import { BaseResponse } from '../baseResponse';
|
||||
|
||||
export class OrganizationSsoResponse extends BaseResponse {
|
||||
enabled: boolean;
|
||||
data: SsoConfigApi;
|
||||
urls: SsoUrls;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.enabled = this.getResponseProperty('Enabled');
|
||||
this.data = new SsoConfigApi(this.getResponseProperty('Data'));
|
||||
this.urls = this.getResponseProperty('Urls');
|
||||
}
|
||||
}
|
||||
|
||||
type SsoUrls = {
|
||||
callbackPath: string;
|
||||
signedOutCallbackPath: string;
|
||||
spEntityId: string;
|
||||
spMetadataUrl: string;
|
||||
spAcsUrl: string;
|
||||
};
|
||||
@@ -14,7 +14,6 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
||||
useTotp: boolean;
|
||||
use2fa: boolean;
|
||||
useApi: boolean;
|
||||
useBusinessPortal: boolean;
|
||||
useSso: boolean;
|
||||
useResetPassword: boolean;
|
||||
selfHost: boolean;
|
||||
@@ -46,7 +45,6 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
||||
this.useTotp = this.getResponseProperty('UseTotp');
|
||||
this.use2fa = this.getResponseProperty('Use2fa');
|
||||
this.useApi = this.getResponseProperty('UseApi');
|
||||
this.useBusinessPortal = this.getResponseProperty('UseBusinessPortal');
|
||||
this.useSso = this.getResponseProperty('UseSso');
|
||||
this.useResetPassword = this.getResponseProperty('UseResetPassword');
|
||||
this.selfHost = this.getResponseProperty('SelfHost');
|
||||
|
||||
@@ -14,7 +14,6 @@ export class ProfileProviderOrganizationResponse extends BaseResponse {
|
||||
useTotp: boolean;
|
||||
use2fa: boolean;
|
||||
useApi: boolean;
|
||||
useBusinessPortal: boolean;
|
||||
useSso: boolean;
|
||||
useResetPassword: boolean;
|
||||
selfHost: boolean;
|
||||
@@ -46,7 +45,6 @@ export class ProfileProviderOrganizationResponse extends BaseResponse {
|
||||
this.useTotp = this.getResponseProperty('UseTotp');
|
||||
this.use2fa = this.getResponseProperty('Use2fa');
|
||||
this.useApi = this.getResponseProperty('UseApi');
|
||||
this.useBusinessPortal = this.getResponseProperty('UseBusinessPortal');
|
||||
this.useSso = this.getResponseProperty('UseSso');
|
||||
this.useResetPassword = this.getResponseProperty('UseResetPassword');
|
||||
this.selfHost = this.getResponseProperty('SelfHost');
|
||||
|
||||
Reference in New Issue
Block a user