feat(console): enable ID token mapping for generic OIDC provider (#6426)

* fix: use IsIdTokenMapping request property

* feat(console): oidc provider id token mapping

* fix scss

* reduce styles

* fix lint

---------

Co-authored-by: peintnermax <[email protected]>
Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Elio Bischof
2023-08-23 12:57:20 +00:00
committed by GitHub
co-authored by peintnermax Livio Spring
parent 66772ad0dd
commit 29fa3d417c
16 changed files with 70 additions and 18 deletions
@@ -78,6 +78,14 @@
</cnsl-form-field>
</div>
<div class="id-token-mapping">
<cnsl-info-section>
<div>
<p class="checkbox-desc">{{ 'IDP.ISIDTOKENMAPPING_DESC' | translate }}</p>
<mat-checkbox formControlName="isIdTokenMapping">{{ 'IDP.ISIDTOKENMAPPING' | translate }}</mat-checkbox>
</div>
</cnsl-info-section>
</div>
<cnsl-provider-options
[initialOptions]="provider?.config?.options"
(optionsChanged)="options = $event"
@@ -0,0 +1,8 @@
.id-token-mapping {
max-width: 400px;
.checkbox-desc {
margin-top: 0;
margin-bottom: 0.5rem;
}
}
@@ -27,6 +27,7 @@ import { PolicyComponentServiceType } from '../../policies/policy-component-type
@Component({
selector: 'cnsl-provider-oidc',
templateUrl: './provider-oidc.component.html',
styleUrls: ['./provider-oidc.component.scss'],
})
export class ProviderOIDCComponent {
public showOptional: boolean = false;
@@ -56,6 +57,7 @@ export class ProviderOIDCComponent {
clientSecret: new UntypedFormControl('', [requiredValidator]),
issuer: new UntypedFormControl('', [requiredValidator]),
scopesList: new UntypedFormControl(['openid', 'profile', 'email'], []),
isIdTokenMapping: new UntypedFormControl(),
});
this.route.data.pipe(take(1)).subscribe((data) => {
@@ -131,6 +133,7 @@ export class ProviderOIDCComponent {
req.setIssuer(this.issuer?.value);
req.setScopesList(this.scopesList?.value);
req.setProviderOptions(this.options);
req.setIsIdTokenMapping(this.isIdTokenMapping?.value);
this.loading = true;
this.service
@@ -160,6 +163,7 @@ export class ProviderOIDCComponent {
req.setIssuer(this.issuer?.value);
req.setScopesList(this.scopesList?.value);
req.setProviderOptions(this.options);
req.setIsIdTokenMapping(this.isIdTokenMapping?.value);
this.loading = true;
this.service
@@ -224,4 +228,8 @@ export class ProviderOIDCComponent {
public get scopesList(): AbstractControl | null {
return this.form.get('scopesList');
}
public get isIdTokenMapping(): AbstractControl | null {
return this.form.get('isIdTokenMapping');
}
}