[ADF-2795] SSO implicitflow (#3332)

* Enable OAUTH2

* Create SSO services

* SSO improvements

* Rollback sso login change

* Add SSO configuration from Setting component

* Refactoring

* Remove login ECM/BPM toggle and move use the userpreference instead of store

* fix host setting unit test

* Fix unit test missing instance

* use the Js api oauth

* add logout component and clean sso not used class

* fix dependencies cicle

* add translation settings

* fix style setting page

* clean

* JS APi should receive the oauth config from the userPreference and not from the config file

* change login if SSO is present

* missing spaces

* add sso test in login component

* add logout directive new properties test

* Improve host setting and remove library reference

* fix login test

* Remove unused code

* Fix authentication unit test

* fix authguard unit test

* fix csrf check login component

* fix unit test core and demo shell

* remove
This commit is contained in:
Maurizio Vitale
2018-06-07 23:19:58 +01:00
committed by Eugenio Romano
parent 3a6c12e624
commit f8e92b2fb0
57 changed files with 1295 additions and 681 deletions

View File

@@ -1,70 +1,97 @@
<div class="adf-setting-container">
<div class="adf-setting-card-padding"></div>
<mat-toolbar color="primary" class="adf-setting-toolbar">
<h3>{{'CORE.HOST_SETTINGS.TITLE' | translate}}</h3>
</mat-toolbar>
<mat-card class="adf-setting-card">
<div *ngIf="providers==='ALL' || providers==='ECM'">
<mat-card-header>
<mat-card-subtitle>{{'CORE.HOST_SETTINGS.CS-HOST' | translate }}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<mat-form-field class="full-width">
<mat-icon class="adf-CORE.HOST_SETTINGS-link-icon" matPrefix>link</mat-icon>
<input matInput
[formControl]="urlFormControlEcm"
data-automation-id="ecmHost"
type="text"
(change)="onChangeECMHost($event)"
tabindex="2"
id="ecmHost"
value="{{ecmHost}}"
placeholder="http(s)://host|ip:port(/path)">
<mat-error *ngIf="urlFormControlEcm.hasError('pattern')">
{{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }}
</mat-error>
</mat-form-field>
<p>
</mat-card-content>
</div>
<p>
<div *ngIf="providers==='ALL' || providers==='BPM'">
<mat-card-header>
<mat-card-subtitle>{{'CORE.HOST_SETTINGS.BP-HOST' | translate }}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<form id="host-form" [formGroup]="form" (submit)="onSubmit(form.value)">
<mat-form-field>
<mat-select placeholder="Provider" [formControl]="providers">
<mat-option *ngFor="let provider of providersValues" [value]="provider.value">
{{ provider.title }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="full-width">
<mat-icon class="adf-CORE.HOST_SETTINGS-link-icon" matPrefix>link</mat-icon>
<input matInput
[formControl]="urlFormControlBpm"
data-automation-id="bpmHost"
type="text"
(change)="onChangeBPMHost($event)"
tabindex="2"
id="bpmHost"
value="{{bpmHost}}"
placeholder="http(s)://host|ip:port(/path)">
<mat-error *ngIf="urlFormControlBpm.hasError('pattern')">
{{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }}
</mat-error>
</mat-form-field>
</mat-card-content>
</div>
<mat-card-actions class="adf-CORE.HOST_SETTINGS-actions">
<ng-container *ngIf="isALL() || isECM()">
<mat-card-content>
<mat-form-field class="full-width" floatLabel="{{'CORE.HOST_SETTINGS.CS-HOST' | translate }}" >
<mat-label>{{'CORE.HOST_SETTINGS.CS-HOST' | translate }}</mat-label>
<input matInput [formControl]="ecmHost" data-automation-id="ecmHost" type="text" tabindex="2" id="ecmHost" placeholder="http(s)://host|ip:port(/path)">
<mat-error *ngIf="ecmHost.hasError('pattern')">
{{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }}
</mat-error>
<mat-error *ngIf="ecmHost.hasError('required')">
{{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }}
</mat-error>
</mat-form-field>
<p>
</mat-card-content>
</ng-container>
<button mat-button onclick="window.history.back()" color="primary">
{{'CORE.HOST_SETTINGS.BACK' | translate }}
</button>
<ng-container *ngIf="isALL() || isOAUTH() || isBPM()">
<mat-card-content>
<mat-form-field class="full-width" floatLabel="{{'CORE.HOST_SETTINGS.BP-HOST' | translate }}">
<mat-label>{{'CORE.HOST_SETTINGS.BP-HOST' | translate }}</mat-label>
<input matInput [formControl]="bpmHost" data-automation-id="bpmHost" type="text" tabindex="2" id="bpmHost" placeholder="http(s)://host|ip:port(/path)">
<mat-error *ngIf="bpmHost.hasError('pattern')">
{{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }}
</mat-error>
<mat-error *ngIf="bpmHost.hasError('required')">
{{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }}
</mat-error>
</mat-form-field>
<ng-container *ngIf="isOAUTH()">
<div formGroupName="oauthConfig">
<mat-form-field class="full-width" floatLabel="Auth Host">
<mat-label>Auth Host</mat-label>
<input matInput name="host" id="oauthHost" formControlName="host" placeholder="http(s)://host|ip:port(/path)" >
<mat-error *ngIf="host.hasError('pattern')">
{{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }}
</mat-error>
<mat-error *ngIf="host.hasError('required')">
{{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }}
</mat-error>
</mat-form-field>
<mat-form-field class="full-width" floatLabel="Client Id">
<mat-label>{{ 'CORE.HOST_SETTINGS.CLIENT'| translate }}d</mat-label>
<input matInput name="clientId" id="clientId" formControlName="clientId" placeholder="Client Id">
<mat-error *ngIf="clientId.hasError('required')">
{{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }}
</mat-error>
</mat-form-field>
<button mat-raised-button (click)="save($event)"
[disabled]="urlFormControlBpm.hasError('pattern') || urlFormControlEcm.hasError('pattern')"
color="primary">
{{'CORE.HOST_SETTINGS.APPLY' | translate }}
</button>
<mat-form-field class="full-width" floatLabel="Scope">
<mat-label>{{ 'CORE.HOST_SETTINGS.SCOPE'| translate }}</mat-label>
<input matInput name="{{ 'CORE.HOST_SETTINGS.SCOPE'| translate }}" formControlName="scope" placeholder="Scope Id">
<mat-error *ngIf="scope.hasError('required')">
{{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }}
</mat-error>
</mat-form-field>
</mat-card-actions>
<label for="silentLogin">{{ 'CORE.HOST_SETTINGS.SILENT'| translate }}</label>
<mat-slide-toggle class="full-width" name="silentLogin" [color]="'primary'" formControlName="silentLogin">
</mat-slide-toggle>
<mat-form-field class="full-width" floatLabel="Redirect Uri">
<mat-label>{{ 'CORE.HOST_SETTINGS.REDIRECT'| translate }}</mat-label>
<input matInput placeholder="{{ 'CORE.HOST_SETTINGS.REDIRECT'| translate }}" name="redirectUri" formControlName="redirectUri">
<mat-error *ngIf="redirectUri.hasError('required')">
{{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }}
</mat-error>
</mat-form-field>
</div>
</ng-container>
</mat-card-content>
</ng-container>
<mat-card-actions class="adf-actions">
<button mat-button (click)="onCancel()" color="primary">
{{'CORE.HOST_SETTINGS.BACK' | translate }}
</button>
<button type="submit" id="host-button" tabindex="4" class="adf-login-button" mat-raised-button color="primary" data-automation-id="host-button"
[disabled]="!form.valid">
{{'CORE.HOST_SETTINGS.APPLY' | translate }}
</button>
</mat-card-actions>
</form>
</mat-card>
<div class="adf-setting-card-padding"></div>
</div>