fix(console): set options (#5605)

fix: set idp options
This commit is contained in:
Max Peintner 2023-04-14 17:20:53 +02:00 committed by GitHub
parent d140f9373a
commit e79e280dc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 154 additions and 63 deletions

View File

@ -25,9 +25,14 @@
<input cnslInput formControlName="clientId" />
</cnsl-form-field>
<mat-checkbox *ngIf="provider" [(ngModel)]="updateClientSecret" [ngModelOptions]="{ standalone: true }">{{
'IDP.UPDATECLIENTSECRET' | translate
}}</mat-checkbox>
<mat-checkbox
class="update-secret-checkbox"
*ngIf="provider"
[(ngModel)]="updateClientSecret"
[ngModelOptions]="{ standalone: true }"
>{{ 'IDP.UPDATECLIENTSECRET' | translate }}</mat-checkbox
>
<cnsl-form-field *ngIf="!provider || (provider && updateClientSecret)" class="formfield">
<cnsl-label>{{ 'IDP.CLIENTSECRET' | translate }}</cnsl-label>
<input cnslInput formControlName="clientSecret" />
@ -85,7 +90,7 @@
</mat-select>
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-form-field class="formfield" *ngIf="tenantType?.value === AzureTenantIDType">
<cnsl-label>{{ 'IDP.AZUREADTENANTID' | translate }}</cnsl-label>
<input cnslInput formControlName="tenantId" />
</cnsl-form-field>

View File

@ -44,7 +44,10 @@ export class ProviderAzureADComponent {
public provider?: Provider.AsObject;
public updateClientSecret: boolean = false;
public AzureTenantIDType: number = 3;
public tenantTypes = [
this.AzureTenantIDType,
AzureADTenantType.AZURE_AD_TENANT_TYPE_COMMON,
AzureADTenantType.AZURE_AD_TENANT_TYPE_ORGANISATIONS,
AzureADTenantType.AZURE_AD_TENANT_TYPE_CONSUMERS,
@ -126,15 +129,34 @@ export class ProviderAzureADComponent {
: new MgmtGetProviderByIDRequest();
req.setId(id);
this.service
.getProviderByID(req)
.getProviderID(req)
.then((resp) => {
this.provider = resp.idp;
const object = resp.toObject();
this.provider = object.idp;
this.loading = false;
if (this.provider?.config?.azureAd) {
this.form.patchValue(this.provider.config.azureAd);
this.name?.setValue(this.provider.name);
this.tenantId?.setValue(this.provider.config.azureAd.tenant?.tenantId);
this.tenantType?.setValue(this.provider.config.azureAd.tenant?.tenantType);
const tenant = resp.getIdp()?.getConfig()?.getAzureAd()?.getTenant();
if (tenant) {
switch (tenant.getTypeCase()) {
case AzureADTenant.TypeCase.TENANT_ID:
this.tenantId?.setValue(tenant.getTenantId());
this.tenantType?.setValue(this.AzureTenantIDType);
break;
case AzureADTenant.TypeCase.TENANT_TYPE:
this.tenantType?.setValue(tenant.getTenantType());
this.tenantId?.setValue('');
break;
case AzureADTenant.TypeCase.TYPE_NOT_SET:
this.tenantType?.setValue(this.AzureTenantIDType);
break;
}
}
}
})
.catch((error) => {
@ -159,8 +181,11 @@ export class ProviderAzureADComponent {
req.setEmailVerified(this.emailVerified?.value);
const tenant = new AzureADTenant();
tenant.setTenantId(this.tenantId?.value);
tenant.setTenantType(this.tenantType?.value);
if (this.tenantType?.value === this.AzureTenantIDType) {
tenant.setTenantId(this.tenantId?.value);
} else {
tenant.setTenantType(this.tenantType?.value);
}
req.setTenant(tenant);
req.setScopesList(this.scopesList?.value);
@ -194,9 +219,11 @@ export class ProviderAzureADComponent {
req.setEmailVerified(this.emailVerified?.value);
const tenant = new AzureADTenant();
tenant.setTenantId(this.tenantId?.value);
tenant.setTenantType(this.tenantType?.value);
if (this.tenantType?.value === this.AzureTenantIDType) {
tenant.setTenantId(this.tenantId?.value);
} else {
tenant.setTenantType(this.tenantType?.value);
}
req.setTenant(tenant);
req.setScopesList(this.scopesList?.value);

View File

@ -40,9 +40,14 @@
<input cnslInput formControlName="clientId" />
</cnsl-form-field>
<mat-checkbox *ngIf="provider" [(ngModel)]="updateClientSecret" [ngModelOptions]="{ standalone: true }">{{
'IDP.UPDATECLIENTSECRET' | translate
}}</mat-checkbox>
<mat-checkbox
class="update-secret-checkbox"
*ngIf="provider"
[(ngModel)]="updateClientSecret"
[ngModelOptions]="{ standalone: true }"
>{{ 'IDP.UPDATECLIENTSECRET' | translate }}</mat-checkbox
>
<cnsl-form-field *ngIf="!provider || (provider && updateClientSecret)" class="formfield">
<cnsl-label>{{ 'IDP.CLIENTSECRET' | translate }}</cnsl-label>
<input cnslInput formControlName="clientSecret" />

View File

@ -153,6 +153,7 @@ export class ProviderGithubESComponent {
req.setClientId(this.clientId?.value);
req.setClientSecret(this.clientSecret?.value);
req.setScopesList(this.scopesList?.value);
req.setProviderOptions(this.options);
this.loading = true;
this.service
@ -183,6 +184,7 @@ export class ProviderGithubESComponent {
req.setClientId(this.clientId?.value);
req.setClientSecret(this.clientSecret?.value);
req.setScopesList(this.scopesList?.value);
req.setProviderOptions(this.options);
this.loading = true;
this.service

View File

@ -21,9 +21,14 @@
<input cnslInput formControlName="clientId" />
</cnsl-form-field>
<mat-checkbox *ngIf="provider" [(ngModel)]="updateClientSecret" [ngModelOptions]="{ standalone: true }">{{
'IDP.UPDATECLIENTSECRET' | translate
}}</mat-checkbox>
<mat-checkbox
class="update-secret-checkbox"
*ngIf="provider"
[(ngModel)]="updateClientSecret"
[ngModelOptions]="{ standalone: true }"
>{{ 'IDP.UPDATECLIENTSECRET' | translate }}</mat-checkbox
>
<cnsl-form-field *ngIf="!provider || (provider && updateClientSecret)" class="formfield">
<cnsl-label>{{ 'IDP.CLIENTSECRET' | translate }}</cnsl-label>
<input cnslInput formControlName="clientSecret" />

View File

@ -30,9 +30,14 @@
<input cnslInput formControlName="clientId" />
</cnsl-form-field>
<mat-checkbox *ngIf="provider" [(ngModel)]="updateClientSecret" [ngModelOptions]="{ standalone: true }">{{
'IDP.UPDATECLIENTSECRET' | translate
}}</mat-checkbox>
<mat-checkbox
class="update-secret-checkbox"
*ngIf="provider"
[(ngModel)]="updateClientSecret"
[ngModelOptions]="{ standalone: true }"
>{{ 'IDP.UPDATECLIENTSECRET' | translate }}</mat-checkbox
>
<cnsl-form-field *ngIf="!provider || (provider && updateClientSecret)" class="formfield">
<cnsl-label>{{ 'IDP.CLIENTSECRET' | translate }}</cnsl-label>
<input cnslInput formControlName="clientSecret" />

View File

@ -20,9 +20,14 @@
<input cnslInput formControlName="clientId" />
</cnsl-form-field>
<mat-checkbox *ngIf="provider" [(ngModel)]="updateClientSecret" [ngModelOptions]="{ standalone: true }">{{
'IDP.UPDATECLIENTSECRET' | translate
}}</mat-checkbox>
<mat-checkbox
class="update-secret-checkbox"
*ngIf="provider"
[(ngModel)]="updateClientSecret"
[ngModelOptions]="{ standalone: true }"
>{{ 'IDP.UPDATECLIENTSECRET' | translate }}</mat-checkbox
>
<cnsl-form-field *ngIf="!provider || (provider && updateClientSecret)" class="formfield">
<cnsl-label>{{ 'IDP.CLIENTSECRET' | translate }}</cnsl-label>
<input cnslInput formControlName="clientSecret" />

View File

@ -20,9 +20,13 @@
<input cnslInput formControlName="clientId" />
</cnsl-form-field>
<mat-checkbox *ngIf="provider" [(ngModel)]="updateClientSecret" [ngModelOptions]="{ standalone: true }">{{
'IDP.UPDATECLIENTSECRET' | translate
}}</mat-checkbox>
<mat-checkbox
class="update-secret-checkbox"
*ngIf="provider"
[(ngModel)]="updateClientSecret"
[ngModelOptions]="{ standalone: true }"
>{{ 'IDP.UPDATECLIENTSECRET' | translate }}</mat-checkbox
>
<cnsl-form-field *ngIf="!provider || (provider && updateClientSecret)" class="formfield">
<cnsl-label>{{ 'IDP.CLIENTSECRET' | translate }}</cnsl-label>
<input cnslInput formControlName="clientSecret" />

View File

@ -39,9 +39,13 @@
<input cnslInput formControlName="bindDn" />
</cnsl-form-field>
<mat-checkbox *ngIf="provider" [(ngModel)]="updateBindPassword" [ngModelOptions]="{ standalone: true }">{{
'IDP.UPDATEBINDPASSWORD' | translate
}}</mat-checkbox>
<mat-checkbox
class="update-secret-checkbox"
*ngIf="provider"
[(ngModel)]="updateBindPassword"
[ngModelOptions]="{ standalone: true }"
>{{ 'IDP.UPDATEBINDPASSWORD' | translate }}</mat-checkbox
>
<cnsl-form-field *ngIf="!provider || (provider && updateBindPassword)" class="formfield">
<cnsl-label>{{ 'IDP.BINDPASSWORD' | translate }}</cnsl-label>
<input cnslInput formControlName="bindPassword" />

View File

@ -13,40 +13,45 @@
<p class="identity-provider-desc cnsl-secondary-text">{{ 'IDP.CREATE.OAUTH.DESCRIPTION' | translate }}</p>
<form [formGroup]="form" (ngSubmit)="submitForm()">
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.NAME' | translate }}</cnsl-label>
<input cnslInput formControlName="name" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.AUTHORIZATIONENDPOINT' | translate }}</cnsl-label>
<input cnslInput formControlName="authorizationEndpoint" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.TOKENENDPOINT' | translate }}</cnsl-label>
<input cnslInput formControlName="tokenEndpoint" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.USERENDPOINT' | translate }}</cnsl-label>
<input cnslInput formControlName="userEndpoint" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.IDATTRIBUTE' | translate }}</cnsl-label>
<input cnslInput formControlName="idAttribute" />
</cnsl-form-field>
<div class="identity-provider-content">
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.NAME' | translate }}</cnsl-label>
<input cnslInput formControlName="name" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.AUTHORIZATIONENDPOINT' | translate }}</cnsl-label>
<input cnslInput formControlName="authorizationEndpoint" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.TOKENENDPOINT' | translate }}</cnsl-label>
<input cnslInput formControlName="tokenEndpoint" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.USERENDPOINT' | translate }}</cnsl-label>
<input cnslInput formControlName="userEndpoint" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.IDATTRIBUTE' | translate }}</cnsl-label>
<input cnslInput formControlName="idAttribute" />
</cnsl-form-field>
<cnsl-form-field class="formfield">
<cnsl-label>{{ 'IDP.CLIENTID' | translate }}</cnsl-label>
<input cnslInput formControlName="clientId" />
</cnsl-form-field>
<mat-checkbox *ngIf="provider" [(ngModel)]="updateClientSecret" [ngModelOptions]="{ standalone: true }">{{
'IDP.UPDATECLIENTSECRET' | translate
}}</mat-checkbox>
<mat-checkbox
class="update-secret-checkbox"
*ngIf="provider"
[(ngModel)]="updateClientSecret"
[ngModelOptions]="{ standalone: true }"
>{{ 'IDP.UPDATECLIENTSECRET' | translate }}</mat-checkbox
>
<cnsl-form-field *ngIf="!provider || (provider && updateClientSecret)" class="formfield">
<cnsl-label>{{ 'IDP.CLIENTSECRET' | translate }}</cnsl-label>
<input cnslInput formControlName="clientSecret" />

View File

@ -155,6 +155,7 @@ export class ProviderOAuthComponent {
req.setClientId(this.clientId?.value);
req.setClientSecret(this.clientSecret?.value);
req.setScopesList(this.scopesList?.value);
req.setProviderOptions(this.options);
this.loading = true;
this.service
@ -186,6 +187,7 @@ export class ProviderOAuthComponent {
req.setClientId(this.clientId?.value);
req.setClientSecret(this.clientSecret?.value);
req.setScopesList(this.scopesList?.value);
req.setProviderOptions(this.options);
this.loading = true;
this.service

View File

@ -130,6 +130,7 @@ export class ProviderOIDCComponent {
req.setClientSecret(this.clientSecret?.value);
req.setIssuer(this.issuer?.value);
req.setScopesList(this.scopesList?.value);
req.setProviderOptions(this.options);
this.loading = true;
this.service
@ -158,6 +159,7 @@ export class ProviderOIDCComponent {
req.setClientSecret(this.clientSecret?.value);
req.setIssuer(this.issuer?.value);
req.setScopesList(this.scopesList?.value);
req.setProviderOptions(this.options);
this.loading = true;
this.service

View File

@ -36,6 +36,10 @@
}
}
.update-secret-checkbox {
margin: 0.5rem 0 0 0;
}
.formfield {
display: block;
max-width: 400px;

View File

@ -1047,6 +1047,10 @@ export class AdminService {
return this.grpcService.admin.getProviderByID(req, null).then((resp) => resp.toObject());
}
public getProviderID(req: GetProviderByIDRequest): Promise<GetProviderByIDResponse> {
return this.grpcService.admin.getProviderByID(req, null);
}
public listIAMMembers(
limit: number,
offset: number,

View File

@ -987,6 +987,10 @@ export class ManagementService {
return this.grpcService.mgmt.getProviderByID(req, null).then((resp) => resp.toObject());
}
public getProviderID(req: GetProviderByIDRequest): Promise<GetProviderByIDResponse> {
return this.grpcService.mgmt.getProviderByID(req, null);
}
public addHumanUser(req: AddHumanUserRequest): Promise<AddHumanUserResponse.AsObject> {
return this.grpcService.mgmt.addHumanUser(req, null).then((resp) => resp.toObject());
}

View File

@ -1699,6 +1699,7 @@
"2": "inaktiv"
},
"AZUREADTENANTTYPES": {
"3": "Tenant ID",
"0": "Common",
"1": "Organizations",
"2": "Consumers"

View File

@ -1699,6 +1699,7 @@
"2": "inactive"
},
"AZUREADTENANTTYPES": {
"3": "Tenant ID",
"0": "Common",
"1": "Organizations",
"2": "Consumers"

View File

@ -1699,9 +1699,10 @@
"2": "inactivo"
},
"AZUREADTENANTTYPES": {
"0": "Común",
"1": "Organizaciones",
"2": "Clientes"
"3": "Tenant ID",
"0": "Common",
"1": "Organizations",
"2": "Consumers"
},
"AZUREADTENANTTYPE": "Tipo de Tenant",
"AZUREADTENANTID": "ID de Tenant",

View File

@ -1703,6 +1703,7 @@
"2": "inactif"
},
"AZUREADTENANTTYPES": {
"3": "Tenant ID",
"0": "Common",
"1": "Organizations",
"2": "Consumers"

View File

@ -1704,6 +1704,7 @@
"2": "inattivo"
},
"AZUREADTENANTTYPES": {
"3": "Tenant ID",
"0": "Common",
"1": "Organizations",
"2": "Consumers"

View File

@ -1694,9 +1694,10 @@
"2": "非アクティブ"
},
"AZUREADTENANTTYPES": {
"0": "共通",
"1": "組織",
"2": "顧客"
"3": "Tenant ID",
"0": "Common",
"1": "Organizations",
"2": "Consumers"
},
"AZUREADTENANTTYPE": "テナントタイプ",
"AZUREADTENANTID": "テナントID",

View File

@ -1703,6 +1703,7 @@
"2": "nieaktywny"
},
"AZUREADTENANTTYPES": {
"3": "Tenant ID",
"0": "Common",
"1": "Organizations",
"2": "Consumers"

View File

@ -1702,6 +1702,7 @@
"2": "停用"
},
"AZUREADTENANTTYPES": {
"3": "Tenant ID",
"0": "Common",
"1": "Organizations",
"2": "Consumers"