1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-09 05:57:40 +02:00
bitwarden-browser/apps/web/src/app/auth/sso.component.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

140 lines
5.3 KiB
TypeScript
Raw Normal View History

import { Component } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { first } from "rxjs/operators";
Auth/ps 2298 reorg auth (#4564) * Move auth service factories to Auth team * Move authentication componenets to Auth team * Move auth guard services to Auth team * Move Duo content script to Auth team * Move auth CLI commands to Auth team * Move Desktop Account components to Auth Team * Move Desktop guards to Auth team * Move two-factor provider images to Auth team * Move web Accounts components to Auth Team * Move web settings components to Auth Team * Move web two factor images to Auth Team * Fix missed import changes for Auth Team * Fix Linting errors * Fix missed CLI imports * Fix missed Desktop imports * Revert images move * Fix missed imports in Web * Move angular lib components to Auth Team * Move angular auth guards to Auth team * Move strategy specs to Auth team * Update .eslintignore for new paths * Move lib common abstractions to Auth team * Move services to Auth team * Move common lib enums to Auth team * Move webauthn iframe to Auth team * Move lib common domain models to Auth team * Move common lib requests to Auth team * Move response models to Auth team * Clean up whitelist * Move bit web components to Auth team * Move SSO and SCIM files to Auth team * Revert move SCIM to Auth team SCIM belongs to Admin Console team * Move captcha to Auth team * Move key connector to Auth team * Move emergency access to auth team * Delete extra file * linter fixes * Move kdf config to auth team * Fix whitelist * Fix duo autoformat * Complete two factor provider request move * Fix whitelist names * Fix login capitalization * Revert hint dependency reordering * Revert hint dependency reordering * Revert hint component This components is being picked up as a move between clients * Move web hint component to Auth team * Move new files to auth team * Fix desktop build * Fix browser build
2023-02-06 22:53:37 +01:00
import { SsoComponent as BaseSsoComponent } from "@bitwarden/angular/auth/components/sso.component";
2022-06-14 17:10:53 +02:00
import { ApiService } from "@bitwarden/common/abstractions/api.service";
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
import { OrgDomainApiServiceAbstraction } from "@bitwarden/common/abstractions/organization-domain/org-domain-api.service.abstraction";
import { OrganizationDomainSsoDetailsResponse } from "@bitwarden/common/abstractions/organization-domain/responses/organization-domain-sso-details.response";
Auth/ps 2298 reorg auth (#4564) * Move auth service factories to Auth team * Move authentication componenets to Auth team * Move auth guard services to Auth team * Move Duo content script to Auth team * Move auth CLI commands to Auth team * Move Desktop Account components to Auth Team * Move Desktop guards to Auth team * Move two-factor provider images to Auth team * Move web Accounts components to Auth Team * Move web settings components to Auth Team * Move web two factor images to Auth Team * Fix missed import changes for Auth Team * Fix Linting errors * Fix missed CLI imports * Fix missed Desktop imports * Revert images move * Fix missed imports in Web * Move angular lib components to Auth Team * Move angular auth guards to Auth team * Move strategy specs to Auth team * Update .eslintignore for new paths * Move lib common abstractions to Auth team * Move services to Auth team * Move common lib enums to Auth team * Move webauthn iframe to Auth team * Move lib common domain models to Auth team * Move common lib requests to Auth team * Move response models to Auth team * Clean up whitelist * Move bit web components to Auth team * Move SSO and SCIM files to Auth team * Revert move SCIM to Auth team SCIM belongs to Admin Console team * Move captcha to Auth team * Move key connector to Auth team * Move emergency access to auth team * Delete extra file * linter fixes * Move kdf config to auth team * Fix whitelist * Fix duo autoformat * Complete two factor provider request move * Fix whitelist names * Fix login capitalization * Revert hint dependency reordering * Revert hint dependency reordering * Revert hint component This components is being picked up as a move between clients * Move web hint component to Auth team * Move new files to auth team * Fix desktop build * Fix browser build
2023-02-06 22:53:37 +01:00
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
import { LoginService } from "@bitwarden/common/auth/abstractions/login.service";
[AC-1266] Enums filename conventions (#5140) * refactor: update clientType enum * refactor: update deviceType filename * refactor: update encryptedExportType filename * refactor: update encryptionType filename * refactor: update eventType filename * refactor: update fieldType filename * refactor: update fileUploadType filename * refactor: update hashPurpose filename * refactor: update htmlStorageLocation filename * refactor: update kdfType filename * refactor: update keySuffixOptions filename * refactor: update linkedIdType filename * refactor: update logLevelType filename * refactor: update nativeMessagingVersion filename * refactor: update notificationType filename * refactor: update productType filename * refactor: update secureNoteType filename * refactor: update stateVersion filename * refactor: update storageLocation filename * refactor: update themeType filename * refactor: update uriMatchType filename * fix: update kdfType classes missed in initial pass, refs AC-1266 * fix: missing import update for device-type * refactor: add barrel file for enums and update pathed import statements, refs AC-1266 * fix: incorrect import statements for web, refs AC-1266 * fix: missed import statement updates (browser), refs AC-1266 * fix: missed import statement changes (cli), refs AC-1266 * fix: missed import statement changes (desktop), refs AC-1266 * fix: prettier, refs AC-1266 * refactor: (libs) update relative paths to use barrel file, refs AC-1266 * fix: missed find/replace import statements for SecureNoteType, refs AC-1266 * refactor: apply .enum suffix to enums folder and modify leftover relative paths, refs AC-1266 * fix: find/replace errors for native-messaging-version, refs AC-1266
2023-04-05 05:42:21 +02:00
import { HttpStatusCode } from "@bitwarden/common/enums";
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
@Component({
selector: "app-sso",
templateUrl: "sso.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SsoComponent extends BaseSsoComponent {
constructor(
authService: AuthService,
router: Router,
i18nService: I18nService,
route: ActivatedRoute,
[Account Switching] [Refactor] Implement new account centric services (#1220) * [chore] updated services.module to use account services * [refactor] sorted services provided by services.module * [chore] removed references to deleted jslib services * [chore] used activeAccount over storageService for account level storage items * [chore] resolved linter warnings * Refactor activeAccountService to stateService * [bug] Remove uneeded calls to state service on logout This was causing console erros on logout. Clearing of data is handled fully in dedicated services, clearing them in state afterwards is essentially a redundant call. * [bug] Add back null locked callback to VaultTimeoutService * Move call to get showUpdateKey * [bug] Ensure HtmlStorageService does not override StateService options and locations * [bug] Adjust theme logic to pull from the new storage locations * [bug] Correct theme not sticking on refresh * [bug] Add enableFullWidth to the account model * [bug] fix theme option empty when light is selected * [bug] init state on application start * [bug] Reinit state when coming back from a lock * [style] Fix lint complaints * [bug] Clean state on logout * [chore] Resolved merge issues * [bug] Correct default for enableGravitars * Bump angular to 12. * Remove angular.json * Bump rxjs * Fix build errors, remove file-loader with asset/resource * Use contenthash * Bump jslib * Bump ngx-toastr * [chore] resolve issues from merge * [chore] resolve issues from merge * [bug] Add missing bracket * Use newer import syntax * [bug] Correct service orge * [style] Fix lint complaints * [chore] update jslib * [review] Address code review * [review] Address code review * [review] Rename providerService to webProviderService Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Hinton <oscar@oscarhinton.com>
2021-12-14 17:10:26 +01:00
stateService: StateService,
platformUtilsService: PlatformUtilsService,
apiService: ApiService,
cryptoFunctionService: CryptoFunctionService,
environmentService: EnvironmentService,
passwordGenerationService: PasswordGenerationServiceAbstraction,
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
logService: LogService,
private orgDomainApiService: OrgDomainApiServiceAbstraction,
private loginService: LoginService,
private validationService: ValidationService
[Account Switching] [Refactor] Implement new account centric services (#1220) * [chore] updated services.module to use account services * [refactor] sorted services provided by services.module * [chore] removed references to deleted jslib services * [chore] used activeAccount over storageService for account level storage items * [chore] resolved linter warnings * Refactor activeAccountService to stateService * [bug] Remove uneeded calls to state service on logout This was causing console erros on logout. Clearing of data is handled fully in dedicated services, clearing them in state afterwards is essentially a redundant call. * [bug] Add back null locked callback to VaultTimeoutService * Move call to get showUpdateKey * [bug] Ensure HtmlStorageService does not override StateService options and locations * [bug] Adjust theme logic to pull from the new storage locations * [bug] Correct theme not sticking on refresh * [bug] Add enableFullWidth to the account model * [bug] fix theme option empty when light is selected * [bug] init state on application start * [bug] Reinit state when coming back from a lock * [style] Fix lint complaints * [bug] Clean state on logout * [chore] Resolved merge issues * [bug] Correct default for enableGravitars * Bump angular to 12. * Remove angular.json * Bump rxjs * Fix build errors, remove file-loader with asset/resource * Use contenthash * Bump jslib * Bump ngx-toastr * [chore] resolve issues from merge * [chore] resolve issues from merge * [bug] Add missing bracket * Use newer import syntax * [bug] Correct service orge * [style] Fix lint complaints * [chore] update jslib * [review] Address code review * [review] Address code review * [review] Rename providerService to webProviderService Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Hinton <oscar@oscarhinton.com>
2021-12-14 17:10:26 +01:00
) {
super(
authService,
router,
i18nService,
route,
stateService,
platformUtilsService,
apiService,
cryptoFunctionService,
[Account Switching] [Refactor] Implement new account centric services (#1220) * [chore] updated services.module to use account services * [refactor] sorted services provided by services.module * [chore] removed references to deleted jslib services * [chore] used activeAccount over storageService for account level storage items * [chore] resolved linter warnings * Refactor activeAccountService to stateService * [bug] Remove uneeded calls to state service on logout This was causing console erros on logout. Clearing of data is handled fully in dedicated services, clearing them in state afterwards is essentially a redundant call. * [bug] Add back null locked callback to VaultTimeoutService * Move call to get showUpdateKey * [bug] Ensure HtmlStorageService does not override StateService options and locations * [bug] Adjust theme logic to pull from the new storage locations * [bug] Correct theme not sticking on refresh * [bug] Add enableFullWidth to the account model * [bug] fix theme option empty when light is selected * [bug] init state on application start * [bug] Reinit state when coming back from a lock * [style] Fix lint complaints * [bug] Clean state on logout * [chore] Resolved merge issues * [bug] Correct default for enableGravitars * Bump angular to 12. * Remove angular.json * Bump rxjs * Fix build errors, remove file-loader with asset/resource * Use contenthash * Bump jslib * Bump ngx-toastr * [chore] resolve issues from merge * [chore] resolve issues from merge * [bug] Add missing bracket * Use newer import syntax * [bug] Correct service orge * [style] Fix lint complaints * [chore] update jslib * [review] Address code review * [review] Address code review * [review] Rename providerService to webProviderService Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Hinton <oscar@oscarhinton.com>
2021-12-14 17:10:26 +01:00
environmentService,
passwordGenerationService,
logService
[Account Switching] [Refactor] Implement new account centric services (#1220) * [chore] updated services.module to use account services * [refactor] sorted services provided by services.module * [chore] removed references to deleted jslib services * [chore] used activeAccount over storageService for account level storage items * [chore] resolved linter warnings * Refactor activeAccountService to stateService * [bug] Remove uneeded calls to state service on logout This was causing console erros on logout. Clearing of data is handled fully in dedicated services, clearing them in state afterwards is essentially a redundant call. * [bug] Add back null locked callback to VaultTimeoutService * Move call to get showUpdateKey * [bug] Ensure HtmlStorageService does not override StateService options and locations * [bug] Adjust theme logic to pull from the new storage locations * [bug] Correct theme not sticking on refresh * [bug] Add enableFullWidth to the account model * [bug] fix theme option empty when light is selected * [bug] init state on application start * [bug] Reinit state when coming back from a lock * [style] Fix lint complaints * [bug] Clean state on logout * [chore] Resolved merge issues * [bug] Correct default for enableGravitars * Bump angular to 12. * Remove angular.json * Bump rxjs * Fix build errors, remove file-loader with asset/resource * Use contenthash * Bump jslib * Bump ngx-toastr * [chore] resolve issues from merge * [chore] resolve issues from merge * [bug] Add missing bracket * Use newer import syntax * [bug] Correct service orge * [style] Fix lint complaints * [chore] update jslib * [review] Address code review * [review] Address code review * [review] Rename providerService to webProviderService Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Hinton <oscar@oscarhinton.com>
2021-12-14 17:10:26 +01:00
);
this.redirectUri = window.location.origin + "/sso-connector.html";
2020-08-20 22:39:05 +02:00
this.clientId = "web";
}
async ngOnInit() {
super.ngOnInit();
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
// if we have an emergency access invite, redirect to emergency access
const emergencyAccessInvite = await this.stateService.getEmergencyAccessInvitation();
if (emergencyAccessInvite != null) {
this.onSuccessfulLoginNavigate = async () => {
this.router.navigate(["/accept-emergency"], {
queryParams: {
id: emergencyAccessInvite.id,
name: emergencyAccessInvite.name,
email: emergencyAccessInvite.email,
token: emergencyAccessInvite.token,
},
});
};
}
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
2020-08-20 22:39:05 +02:00
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.identifier != null) {
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
// SSO Org Identifier in query params takes precedence over claimed domains
[Account Switching] [Refactor] Implement new account centric services (#1220) * [chore] updated services.module to use account services * [refactor] sorted services provided by services.module * [chore] removed references to deleted jslib services * [chore] used activeAccount over storageService for account level storage items * [chore] resolved linter warnings * Refactor activeAccountService to stateService * [bug] Remove uneeded calls to state service on logout This was causing console erros on logout. Clearing of data is handled fully in dedicated services, clearing them in state afterwards is essentially a redundant call. * [bug] Add back null locked callback to VaultTimeoutService * Move call to get showUpdateKey * [bug] Ensure HtmlStorageService does not override StateService options and locations * [bug] Adjust theme logic to pull from the new storage locations * [bug] Correct theme not sticking on refresh * [bug] Add enableFullWidth to the account model * [bug] fix theme option empty when light is selected * [bug] init state on application start * [bug] Reinit state when coming back from a lock * [style] Fix lint complaints * [bug] Clean state on logout * [chore] Resolved merge issues * [bug] Correct default for enableGravitars * Bump angular to 12. * Remove angular.json * Bump rxjs * Fix build errors, remove file-loader with asset/resource * Use contenthash * Bump jslib * Bump ngx-toastr * [chore] resolve issues from merge * [chore] resolve issues from merge * [bug] Add missing bracket * Use newer import syntax * [bug] Correct service orge * [style] Fix lint complaints * [chore] update jslib * [review] Address code review * [review] Address code review * [review] Rename providerService to webProviderService Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Hinton <oscar@oscarhinton.com>
2021-12-14 17:10:26 +01:00
this.identifier = qParams.identifier;
} else {
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
// Note: this flow is written for web but both browser and desktop
// redirect here on SSO button click.
// Check if email matches any claimed domains
if (qParams.email) {
// show loading spinner
this.loggingIn = true;
try {
const response: OrganizationDomainSsoDetailsResponse =
await this.orgDomainApiService.getClaimedOrgDomainByEmail(qParams.email);
if (response?.ssoAvailable) {
this.identifier = response.organizationIdentifier;
await this.submit();
return;
}
} catch (error) {
this.handleGetClaimedDomainByEmailError(error);
}
this.loggingIn = false;
}
// Fallback to state svc if domain is unclaimed
[Account Switching] [Refactor] Implement new account centric services (#1220) * [chore] updated services.module to use account services * [refactor] sorted services provided by services.module * [chore] removed references to deleted jslib services * [chore] used activeAccount over storageService for account level storage items * [chore] resolved linter warnings * Refactor activeAccountService to stateService * [bug] Remove uneeded calls to state service on logout This was causing console erros on logout. Clearing of data is handled fully in dedicated services, clearing them in state afterwards is essentially a redundant call. * [bug] Add back null locked callback to VaultTimeoutService * Move call to get showUpdateKey * [bug] Ensure HtmlStorageService does not override StateService options and locations * [bug] Adjust theme logic to pull from the new storage locations * [bug] Correct theme not sticking on refresh * [bug] Add enableFullWidth to the account model * [bug] fix theme option empty when light is selected * [bug] init state on application start * [bug] Reinit state when coming back from a lock * [style] Fix lint complaints * [bug] Clean state on logout * [chore] Resolved merge issues * [bug] Correct default for enableGravitars * Bump angular to 12. * Remove angular.json * Bump rxjs * Fix build errors, remove file-loader with asset/resource * Use contenthash * Bump jslib * Bump ngx-toastr * [chore] resolve issues from merge * [chore] resolve issues from merge * [bug] Add missing bracket * Use newer import syntax * [bug] Correct service orge * [style] Fix lint complaints * [chore] update jslib * [review] Address code review * [review] Address code review * [review] Rename providerService to webProviderService Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Hinton <oscar@oscarhinton.com>
2021-12-14 17:10:26 +01:00
const storedIdentifier = await this.stateService.getSsoOrgIdentifier();
if (storedIdentifier != null) {
this.identifier = storedIdentifier;
}
2021-12-17 15:57:11 +01:00
}
2020-08-20 22:39:05 +02:00
});
2021-12-17 15:57:11 +01:00
}
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
private handleGetClaimedDomainByEmailError(error: any): void {
if (error instanceof ErrorResponse) {
const errorResponse: ErrorResponse = error as ErrorResponse;
switch (errorResponse.statusCode) {
case HttpStatusCode.NotFound:
//this is a valid case for a domain not found
return;
[SG-147] - Feature/web-organization-domain-claiming (#4734) * Feature/SG-680 - Create Domain Verification Comp (#4283) * domain-base.ts - added link to Architectural docs describing domain base class purpose * SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models * SG-680 - Renaming org domain service abstractions to match existing convention * SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables * Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components. * SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services) * SG-680 - Update Organization model to include a canManageDomainVerification check * SG-680 - Created Domain Verification component and started scaffolding out HTML * SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection) * SG-680 - OrgDomainApiServiceAbstraction should be an abstract class * SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly * SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure * SG-680 - Good start on Domain Add Edit Dialog * SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added * SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid * SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName" * Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well. * SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh. * SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify * SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented * SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar) * SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh. * SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling * SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion * SG-680 - Domain verification table options now supports removing domains with confirmation prompt * Shared module - merge conflict resolution + removing unused imports so I can check this in. * SG-680 - Adding missing translations * SG-680 - Comment clean up + todo * Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in." This reverts commit 98fe346e67c3809fec015b1c9304b013cac5340d. * SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted. * SG-680 - Added httpStatusCode enum * SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service * SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design * SG-680 - DomainAddEditDialog - Validation and error handling overhaul * SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns * SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props * SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason * SG-680 - OrgDomainService - Added test suite * SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue * SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules. * SG-680 - Updating HttpStatusCode import b/c auto import update missed it. * SG-680 - DomainAddEditDialog - Don't show callout if domain is verified * SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available * SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor * SG-680 - OrgDomainApiSvc - added full test suite * SG-680 - OrgDomainSvc test suite - fixing broken test * SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs * SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern. * SG-680 - Removed TODO for adding tests since I've already added tests. * SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case * SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma. * SG-680 - Removing unnecessary comment * SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility. * SG-680 - Fixing messages.json missing } * SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now. * SG-680 - Dialog comment refactor * SG-680 - OrgDomainSvc - comment and console log removals. * SG-680 - Updating OrgDomain Service test suites to have better test titles. * Defect/web org domain claiming bugfixes (#4458) * SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains. * SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client. * SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up. * SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop. * SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member) * Form button directive comment update * SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member. * Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict * DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21. * Add SDK w/ value of 21 to DeviceType to match master server * Defect/web org domain claiming bugfixes the sequel (#4530) * Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template) * Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not. * SG-949 - Update domain name validator regex to prevent http://, https://, and www. * SG-771 - Added claimed domain logic to web client (#4603) * SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop. * Fix lint errors by adding button types --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2023-02-15 21:50:39 +01:00
default:
this.validationService.showError(errorResponse);
break;
}
}
}
2020-08-20 22:39:05 +02:00
async submit() {
await this.stateService.setSsoOrganizationIdentifier(this.identifier);
if (this.clientId === "browser") {
document.cookie = `ssoHandOffMessage=${this.i18nService.t("ssoHandOff")};SameSite=strict`;
2020-08-20 22:39:05 +02:00
}
super.submit();
2021-12-17 15:57:11 +01:00
}
}