mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[SSO] Set password auto enroll update (#472)
* [SSO/Auto Enroll] Set Password enrolls new user * Fixed typo * Linter updates * Cleanup // Constructor for SetPasswordRequest
This commit is contained in:
@@ -21,6 +21,7 @@ export abstract class UserService {
|
||||
isAuthenticated: () => Promise<boolean>;
|
||||
canAccessPremium: () => Promise<boolean>;
|
||||
getOrganization: (id: string) => Promise<Organization>;
|
||||
getOrganizationByIdentifier: (identifier: string) => Promise<Organization>;
|
||||
getAllOrganizations: () => Promise<Organization[]>;
|
||||
replaceOrganizations: (organizations: { [id: string]: OrganizationData; }) => Promise<any>;
|
||||
clearOrganizations: (userId: string) => Promise<any>;
|
||||
|
||||
@@ -10,4 +10,15 @@ export class SetPasswordRequest {
|
||||
kdf: KdfType;
|
||||
kdfIterations: number;
|
||||
orgIdentifier: string;
|
||||
|
||||
constructor(masterPasswordHash: string, key: string, masterPasswordHint: string, kdf: KdfType,
|
||||
kdfIterations: number, orgIdentifier: string, keys: KeysRequest) {
|
||||
this.masterPasswordHash = masterPasswordHash;
|
||||
this.key = key;
|
||||
this.masterPasswordHint = masterPasswordHint;
|
||||
this.kdf = kdf;
|
||||
this.kdfIterations = kdfIterations;
|
||||
this.orgIdentifier = orgIdentifier;
|
||||
this.keys = keys;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,15 @@ export class UserService implements UserServiceAbstraction {
|
||||
return new Organization(organizations[id]);
|
||||
}
|
||||
|
||||
async getOrganizationByIdentifier(identifier: string): Promise<Organization> {
|
||||
const organizations = await this.getAllOrganizations();
|
||||
if (organizations == null || organizations.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return organizations.find(o => o.identifier === identifier);
|
||||
}
|
||||
|
||||
async getAllOrganizations(): Promise<Organization[]> {
|
||||
const userId = await this.getUserId();
|
||||
const organizations = await this.storageService.get<{ [id: string]: OrganizationData; }>(
|
||||
|
||||
Reference in New Issue
Block a user