1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

Add useKeyConnector flag (#551)

This commit is contained in:
Oscar Hinton 2021-11-17 11:42:24 +01:00 committed by GitHub
parent 720967475b
commit e1b1efeea2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 10 deletions

View File

@ -37,7 +37,7 @@ enum Saml2SigningBehavior {
export class SsoConfigApi extends BaseResponse { export class SsoConfigApi extends BaseResponse {
configType: SsoType; configType: SsoType;
useKeyConnector: boolean; keyConnectorEnabled: boolean;
keyConnectorUrl: string; keyConnectorUrl: string;
// OpenId // OpenId
@ -81,7 +81,7 @@ export class SsoConfigApi extends BaseResponse {
this.configType = this.getResponseProperty('ConfigType'); this.configType = this.getResponseProperty('ConfigType');
this.useKeyConnector = this.getResponseProperty('UseKeyConnector'); this.keyConnectorEnabled = this.getResponseProperty('KeyConnectorEnabled');
this.keyConnectorUrl = this.getResponseProperty('KeyConnectorUrl'); this.keyConnectorUrl = this.getResponseProperty('KeyConnectorUrl');
this.authority = this.getResponseProperty('Authority'); this.authority = this.getResponseProperty('Authority');

View File

@ -18,6 +18,7 @@ export class OrganizationData {
use2fa: boolean; use2fa: boolean;
useApi: boolean; useApi: boolean;
useSso: boolean; useSso: boolean;
useKeyConnector: boolean;
useResetPassword: boolean; useResetPassword: boolean;
selfHost: boolean; selfHost: boolean;
usersGetPremium: boolean; usersGetPremium: boolean;
@ -33,7 +34,7 @@ export class OrganizationData {
providerId: string; providerId: string;
providerName: string; providerName: string;
isProviderUser: boolean; isProviderUser: boolean;
usesKeyConnector: boolean; keyConnectorEnabled: boolean;
keyConnectorUrl: string; keyConnectorUrl: string;
constructor(response: ProfileOrganizationResponse) { constructor(response: ProfileOrganizationResponse) {
@ -50,6 +51,7 @@ export class OrganizationData {
this.use2fa = response.use2fa; this.use2fa = response.use2fa;
this.useApi = response.useApi; this.useApi = response.useApi;
this.useSso = response.useSso; this.useSso = response.useSso;
this.useKeyConnector = response.useKeyConnector;
this.useResetPassword = response.useResetPassword; this.useResetPassword = response.useResetPassword;
this.selfHost = response.selfHost; this.selfHost = response.selfHost;
this.usersGetPremium = response.usersGetPremium; this.usersGetPremium = response.usersGetPremium;
@ -64,7 +66,7 @@ export class OrganizationData {
this.hasPublicAndPrivateKeys = response.hasPublicAndPrivateKeys; this.hasPublicAndPrivateKeys = response.hasPublicAndPrivateKeys;
this.providerId = response.providerId; this.providerId = response.providerId;
this.providerName = response.providerName; this.providerName = response.providerName;
this.usesKeyConnector = response.usesKeyConnector; this.keyConnectorEnabled = response.keyConnectorEnabled;
this.keyConnectorUrl = response.keyConnectorUrl; this.keyConnectorUrl = response.keyConnectorUrl;
} }
} }

View File

@ -19,6 +19,7 @@ export class Organization {
use2fa: boolean; use2fa: boolean;
useApi: boolean; useApi: boolean;
useSso: boolean; useSso: boolean;
useKeyConnector: boolean;
useResetPassword: boolean; useResetPassword: boolean;
selfHost: boolean; selfHost: boolean;
usersGetPremium: boolean; usersGetPremium: boolean;
@ -34,7 +35,7 @@ export class Organization {
providerId: string; providerId: string;
providerName: string; providerName: string;
isProviderUser: boolean; isProviderUser: boolean;
usesKeyConnector: boolean; keyConnectorEnabled: boolean;
keyConnectorUrl: string; keyConnectorUrl: string;
constructor(obj?: OrganizationData) { constructor(obj?: OrganizationData) {
@ -55,6 +56,7 @@ export class Organization {
this.use2fa = obj.use2fa; this.use2fa = obj.use2fa;
this.useApi = obj.useApi; this.useApi = obj.useApi;
this.useSso = obj.useSso; this.useSso = obj.useSso;
this.useKeyConnector = obj.useKeyConnector;
this.useResetPassword = obj.useResetPassword; this.useResetPassword = obj.useResetPassword;
this.selfHost = obj.selfHost; this.selfHost = obj.selfHost;
this.usersGetPremium = obj.usersGetPremium; this.usersGetPremium = obj.usersGetPremium;
@ -70,7 +72,7 @@ export class Organization {
this.providerId = obj.providerId; this.providerId = obj.providerId;
this.providerName = obj.providerName; this.providerName = obj.providerName;
this.isProviderUser = obj.isProviderUser; this.isProviderUser = obj.isProviderUser;
this.usesKeyConnector = obj.usesKeyConnector; this.keyConnectorEnabled = obj.keyConnectorEnabled;
this.keyConnectorUrl = obj.keyConnectorUrl; this.keyConnectorUrl = obj.keyConnectorUrl;
} }

View File

@ -15,6 +15,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
use2fa: boolean; use2fa: boolean;
useApi: boolean; useApi: boolean;
useSso: boolean; useSso: boolean;
useKeyConnector: boolean;
useResetPassword: boolean; useResetPassword: boolean;
selfHost: boolean; selfHost: boolean;
usersGetPremium: boolean; usersGetPremium: boolean;
@ -33,7 +34,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
userId: string; userId: string;
providerId: string; providerId: string;
providerName: string; providerName: string;
usesKeyConnector: boolean; keyConnectorEnabled: boolean;
keyConnectorUrl: string; keyConnectorUrl: string;
constructor(response: any) { constructor(response: any) {
@ -48,6 +49,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
this.use2fa = this.getResponseProperty('Use2fa'); this.use2fa = this.getResponseProperty('Use2fa');
this.useApi = this.getResponseProperty('UseApi'); this.useApi = this.getResponseProperty('UseApi');
this.useSso = this.getResponseProperty('UseSso'); this.useSso = this.getResponseProperty('UseSso');
this.useKeyConnector = this.getResponseProperty('UseKeyConnector') ?? false;
this.useResetPassword = this.getResponseProperty('UseResetPassword'); this.useResetPassword = this.getResponseProperty('UseResetPassword');
this.selfHost = this.getResponseProperty('SelfHost'); this.selfHost = this.getResponseProperty('SelfHost');
this.usersGetPremium = this.getResponseProperty('UsersGetPremium'); this.usersGetPremium = this.getResponseProperty('UsersGetPremium');
@ -66,7 +68,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
this.userId = this.getResponseProperty('UserId'); this.userId = this.getResponseProperty('UserId');
this.providerId = this.getResponseProperty('ProviderId'); this.providerId = this.getResponseProperty('ProviderId');
this.providerName = this.getResponseProperty('ProviderName'); this.providerName = this.getResponseProperty('ProviderName');
this.usesKeyConnector = this.getResponseProperty('UsesKeyConnector') ?? false; this.keyConnectorEnabled = this.getResponseProperty('KeyConnectorEnabled') ?? false;
this.keyConnectorUrl = this.getResponseProperty('KeyConnectorUrl'); this.keyConnectorUrl = this.getResponseProperty('KeyConnectorUrl');
} }
} }

View File

@ -3,6 +3,6 @@ import { ProfileOrganizationResponse } from './profileOrganizationResponse';
export class ProfileProviderOrganizationResponse extends ProfileOrganizationResponse { export class ProfileProviderOrganizationResponse extends ProfileOrganizationResponse {
constructor(response: any) { constructor(response: any) {
super(response); super(response);
this.usesKeyConnector = false; this.keyConnectorEnabled = false;
} }
} }

View File

@ -72,7 +72,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction {
async getManagingOrganization() { async getManagingOrganization() {
const orgs = await this.userService.getAllOrganizations(); const orgs = await this.userService.getAllOrganizations();
return orgs.find(o => return orgs.find(o =>
o.usesKeyConnector && o.keyConnectorEnabled &&
o.type !== OrganizationUserType.Admin && o.type !== OrganizationUserType.Admin &&
o.type !== OrganizationUserType.Owner && o.type !== OrganizationUserType.Owner &&
!o.isProviderUser); !o.isProviderUser);