mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-05 23:53:21 +00:00
[PM-21187] Rename Azure AD to Entra ID (#797)
* Changed label to entraID * Performed rename of Azure AD to Entra ID * Added check to maintain backward compatibility. * Swapping Azure for Entra * one last spot * Adding property for the data.json for backward compatibility. Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * Removing unneeded setting using the old azure property. * Accidentally removed. Adding entra back in. * Adding backward compatibility comment. Added here because it's required for SecureStorageKeys * Adding backward compatibility comments. * Fixing comment * Removing unused fields. --------- Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
@@ -9,7 +9,7 @@ Supported directories:
|
|||||||
|
|
||||||
- Active Directory
|
- Active Directory
|
||||||
- Any other LDAP-based directory
|
- Any other LDAP-based directory
|
||||||
- Azure Active Directory
|
- Microsoft Entra ID
|
||||||
- G Suite (Google)
|
- G Suite (Google)
|
||||||
- Okta
|
- Okta
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { StorageOptions } from "@/jslib/common/src/models/domain/storageOptions"
|
|||||||
|
|
||||||
import { DirectoryType } from "@/src/enums/directoryType";
|
import { DirectoryType } from "@/src/enums/directoryType";
|
||||||
import { Account } from "@/src/models/account";
|
import { Account } from "@/src/models/account";
|
||||||
import { AzureConfiguration } from "@/src/models/azureConfiguration";
|
import { EntraIdConfiguration } from "@/src/models/entraIdConfiguration";
|
||||||
import { GSuiteConfiguration } from "@/src/models/gsuiteConfiguration";
|
import { GSuiteConfiguration } from "@/src/models/gsuiteConfiguration";
|
||||||
import { LdapConfiguration } from "@/src/models/ldapConfiguration";
|
import { LdapConfiguration } from "@/src/models/ldapConfiguration";
|
||||||
import { OktaConfiguration } from "@/src/models/oktaConfiguration";
|
import { OktaConfiguration } from "@/src/models/oktaConfiguration";
|
||||||
@@ -17,7 +17,7 @@ export abstract class StateService extends BaseStateServiceAbstraction<Account>
|
|||||||
config:
|
config:
|
||||||
| LdapConfiguration
|
| LdapConfiguration
|
||||||
| GSuiteConfiguration
|
| GSuiteConfiguration
|
||||||
| AzureConfiguration
|
| EntraIdConfiguration
|
||||||
| OktaConfiguration
|
| OktaConfiguration
|
||||||
| OneLoginConfiguration,
|
| OneLoginConfiguration,
|
||||||
) => Promise<any>;
|
) => Promise<any>;
|
||||||
@@ -25,8 +25,8 @@ export abstract class StateService extends BaseStateServiceAbstraction<Account>
|
|||||||
setLdapConfiguration: (value: LdapConfiguration, options?: StorageOptions) => Promise<void>;
|
setLdapConfiguration: (value: LdapConfiguration, options?: StorageOptions) => Promise<void>;
|
||||||
getGsuiteConfiguration: (options?: StorageOptions) => Promise<GSuiteConfiguration>;
|
getGsuiteConfiguration: (options?: StorageOptions) => Promise<GSuiteConfiguration>;
|
||||||
setGsuiteConfiguration: (value: GSuiteConfiguration, options?: StorageOptions) => Promise<void>;
|
setGsuiteConfiguration: (value: GSuiteConfiguration, options?: StorageOptions) => Promise<void>;
|
||||||
getAzureConfiguration: (options?: StorageOptions) => Promise<AzureConfiguration>;
|
getEntraConfiguration: (options?: StorageOptions) => Promise<EntraIdConfiguration>;
|
||||||
setAzureConfiguration: (value: AzureConfiguration, options?: StorageOptions) => Promise<void>;
|
setEntraConfiguration: (value: EntraIdConfiguration, options?: StorageOptions) => Promise<void>;
|
||||||
getOktaConfiguration: (options?: StorageOptions) => Promise<OktaConfiguration>;
|
getOktaConfiguration: (options?: StorageOptions) => Promise<OktaConfiguration>;
|
||||||
setOktaConfiguration: (value: OktaConfiguration, options?: StorageOptions) => Promise<void>;
|
setOktaConfiguration: (value: OktaConfiguration, options?: StorageOptions) => Promise<void>;
|
||||||
getOneLoginConfiguration: (options?: StorageOptions) => Promise<OneLoginConfiguration>;
|
getOneLoginConfiguration: (options?: StorageOptions) => Promise<OneLoginConfiguration>;
|
||||||
|
|||||||
@@ -242,7 +242,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div [hidden]="directory != directoryType.AzureActiveDirectory">
|
<div [hidden]="directory != directoryType.EntraID">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="identityAuthority" class="form-label">{{
|
<label for="identityAuthority" class="form-label">{{
|
||||||
"identityAuthority" | i18n
|
"identityAuthority" | i18n
|
||||||
@@ -251,10 +251,10 @@
|
|||||||
class="form-select"
|
class="form-select"
|
||||||
id="identityAuthority"
|
id="identityAuthority"
|
||||||
name="IdentityAuthority"
|
name="IdentityAuthority"
|
||||||
[(ngModel)]="azure.identityAuthority"
|
[(ngModel)]="entra.identityAuthority"
|
||||||
>
|
>
|
||||||
<option value="login.microsoftonline.com">Azure AD Public</option>
|
<option value="login.microsoftonline.com">Entra Id Public</option>
|
||||||
<option value="login.microsoftonline.us">Azure AD Government</option>
|
<option value="login.microsoftonline.us">Entra Id Government</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
id="tenant"
|
id="tenant"
|
||||||
name="Tenant"
|
name="Tenant"
|
||||||
[(ngModel)]="azure.tenant"
|
[(ngModel)]="entra.tenant"
|
||||||
/>
|
/>
|
||||||
<div class="form-text">{{ "ex" | i18n }} companyad.onmicrosoft.com</div>
|
<div class="form-text">{{ "ex" | i18n }} companyad.onmicrosoft.com</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -275,29 +275,29 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
id="applicationId"
|
id="applicationId"
|
||||||
name="ApplicationId"
|
name="ApplicationId"
|
||||||
[(ngModel)]="azure.applicationId"
|
[(ngModel)]="entra.applicationId"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="secretKey" class="form-label">{{ "secretKey" | i18n }}</label>
|
<label for="secretKey" class="form-label">{{ "secretKey" | i18n }}</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input
|
<input
|
||||||
type="{{ showAzureKey ? 'text' : 'password' }}"
|
type="{{ showEntraKey ? 'text' : 'password' }}"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="secretKey"
|
id="secretKey"
|
||||||
name="SecretKey"
|
name="SecretKey"
|
||||||
[(ngModel)]="azure.key"
|
[(ngModel)]="entra.key"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-outline-secondary"
|
class="btn btn-outline-secondary"
|
||||||
appA11yTitle="{{ 'toggleVisibility' | i18n }}"
|
appA11yTitle="{{ 'toggleVisibility' | i18n }}"
|
||||||
(click)="toggleAzureKey()"
|
(click)="toggleEntraKey()"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="bwi bwi-lg"
|
class="bwi bwi-lg"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
[ngClass]="showAzureKey ? 'bwi-eye-slash' : 'bwi-eye'"
|
[ngClass]="showEntraKey ? 'bwi-eye-slash' : 'bwi-eye'"
|
||||||
></i>
|
></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -607,7 +607,7 @@
|
|||||||
<div class="form-text" *ngIf="directory === directoryType.Ldap">
|
<div class="form-text" *ngIf="directory === directoryType.Ldap">
|
||||||
{{ "ex" | i18n }} (&(givenName=John)(|(l=Dallas)(l=Austin)))
|
{{ "ex" | i18n }} (&(givenName=John)(|(l=Dallas)(l=Austin)))
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text" *ngIf="directory === directoryType.AzureActiveDirectory">
|
<div class="form-text" *ngIf="directory === directoryType.EntraID">
|
||||||
{{ "ex" | i18n }} exclude:joe@company.com
|
{{ "ex" | i18n }} exclude:joe@company.com
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text" *ngIf="directory === directoryType.Okta">
|
<div class="form-text" *ngIf="directory === directoryType.Okta">
|
||||||
@@ -684,7 +684,7 @@
|
|||||||
<div class="form-text" *ngIf="directory === directoryType.Ldap">
|
<div class="form-text" *ngIf="directory === directoryType.Ldap">
|
||||||
{{ "ex" | i18n }} (&(objectClass=group)(!(cn=Sales*))(!(cn=IT*)))
|
{{ "ex" | i18n }} (&(objectClass=group)(!(cn=Sales*))(!(cn=IT*)))
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text" *ngIf="directory === directoryType.AzureActiveDirectory">
|
<div class="form-text" *ngIf="directory === directoryType.EntraID">
|
||||||
{{ "ex" | i18n }} include:Sales,IT
|
{{ "ex" | i18n }} include:Sales,IT
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text" *ngIf="directory === directoryType.Okta">
|
<div class="form-text" *ngIf="directory === directoryType.Okta">
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
|||||||
|
|
||||||
import { StateService } from "../../abstractions/state.service";
|
import { StateService } from "../../abstractions/state.service";
|
||||||
import { DirectoryType } from "../../enums/directoryType";
|
import { DirectoryType } from "../../enums/directoryType";
|
||||||
import { AzureConfiguration } from "../../models/azureConfiguration";
|
import { EntraIdConfiguration } from "../../models/entraIdConfiguration";
|
||||||
import { GSuiteConfiguration } from "../../models/gsuiteConfiguration";
|
import { GSuiteConfiguration } from "../../models/gsuiteConfiguration";
|
||||||
import { LdapConfiguration } from "../../models/ldapConfiguration";
|
import { LdapConfiguration } from "../../models/ldapConfiguration";
|
||||||
import { OktaConfiguration } from "../../models/oktaConfiguration";
|
import { OktaConfiguration } from "../../models/oktaConfiguration";
|
||||||
@@ -22,13 +22,13 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
|||||||
directoryType = DirectoryType;
|
directoryType = DirectoryType;
|
||||||
ldap = new LdapConfiguration();
|
ldap = new LdapConfiguration();
|
||||||
gsuite = new GSuiteConfiguration();
|
gsuite = new GSuiteConfiguration();
|
||||||
azure = new AzureConfiguration();
|
entra = new EntraIdConfiguration();
|
||||||
okta = new OktaConfiguration();
|
okta = new OktaConfiguration();
|
||||||
oneLogin = new OneLoginConfiguration();
|
oneLogin = new OneLoginConfiguration();
|
||||||
sync = new SyncConfiguration();
|
sync = new SyncConfiguration();
|
||||||
directoryOptions: any[];
|
directoryOptions: any[];
|
||||||
showLdapPassword = false;
|
showLdapPassword = false;
|
||||||
showAzureKey = false;
|
showEntraKey = false;
|
||||||
showOktaKey = false;
|
showOktaKey = false;
|
||||||
showOneLoginSecret = false;
|
showOneLoginSecret = false;
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
|||||||
this.directoryOptions = [
|
this.directoryOptions = [
|
||||||
{ name: this.i18nService.t("select"), value: null },
|
{ name: this.i18nService.t("select"), value: null },
|
||||||
{ name: "Active Directory / LDAP", value: DirectoryType.Ldap },
|
{ name: "Active Directory / LDAP", value: DirectoryType.Ldap },
|
||||||
{ name: "Azure Active Directory", value: DirectoryType.AzureActiveDirectory },
|
{ name: "Entra ID", value: DirectoryType.EntraID },
|
||||||
{ name: "G Suite (Google)", value: DirectoryType.GSuite },
|
{ name: "G Suite (Google)", value: DirectoryType.GSuite },
|
||||||
{ name: "Okta", value: DirectoryType.Okta },
|
{ name: "Okta", value: DirectoryType.Okta },
|
||||||
{ name: "OneLogin", value: DirectoryType.OneLogin },
|
{ name: "OneLogin", value: DirectoryType.OneLogin },
|
||||||
@@ -56,10 +56,9 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
|||||||
this.gsuite =
|
this.gsuite =
|
||||||
(await this.stateService.getDirectory<GSuiteConfiguration>(DirectoryType.GSuite)) ||
|
(await this.stateService.getDirectory<GSuiteConfiguration>(DirectoryType.GSuite)) ||
|
||||||
this.gsuite;
|
this.gsuite;
|
||||||
this.azure =
|
this.entra =
|
||||||
(await this.stateService.getDirectory<AzureConfiguration>(
|
(await this.stateService.getDirectory<EntraIdConfiguration>(DirectoryType.EntraID)) ||
|
||||||
DirectoryType.AzureActiveDirectory,
|
this.entra;
|
||||||
)) || this.azure;
|
|
||||||
this.okta =
|
this.okta =
|
||||||
(await this.stateService.getDirectory<OktaConfiguration>(DirectoryType.Okta)) || this.okta;
|
(await this.stateService.getDirectory<OktaConfiguration>(DirectoryType.Okta)) || this.okta;
|
||||||
this.oneLogin =
|
this.oneLogin =
|
||||||
@@ -80,7 +79,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
|||||||
await this.stateService.setDirectoryType(this.directory);
|
await this.stateService.setDirectoryType(this.directory);
|
||||||
await this.stateService.setDirectory(DirectoryType.Ldap, this.ldap);
|
await this.stateService.setDirectory(DirectoryType.Ldap, this.ldap);
|
||||||
await this.stateService.setDirectory(DirectoryType.GSuite, this.gsuite);
|
await this.stateService.setDirectory(DirectoryType.GSuite, this.gsuite);
|
||||||
await this.stateService.setDirectory(DirectoryType.AzureActiveDirectory, this.azure);
|
await this.stateService.setDirectory(DirectoryType.EntraID, this.entra);
|
||||||
await this.stateService.setDirectory(DirectoryType.Okta, this.okta);
|
await this.stateService.setDirectory(DirectoryType.Okta, this.okta);
|
||||||
await this.stateService.setDirectory(DirectoryType.OneLogin, this.oneLogin);
|
await this.stateService.setDirectory(DirectoryType.OneLogin, this.oneLogin);
|
||||||
await this.stateService.setSync(this.sync);
|
await this.stateService.setSync(this.sync);
|
||||||
@@ -135,8 +134,8 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
|||||||
document.getElementById("password").focus();
|
document.getElementById("password").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleAzureKey() {
|
toggleEntraKey() {
|
||||||
this.showAzureKey = !this.showAzureKey;
|
this.showEntraKey = !this.showEntraKey;
|
||||||
document.getElementById("secretKey").focus();
|
document.getElementById("secretKey").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { MessageResponse } from "@/jslib/node/src/cli/models/response/messageRes
|
|||||||
|
|
||||||
import { StateService } from "../abstractions/state.service";
|
import { StateService } from "../abstractions/state.service";
|
||||||
import { DirectoryType } from "../enums/directoryType";
|
import { DirectoryType } from "../enums/directoryType";
|
||||||
import { AzureConfiguration } from "../models/azureConfiguration";
|
import { EntraIdConfiguration } from "../models/entraIdConfiguration";
|
||||||
import { GSuiteConfiguration } from "../models/gsuiteConfiguration";
|
import { GSuiteConfiguration } from "../models/gsuiteConfiguration";
|
||||||
import { LdapConfiguration } from "../models/ldapConfiguration";
|
import { LdapConfiguration } from "../models/ldapConfiguration";
|
||||||
import { OktaConfiguration } from "../models/oktaConfiguration";
|
import { OktaConfiguration } from "../models/oktaConfiguration";
|
||||||
@@ -20,7 +20,7 @@ export class ConfigCommand {
|
|||||||
private directory: DirectoryType;
|
private directory: DirectoryType;
|
||||||
private ldap = new LdapConfiguration();
|
private ldap = new LdapConfiguration();
|
||||||
private gsuite = new GSuiteConfiguration();
|
private gsuite = new GSuiteConfiguration();
|
||||||
private azure = new AzureConfiguration();
|
private entra = new EntraIdConfiguration();
|
||||||
private okta = new OktaConfiguration();
|
private okta = new OktaConfiguration();
|
||||||
private oneLogin = new OneLoginConfiguration();
|
private oneLogin = new OneLoginConfiguration();
|
||||||
private sync = new SyncConfiguration();
|
private sync = new SyncConfiguration();
|
||||||
@@ -54,8 +54,11 @@ export class ConfigCommand {
|
|||||||
case "gsuite.key":
|
case "gsuite.key":
|
||||||
await this.setGSuiteKey(value);
|
await this.setGSuiteKey(value);
|
||||||
break;
|
break;
|
||||||
|
// Azure Active Directory was renamed to Entra ID, but we've kept the old key name
|
||||||
|
// to be backwards compatible with existing configurations.
|
||||||
case "azure.key":
|
case "azure.key":
|
||||||
await this.setAzureKey(value);
|
case "entra.key":
|
||||||
|
await this.setEntraIdKey(value);
|
||||||
break;
|
break;
|
||||||
case "okta.token":
|
case "okta.token":
|
||||||
await this.setOktaToken(value);
|
await this.setOktaToken(value);
|
||||||
@@ -102,9 +105,9 @@ export class ConfigCommand {
|
|||||||
await this.saveConfig();
|
await this.saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async setAzureKey(key: string) {
|
private async setEntraIdKey(key: string) {
|
||||||
await this.loadConfig();
|
await this.loadConfig();
|
||||||
this.azure.key = key;
|
this.entra.key = key;
|
||||||
await this.saveConfig();
|
await this.saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,10 +130,9 @@ export class ConfigCommand {
|
|||||||
this.gsuite =
|
this.gsuite =
|
||||||
(await this.stateService.getDirectory<GSuiteConfiguration>(DirectoryType.GSuite)) ||
|
(await this.stateService.getDirectory<GSuiteConfiguration>(DirectoryType.GSuite)) ||
|
||||||
this.gsuite;
|
this.gsuite;
|
||||||
this.azure =
|
this.entra =
|
||||||
(await this.stateService.getDirectory<AzureConfiguration>(
|
(await this.stateService.getDirectory<EntraIdConfiguration>(DirectoryType.EntraID)) ||
|
||||||
DirectoryType.AzureActiveDirectory,
|
this.entra;
|
||||||
)) || this.azure;
|
|
||||||
this.okta =
|
this.okta =
|
||||||
(await this.stateService.getDirectory<OktaConfiguration>(DirectoryType.Okta)) || this.okta;
|
(await this.stateService.getDirectory<OktaConfiguration>(DirectoryType.Okta)) || this.okta;
|
||||||
this.oneLogin =
|
this.oneLogin =
|
||||||
@@ -144,7 +146,7 @@ export class ConfigCommand {
|
|||||||
await this.stateService.setDirectoryType(this.directory);
|
await this.stateService.setDirectoryType(this.directory);
|
||||||
await this.stateService.setDirectory(DirectoryType.Ldap, this.ldap);
|
await this.stateService.setDirectory(DirectoryType.Ldap, this.ldap);
|
||||||
await this.stateService.setDirectory(DirectoryType.GSuite, this.gsuite);
|
await this.stateService.setDirectory(DirectoryType.GSuite, this.gsuite);
|
||||||
await this.stateService.setDirectory(DirectoryType.AzureActiveDirectory, this.azure);
|
await this.stateService.setDirectory(DirectoryType.EntraID, this.entra);
|
||||||
await this.stateService.setDirectory(DirectoryType.Okta, this.okta);
|
await this.stateService.setDirectory(DirectoryType.Okta, this.okta);
|
||||||
await this.stateService.setDirectory(DirectoryType.OneLogin, this.oneLogin);
|
await this.stateService.setDirectory(DirectoryType.OneLogin, this.oneLogin);
|
||||||
await this.stateService.setSync(this.sync);
|
await this.stateService.setSync(this.sync);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export enum DirectoryType {
|
export enum DirectoryType {
|
||||||
Ldap = 0,
|
Ldap = 0,
|
||||||
AzureActiveDirectory = 1,
|
EntraID = 1,
|
||||||
GSuite = 2,
|
GSuite = 2,
|
||||||
Okta = 3,
|
Okta = 3,
|
||||||
OneLogin = 4,
|
OneLogin = 4,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Account as BaseAccount } from "@/jslib/common/src/models/domain/account
|
|||||||
|
|
||||||
import { DirectoryType } from "@/src/enums/directoryType";
|
import { DirectoryType } from "@/src/enums/directoryType";
|
||||||
|
|
||||||
import { AzureConfiguration } from "./azureConfiguration";
|
import { EntraIdConfiguration } from "./entraIdConfiguration";
|
||||||
import { GSuiteConfiguration } from "./gsuiteConfiguration";
|
import { GSuiteConfiguration } from "./gsuiteConfiguration";
|
||||||
import { LdapConfiguration } from "./ldapConfiguration";
|
import { LdapConfiguration } from "./ldapConfiguration";
|
||||||
import { OktaConfiguration } from "./oktaConfiguration";
|
import { OktaConfiguration } from "./oktaConfiguration";
|
||||||
@@ -29,7 +29,10 @@ export class ClientKeys {
|
|||||||
export class DirectoryConfigurations {
|
export class DirectoryConfigurations {
|
||||||
ldap: LdapConfiguration;
|
ldap: LdapConfiguration;
|
||||||
gsuite: GSuiteConfiguration;
|
gsuite: GSuiteConfiguration;
|
||||||
azure: AzureConfiguration;
|
entra: EntraIdConfiguration;
|
||||||
|
// Azure Active Directory was renamed to Entra ID, but we've kept the old account property name
|
||||||
|
// to be backwards compatible with existing configurations.
|
||||||
|
azure: EntraIdConfiguration;
|
||||||
okta: OktaConfiguration;
|
okta: OktaConfiguration;
|
||||||
oneLogin: OneLoginConfiguration;
|
oneLogin: OneLoginConfiguration;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { IConfiguration } from "./IConfiguration";
|
import { IConfiguration } from "./IConfiguration";
|
||||||
|
|
||||||
export class AzureConfiguration implements IConfiguration {
|
export class EntraIdConfiguration implements IConfiguration {
|
||||||
identityAuthority: string;
|
identityAuthority: string;
|
||||||
tenant: string;
|
tenant: string;
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
@@ -190,7 +190,7 @@ export class Program extends BaseProgram {
|
|||||||
writeLn(" server - On-premise hosted installation URL.");
|
writeLn(" server - On-premise hosted installation URL.");
|
||||||
writeLn(" directory - The type of directory to use.");
|
writeLn(" directory - The type of directory to use.");
|
||||||
writeLn(" ldap.password - The password for connection to this LDAP server.");
|
writeLn(" ldap.password - The password for connection to this LDAP server.");
|
||||||
writeLn(" azure.key - The Azure AD secret key.");
|
writeLn(" entra.key - The Entra Id secret key.");
|
||||||
writeLn(" gsuite.key - The G Suite private key.");
|
writeLn(" gsuite.key - The G Suite private key.");
|
||||||
writeLn(" okta.token - The Okta token.");
|
writeLn(" okta.token - The Okta token.");
|
||||||
writeLn(" onelogin.secret - The OneLogin client secret.");
|
writeLn(" onelogin.secret - The OneLogin client secret.");
|
||||||
@@ -202,7 +202,7 @@ export class Program extends BaseProgram {
|
|||||||
writeLn(" bwdc config directory 1");
|
writeLn(" bwdc config directory 1");
|
||||||
writeLn(" bwdc config ldap.password <password>");
|
writeLn(" bwdc config ldap.password <password>");
|
||||||
writeLn(" bwdc config ldap.password --secretenv LDAP_PWD");
|
writeLn(" bwdc config ldap.password --secretenv LDAP_PWD");
|
||||||
writeLn(" bwdc config azure.key <key>");
|
writeLn(" bwdc config entra.key <key>");
|
||||||
writeLn(" bwdc config gsuite.key <key>");
|
writeLn(" bwdc config gsuite.key <key>");
|
||||||
writeLn(" bwdc config okta.token <token>");
|
writeLn(" bwdc config okta.token <token>");
|
||||||
writeLn(" bwdc config onelogin.secret <secret>");
|
writeLn(" bwdc config onelogin.secret <secret>");
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { DirectoryFactoryService } from "../abstractions/directory-factory.servi
|
|||||||
import { StateService } from "../abstractions/state.service";
|
import { StateService } from "../abstractions/state.service";
|
||||||
import { DirectoryType } from "../enums/directoryType";
|
import { DirectoryType } from "../enums/directoryType";
|
||||||
|
|
||||||
import { AzureDirectoryService } from "./azure-directory.service";
|
import { EntraIdDirectoryService } from "./entra-id-directory.service";
|
||||||
import { GSuiteDirectoryService } from "./gsuite-directory.service";
|
import { GSuiteDirectoryService } from "./gsuite-directory.service";
|
||||||
import { LdapDirectoryService } from "./ldap-directory.service";
|
import { LdapDirectoryService } from "./ldap-directory.service";
|
||||||
import { OktaDirectoryService } from "./okta-directory.service";
|
import { OktaDirectoryService } from "./okta-directory.service";
|
||||||
@@ -22,8 +22,8 @@ export class DefaultDirectoryFactoryService implements DirectoryFactoryService {
|
|||||||
switch (directoryType) {
|
switch (directoryType) {
|
||||||
case DirectoryType.GSuite:
|
case DirectoryType.GSuite:
|
||||||
return new GSuiteDirectoryService(this.logService, this.i18nService, this.stateService);
|
return new GSuiteDirectoryService(this.logService, this.i18nService, this.stateService);
|
||||||
case DirectoryType.AzureActiveDirectory:
|
case DirectoryType.EntraID:
|
||||||
return new AzureDirectoryService(this.logService, this.i18nService, this.stateService);
|
return new EntraIdDirectoryService(this.logService, this.i18nService, this.stateService);
|
||||||
case DirectoryType.Ldap:
|
case DirectoryType.Ldap:
|
||||||
return new LdapDirectoryService(this.logService, this.i18nService, this.stateService);
|
return new LdapDirectoryService(this.logService, this.i18nService, this.stateService);
|
||||||
case DirectoryType.Okta:
|
case DirectoryType.Okta:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
|||||||
|
|
||||||
import { StateService } from "../abstractions/state.service";
|
import { StateService } from "../abstractions/state.service";
|
||||||
import { DirectoryType } from "../enums/directoryType";
|
import { DirectoryType } from "../enums/directoryType";
|
||||||
import { AzureConfiguration } from "../models/azureConfiguration";
|
import { EntraIdConfiguration } from "../models/entraIdConfiguration";
|
||||||
import { GroupEntry } from "../models/groupEntry";
|
import { GroupEntry } from "../models/groupEntry";
|
||||||
import { SyncConfiguration } from "../models/syncConfiguration";
|
import { SyncConfiguration } from "../models/syncConfiguration";
|
||||||
import { UserEntry } from "../models/userEntry";
|
import { UserEntry } from "../models/userEntry";
|
||||||
@@ -17,10 +17,10 @@ import { UserEntry } from "../models/userEntry";
|
|||||||
import { BaseDirectoryService } from "./baseDirectory.service";
|
import { BaseDirectoryService } from "./baseDirectory.service";
|
||||||
import { IDirectoryService } from "./directory.service";
|
import { IDirectoryService } from "./directory.service";
|
||||||
|
|
||||||
const AzurePublicIdentityAuhtority = "login.microsoftonline.com";
|
const EntraIdPublicIdentityAuthority = "login.microsoftonline.com";
|
||||||
const AzurePublicGraphEndpoint = "https://graph.microsoft.com";
|
const EntraIdPublicGraphEndpoint = "https://graph.microsoft.com";
|
||||||
const AzureGovermentIdentityAuhtority = "login.microsoftonline.us";
|
const EntraIdGovernmentIdentityAuthority = "login.microsoftonline.us";
|
||||||
const AzureGovernmentGraphEndpoint = "https://graph.microsoft.us";
|
const EntraIdGovernmentGraphEndpoint = "https://graph.microsoft.us";
|
||||||
|
|
||||||
const NextLink = "@odata.nextLink";
|
const NextLink = "@odata.nextLink";
|
||||||
const DeltaLink = "@odata.deltaLink";
|
const DeltaLink = "@odata.deltaLink";
|
||||||
@@ -34,9 +34,9 @@ enum UserSetType {
|
|||||||
ExcludeGroup,
|
ExcludeGroup,
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AzureDirectoryService extends BaseDirectoryService implements IDirectoryService {
|
export class EntraIdDirectoryService extends BaseDirectoryService implements IDirectoryService {
|
||||||
private client: graph.Client;
|
private client: graph.Client;
|
||||||
private dirConfig: AzureConfiguration;
|
private dirConfig: EntraIdConfiguration;
|
||||||
private syncConfig: SyncConfiguration;
|
private syncConfig: SyncConfiguration;
|
||||||
private accessToken: string;
|
private accessToken: string;
|
||||||
private accessTokenExpiration: Date;
|
private accessTokenExpiration: Date;
|
||||||
@@ -52,12 +52,12 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
|||||||
|
|
||||||
async getEntries(force: boolean, test: boolean): Promise<[GroupEntry[], UserEntry[]]> {
|
async getEntries(force: boolean, test: boolean): Promise<[GroupEntry[], UserEntry[]]> {
|
||||||
const type = await this.stateService.getDirectoryType();
|
const type = await this.stateService.getDirectoryType();
|
||||||
if (type !== DirectoryType.AzureActiveDirectory) {
|
if (type !== DirectoryType.EntraID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dirConfig = await this.stateService.getDirectory<AzureConfiguration>(
|
this.dirConfig = await this.stateService.getDirectory<EntraIdConfiguration>(
|
||||||
DirectoryType.AzureActiveDirectory,
|
DirectoryType.EntraID,
|
||||||
);
|
);
|
||||||
if (this.dirConfig == null) {
|
if (this.dirConfig == null) {
|
||||||
return;
|
return;
|
||||||
@@ -459,10 +459,10 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
|||||||
const identityAuthority =
|
const identityAuthority =
|
||||||
this.dirConfig.identityAuthority != null
|
this.dirConfig.identityAuthority != null
|
||||||
? this.dirConfig.identityAuthority
|
? this.dirConfig.identityAuthority
|
||||||
: AzurePublicIdentityAuhtority;
|
: EntraIdPublicIdentityAuthority;
|
||||||
if (
|
if (
|
||||||
identityAuthority !== AzurePublicIdentityAuhtority &&
|
identityAuthority !== EntraIdPublicIdentityAuthority &&
|
||||||
identityAuthority !== AzureGovermentIdentityAuhtority
|
identityAuthority !== EntraIdGovernmentIdentityAuthority
|
||||||
) {
|
) {
|
||||||
done(new Error(this.i18nService.t("dirConfigIncomplete")), null);
|
done(new Error(this.i18nService.t("dirConfigIncomplete")), null);
|
||||||
return;
|
return;
|
||||||
@@ -546,8 +546,8 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getGraphApiEndpoint(): string {
|
private getGraphApiEndpoint(): string {
|
||||||
return this.dirConfig.identityAuthority === AzureGovermentIdentityAuhtority
|
return this.dirConfig.identityAuthority === EntraIdGovernmentIdentityAuthority
|
||||||
? AzureGovernmentGraphEndpoint
|
? EntraIdGovernmentGraphEndpoint
|
||||||
: AzurePublicGraphEndpoint;
|
: EntraIdPublicGraphEndpoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ import { StateService as StateServiceAbstraction } from "@/src/abstractions/stat
|
|||||||
import { DirectoryType } from "@/src/enums/directoryType";
|
import { DirectoryType } from "@/src/enums/directoryType";
|
||||||
import { IConfiguration } from "@/src/models/IConfiguration";
|
import { IConfiguration } from "@/src/models/IConfiguration";
|
||||||
import { Account } from "@/src/models/account";
|
import { Account } from "@/src/models/account";
|
||||||
import { AzureConfiguration } from "@/src/models/azureConfiguration";
|
import { EntraIdConfiguration } from "@/src/models/entraIdConfiguration";
|
||||||
import { GSuiteConfiguration } from "@/src/models/gsuiteConfiguration";
|
import { GSuiteConfiguration } from "@/src/models/gsuiteConfiguration";
|
||||||
import { LdapConfiguration } from "@/src/models/ldapConfiguration";
|
import { LdapConfiguration } from "@/src/models/ldapConfiguration";
|
||||||
import { OktaConfiguration } from "@/src/models/oktaConfiguration";
|
import { OktaConfiguration } from "@/src/models/oktaConfiguration";
|
||||||
@@ -21,7 +21,10 @@ import { SyncConfiguration } from "@/src/models/syncConfiguration";
|
|||||||
const SecureStorageKeys = {
|
const SecureStorageKeys = {
|
||||||
ldap: "ldapPassword",
|
ldap: "ldapPassword",
|
||||||
gsuite: "gsuitePrivateKey",
|
gsuite: "gsuitePrivateKey",
|
||||||
|
// Azure Active Directory was renamed to Entra ID, but we've kept the old property name
|
||||||
|
// to be backwards compatible with existing configurations.
|
||||||
azure: "azureKey",
|
azure: "azureKey",
|
||||||
|
entra: "entrakey",
|
||||||
okta: "oktaToken",
|
okta: "oktaToken",
|
||||||
oneLogin: "oneLoginClientSecret",
|
oneLogin: "oneLoginClientSecret",
|
||||||
userDelta: "userDeltaToken",
|
userDelta: "userDeltaToken",
|
||||||
@@ -68,8 +71,8 @@ export class StateService
|
|||||||
case DirectoryType.Ldap:
|
case DirectoryType.Ldap:
|
||||||
(configWithSecrets as any).password = await this.getLdapKey();
|
(configWithSecrets as any).password = await this.getLdapKey();
|
||||||
break;
|
break;
|
||||||
case DirectoryType.AzureActiveDirectory:
|
case DirectoryType.EntraID:
|
||||||
(configWithSecrets as any).key = await this.getAzureKey();
|
(configWithSecrets as any).key = await this.getEntraKey();
|
||||||
break;
|
break;
|
||||||
case DirectoryType.Okta:
|
case DirectoryType.Okta:
|
||||||
(configWithSecrets as any).token = await this.getOktaKey();
|
(configWithSecrets as any).token = await this.getOktaKey();
|
||||||
@@ -93,7 +96,7 @@ export class StateService
|
|||||||
config:
|
config:
|
||||||
| LdapConfiguration
|
| LdapConfiguration
|
||||||
| GSuiteConfiguration
|
| GSuiteConfiguration
|
||||||
| AzureConfiguration
|
| EntraIdConfiguration
|
||||||
| OktaConfiguration
|
| OktaConfiguration
|
||||||
| OneLoginConfiguration,
|
| OneLoginConfiguration,
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
@@ -106,11 +109,11 @@ export class StateService
|
|||||||
await this.setLdapConfiguration(ldapConfig);
|
await this.setLdapConfiguration(ldapConfig);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DirectoryType.AzureActiveDirectory: {
|
case DirectoryType.EntraID: {
|
||||||
const azureConfig = config as AzureConfiguration;
|
const entraConfig = config as EntraIdConfiguration;
|
||||||
await this.setAzureKey(azureConfig.key);
|
await this.setEntraKey(entraConfig.key);
|
||||||
azureConfig.key = StoredSecurely;
|
entraConfig.key = StoredSecurely;
|
||||||
await this.setAzureConfiguration(azureConfig);
|
await this.setEntraConfiguration(entraConfig);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DirectoryType.Okta: {
|
case DirectoryType.Okta: {
|
||||||
@@ -187,23 +190,30 @@ export class StateService
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getAzureKey(options?: StorageOptions): Promise<string> {
|
private async getEntraKey(options?: StorageOptions): Promise<string> {
|
||||||
options = this.reconcileOptions(options, await this.defaultSecureStorageOptions());
|
options = this.reconcileOptions(options, await this.defaultSecureStorageOptions());
|
||||||
if (options?.userId == null) {
|
if (options?.userId == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return await this.secureStorageService.get<string>(
|
|
||||||
`${options.userId}_${SecureStorageKeys.azure}`,
|
const entraKey = await this.secureStorageService.get<string>(
|
||||||
|
`${options.userId}_${SecureStorageKeys.entra}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (entraKey != null) {
|
||||||
|
return entraKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.secureStorageService.get<string>(`${options.userId}_${SecureStorageKeys.azure}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async setAzureKey(value: string, options?: StorageOptions): Promise<void> {
|
private async setEntraKey(value: string, options?: StorageOptions): Promise<void> {
|
||||||
options = this.reconcileOptions(options, await this.defaultSecureStorageOptions());
|
options = this.reconcileOptions(options, await this.defaultSecureStorageOptions());
|
||||||
if (options?.userId == null) {
|
if (options?.userId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.secureStorageService.save(
|
await this.secureStorageService.save(
|
||||||
`${options.userId}_${SecureStorageKeys.azure}`,
|
`${options.userId}_${SecureStorageKeys.entra}`,
|
||||||
value,
|
value,
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
@@ -259,8 +269,8 @@ export class StateService
|
|||||||
return await this.getLdapConfiguration();
|
return await this.getLdapConfiguration();
|
||||||
case DirectoryType.GSuite:
|
case DirectoryType.GSuite:
|
||||||
return await this.getGsuiteConfiguration();
|
return await this.getGsuiteConfiguration();
|
||||||
case DirectoryType.AzureActiveDirectory:
|
case DirectoryType.EntraID:
|
||||||
return await this.getAzureConfiguration();
|
return await this.getEntraConfiguration();
|
||||||
case DirectoryType.Okta:
|
case DirectoryType.Okta:
|
||||||
return await this.getOktaConfiguration();
|
return await this.getOktaConfiguration();
|
||||||
case DirectoryType.OneLogin:
|
case DirectoryType.OneLogin:
|
||||||
@@ -305,17 +315,20 @@ export class StateService
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAzureConfiguration(options?: StorageOptions): Promise<AzureConfiguration> {
|
async getEntraConfiguration(options?: StorageOptions): Promise<EntraIdConfiguration> {
|
||||||
return (
|
return (
|
||||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||||
)?.directoryConfigurations?.azure;
|
)?.directoryConfigurations?.entra;
|
||||||
}
|
}
|
||||||
|
|
||||||
async setAzureConfiguration(value: AzureConfiguration, options?: StorageOptions): Promise<void> {
|
async setEntraConfiguration(
|
||||||
|
value: EntraIdConfiguration,
|
||||||
|
options?: StorageOptions,
|
||||||
|
): Promise<void> {
|
||||||
const account = await this.getAccount(
|
const account = await this.getAccount(
|
||||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||||
);
|
);
|
||||||
account.directoryConfigurations.azure = value;
|
account.directoryConfigurations.entra = value;
|
||||||
await this.saveAccount(
|
await this.saveAccount(
|
||||||
account,
|
account,
|
||||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { StateMigrationService as BaseStateMigrationService } from "@/jslib/comm
|
|||||||
|
|
||||||
import { DirectoryType } from "@/src/enums/directoryType";
|
import { DirectoryType } from "@/src/enums/directoryType";
|
||||||
import { Account, DirectoryConfigurations, DirectorySettings } from "@/src/models/account";
|
import { Account, DirectoryConfigurations, DirectorySettings } from "@/src/models/account";
|
||||||
import { AzureConfiguration } from "@/src/models/azureConfiguration";
|
import { EntraIdConfiguration } from "@/src/models/entraIdConfiguration";
|
||||||
import { GSuiteConfiguration } from "@/src/models/gsuiteConfiguration";
|
import { GSuiteConfiguration } from "@/src/models/gsuiteConfiguration";
|
||||||
import { LdapConfiguration } from "@/src/models/ldapConfiguration";
|
import { LdapConfiguration } from "@/src/models/ldapConfiguration";
|
||||||
import { OktaConfiguration } from "@/src/models/oktaConfiguration";
|
import { OktaConfiguration } from "@/src/models/oktaConfiguration";
|
||||||
@@ -14,6 +14,7 @@ const SecureStorageKeys: { [key: string]: any } = {
|
|||||||
ldap: "ldapPassword",
|
ldap: "ldapPassword",
|
||||||
gsuite: "gsuitePrivateKey",
|
gsuite: "gsuitePrivateKey",
|
||||||
azure: "azureKey",
|
azure: "azureKey",
|
||||||
|
entra: "entraIdKey",
|
||||||
okta: "oktaToken",
|
okta: "oktaToken",
|
||||||
oneLogin: "oneLoginClientSecret",
|
oneLogin: "oneLoginClientSecret",
|
||||||
directoryConfigPrefix: "directoryConfig_",
|
directoryConfigPrefix: "directoryConfig_",
|
||||||
@@ -104,13 +105,16 @@ export class StateMigrationService extends BaseStateMigrationService {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initilize typed objects from key/value pairs in storage to either be saved temporarily until an account is authed or applied to the active account
|
// Initialize typed objects from key/value pairs in storage to either be saved temporarily until an account is authed or applied to the active account
|
||||||
const getDirectoryConfig = async <T>(type: DirectoryType) =>
|
const getDirectoryConfig = async <T>(type: DirectoryType) =>
|
||||||
await this.get<T>(SecureStorageKeys.directoryConfigPrefix + type);
|
await this.get<T>(SecureStorageKeys.directoryConfigPrefix + type);
|
||||||
const directoryConfigs: DirectoryConfigurations = {
|
const directoryConfigs: DirectoryConfigurations = {
|
||||||
ldap: await getDirectoryConfig<LdapConfiguration>(DirectoryType.Ldap),
|
ldap: await getDirectoryConfig<LdapConfiguration>(DirectoryType.Ldap),
|
||||||
gsuite: await getDirectoryConfig<GSuiteConfiguration>(DirectoryType.GSuite),
|
gsuite: await getDirectoryConfig<GSuiteConfiguration>(DirectoryType.GSuite),
|
||||||
azure: await getDirectoryConfig<AzureConfiguration>(DirectoryType.AzureActiveDirectory),
|
// Azure Active Directory was renamed to Entra ID, but we've kept the old property name
|
||||||
|
// to be backwards compatible with existing configurations.
|
||||||
|
azure: await getDirectoryConfig<EntraIdConfiguration>(DirectoryType.EntraID),
|
||||||
|
entra: await getDirectoryConfig<EntraIdConfiguration>(DirectoryType.EntraID),
|
||||||
okta: await getDirectoryConfig<OktaConfiguration>(DirectoryType.Okta),
|
okta: await getDirectoryConfig<OktaConfiguration>(DirectoryType.Okta),
|
||||||
oneLogin: await getDirectoryConfig<OneLoginConfiguration>(DirectoryType.OneLogin),
|
oneLogin: await getDirectoryConfig<OneLoginConfiguration>(DirectoryType.OneLogin),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user