diff --git a/bitwarden_license/src/app/organizations/manage/sso.component.html b/bitwarden_license/src/app/organizations/manage/sso.component.html
index ddcf4f2f..ec9e6a1e 100644
--- a/bitwarden_license/src/app/organizations/manage/sso.component.html
+++ b/bitwarden_license/src/app/organizations/manage/sso.component.html
@@ -54,7 +54,23 @@
diff --git a/bitwarden_license/src/app/organizations/manage/sso.component.ts b/bitwarden_license/src/app/organizations/manage/sso.component.ts
index 706d88af..5e4f1b3d 100644
--- a/bitwarden_license/src/app/organizations/manage/sso.component.ts
+++ b/bitwarden_license/src/app/organizations/manage/sso.component.ts
@@ -38,6 +38,8 @@ export class SsoComponent implements OnInit {
spMetadataUrl: string;
spAcsUrl: string;
+ keyConnectorIsValid: boolean;
+
enabled = this.fb.control(false);
data = this.fb.group({
configType: [],
@@ -115,6 +117,15 @@ export class SsoComponent implements OnInit {
}
async submit() {
+ if (!this.keyConnectorIsValid || this.keyConnectorUrl.dirty)
+ {
+ await this.testKeyConnector();
+ if (!this.keyConnectorIsValid) {
+ this.platformUtilsService.showToast('error', null, this.i18nService.t('keyConnectorTestFail'));
+ return;
+ }
+ }
+
const request = new OrganizationSsoRequest();
request.enabled = this.enabled.value;
request.data = this.data.value;
@@ -128,4 +139,30 @@ export class SsoComponent implements OnInit {
this.formPromise = null;
this.platformUtilsService.showToast('success', null, this.i18nService.t('ssoSettingsSaved'));
}
+
+ async testKeyConnector() {
+ if (this.keyConnectorIsValid && this.keyConnectorUrl.pristine) {
+ return;
+ }
+
+ this.keyConnectorUrl.markAsPristine();
+ try {
+ await this.apiService.getKeyConnectorAlive(this.keyConnectorUrl.value);
+ } catch {
+ this.keyConnectorIsValid = false;
+ return;
+ }
+
+ this.keyConnectorIsValid = true;
+ }
+
+ get enableTestKeyConnector() {
+ return this.data.get('keyConnectorEnabled').value &&
+ this.keyConnectorUrl != null &&
+ this.keyConnectorUrl.value !== '';
+ }
+
+ get keyConnectorUrl() {
+ return this.data.get('keyConnectorUrl');
+ }
}
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index 6a9adc47..7779d9f4 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -4571,5 +4571,14 @@
},
"migratedKeyConnector": {
"message": "Migrated to Key Connector"
+ },
+ "keyConnectorTest": {
+ "message": "Test"
+ },
+ "keyConnectorTestSuccess": {
+ "message": "Success! Key Connector reached."
+ },
+ "keyConnectorTestFail": {
+ "message": "Cannot reach Key Connector. Check URL."
}
}