From aa88fae09b63dfeb55e5dbb427ca763342ca24ed Mon Sep 17 00:00:00 2001
From: Joze RIHTARSIC <joze.RIHTARSIC@ext.ec.europa.eu>
Date: Wed, 25 May 2022 07:02:08 +0200
Subject: [PATCH] Update user dialog

---
 .../src/app/alert/alert.component.html        |   4 +-
 smp-angular/src/app/app.component.html        |   2 +-
 smp-angular/src/app/app.component.ts          |  21 +-
 smp-angular/src/app/app.module.ts             |  20 +-
 ...cess-token-generation-dialog.component.css |   4 -
 ...ess-token-generation-dialog.component.html |  60 ---
 ...ccess-token-generation-dialog.component.ts | 101 -----
 .../cancel-dialog.component.html              |   4 -
 .../certificate-dialog.component.html         |  47 ---
 .../app/common/dialog/dialog.component.html   |  32 --
 ...cess-token-generation-dialog.component.css |   3 +
 ...ess-token-generation-dialog.component.html |  63 ++++
 ...-token-generation-dialog.component.spec.ts |   0
 ...ccess-token-generation-dialog.component.ts | 142 +++++++
 .../access-token-ro.model.ts                  |   0
 .../cancel-dialog.component.html              |   5 +
 .../cancel-dialog.component.spec.ts           |   0
 .../cancel-dialog/cancel-dialog.component.ts  |   0
 .../certificate-dialog.component.html         |  54 +++
 .../certificate-dialog.component.spec.ts      |   0
 .../certificate-dialog.component.ts           |   9 +-
 .../confirmation-dialog.component.css         |   0
 .../confirmation-dialog.component.html        |   0
 .../confirmation-dialog.component.ts          |   0
 .../{ => dialogs}/dialog/dialog.component.css |   4 +
 .../dialogs/dialog/dialog.component.html      |  25 ++
 .../dialog/dialog.component.spec.ts           |   0
 .../{ => dialogs}/dialog/dialog.component.ts  |   1 +
 .../expired-password-dialog.component.html    |   6 +
 .../expired-password-dialog.component.spec.ts |   0
 .../expired-password-dialog.component.ts      |   2 +-
 .../information-dialog.component.css          |   0
 .../information-dialog.component.html         |   0
 .../information-dialog.component.ts           |   0
 .../password-change-dialog.component.css      |   4 +-
 .../password-change-dialog.component.html     |  48 +--
 .../password-change-dialog.component.spec.ts  |   0
 .../password-change-dialog.component.ts       |  97 +++--
 .../save-dialog/save-dialog.component.html    |   5 +
 .../save-dialog/save-dialog.component.spec.ts |   0
 .../save-dialog/save-dialog.component.ts      |   0
 .../autofocus/auto-focus.directive.ts         |  11 +
 smp-angular/src/app/common/dirty.guard.ts     |   2 +-
 .../domain-selector.component.ts              |   2 +-
 .../expired-password-dialog.component.html    |   4 -
 smp-angular/src/app/common/global-lookups.ts  |  25 +-
 .../save-dialog/save-dialog.component.html    |   4 -
 .../search-table/search-table.component.ts    |  10 +-
 .../domain-details-dialog.component.html      |  32 +-
 .../domain-details-dialog.component.ts        |  11 +
 .../src/app/domain/domain.component.ts        |   2 +-
 .../keystore-edit-dialog.component.css        |   8 +
 .../keystore-edit-dialog.component.html       |  32 +-
 .../keystore-edit-dialog.component.ts         |  18 +-
 .../keystore-import-dialog.component.html     |  10 +-
 smp-angular/src/app/login/login.component.ts  |   8 +-
 .../src/app/property/property-controller.ts   |   1 -
 .../property-details-dialog.component.html    |  26 +-
 smp-angular/src/app/security/user.model.ts    |   5 +-
 ...service-group-details-dialog.component.css |  16 +-
 ...ervice-group-details-dialog.component.html | 355 ++++++++----------
 .../service-group-details-dialog.component.ts |  34 +-
 .../service-group-edit.component.html         |   2 +-
 .../service-group-edit.component.ts           |  16 +-
 ...roup-extension-wizard-dialog.component.css |  11 +-
 ...oup-extension-wizard-dialog.component.html |   5 +-
 ...ervice-group-metadata-dialog.component.css |   9 +
 ...rvice-group-metadata-dialog.component.html |  32 +-
 ...rvice-metadata-wizard-dialog.component.css |   6 +
 ...vice-metadata-wizard-dialog.component.html |   7 +-
 smp-angular/src/app/smp.constants.ts          |  13 +-
 .../truststore-edit-dialog.component.css      |  13 +-
 .../truststore-edit-dialog.component.html     | 106 +++---
 .../truststore-edit-dialog.component.ts       |  84 ++++-
 smp-angular/src/app/user/user-controller.ts   |   5 +-
 .../user-details-dialog.component.html        | 245 ++++++------
 .../user-details-dialog.component.ts          | 247 ++++++------
 .../user-details.service.ts                   |  27 +-
 smp-angular/src/app/user/user-ro.model.ts     |   4 +-
 smp-angular/src/app/user/user.service.ts      |   2 +-
 smp-angular/src/styles.css                    |  40 ++
 .../edelivery/smp/data/ui/AccessTokenRO.java  |   5 -
 .../edelivery/smp/data/ui/CertificateRO.java  |   7 -
 .../ec/edelivery/smp/data/ui/UserRO.java      |  19 +-
 .../smp/data/ui/enums/SMPPropertyEnum.java    |   7 +-
 .../smp/services/ConfigurationService.java    |  29 +-
 .../smp/services/ui/UIUserService.java        |  54 ++-
 .../ec/edelivery/smp/utils/SMPConstants.java  |   6 -
 ...ConfigurationServiceAllGetMethodsTest.java |   5 +-
 .../ui/UIUserServiceIntegrationTest.java      |   5 +-
 .../mysql-4.1_integration_test_data.sql       |   2 +-
 .../smp/auth/SMPAuthorizationService.java     |  17 +-
 .../edelivery/smp/config/SmpWebAppConfig.java |   7 +
 .../smp/ui/AuthenticationResource.java        |   6 +-
 .../smp/ui/external/UserResource.java         |   9 +-
 .../ui/internal/TruststoreAdminResource.java  |   6 +-
 .../smp/ui/internal/UserAdminResource.java    |  36 +-
 .../smp/auth/SMPAuthorizationServiceTest.java |  21 +-
 98 files changed, 1367 insertions(+), 1127 deletions(-)
 delete mode 100644 smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.css
 delete mode 100644 smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.html
 delete mode 100644 smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.ts
 delete mode 100644 smp-angular/src/app/common/cancel-dialog/cancel-dialog.component.html
 delete mode 100644 smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.html
 delete mode 100644 smp-angular/src/app/common/dialog/dialog.component.html
 create mode 100644 smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.css
 create mode 100644 smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.html
 rename smp-angular/src/app/common/{ => dialogs}/access-token-generation-dialog/access-token-generation-dialog.component.spec.ts (100%)
 create mode 100644 smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.ts
 rename smp-angular/src/app/common/{ => dialogs}/access-token-generation-dialog/access-token-ro.model.ts (100%)
 create mode 100644 smp-angular/src/app/common/dialogs/cancel-dialog/cancel-dialog.component.html
 rename smp-angular/src/app/common/{ => dialogs}/cancel-dialog/cancel-dialog.component.spec.ts (100%)
 rename smp-angular/src/app/common/{ => dialogs}/cancel-dialog/cancel-dialog.component.ts (100%)
 create mode 100644 smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.html
 rename smp-angular/src/app/common/{ => dialogs}/certificate-dialog/certificate-dialog.component.spec.ts (100%)
 rename smp-angular/src/app/common/{ => dialogs}/certificate-dialog/certificate-dialog.component.ts (87%)
 rename smp-angular/src/app/common/{ => dialogs}/confirmation-dialog/confirmation-dialog.component.css (100%)
 rename smp-angular/src/app/common/{ => dialogs}/confirmation-dialog/confirmation-dialog.component.html (100%)
 rename smp-angular/src/app/common/{ => dialogs}/confirmation-dialog/confirmation-dialog.component.ts (100%)
 rename smp-angular/src/app/common/{ => dialogs}/dialog/dialog.component.css (94%)
 create mode 100644 smp-angular/src/app/common/dialogs/dialog/dialog.component.html
 rename smp-angular/src/app/common/{ => dialogs}/dialog/dialog.component.spec.ts (100%)
 rename smp-angular/src/app/common/{ => dialogs}/dialog/dialog.component.ts (95%)
 create mode 100644 smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.html
 rename smp-angular/src/app/common/{ => dialogs}/expired-password-dialog/expired-password-dialog.component.spec.ts (100%)
 rename smp-angular/src/app/common/{ => dialogs}/expired-password-dialog/expired-password-dialog.component.ts (86%)
 rename smp-angular/src/app/common/{ => dialogs}/information-dialog/information-dialog.component.css (100%)
 rename smp-angular/src/app/common/{ => dialogs}/information-dialog/information-dialog.component.html (100%)
 rename smp-angular/src/app/common/{ => dialogs}/information-dialog/information-dialog.component.ts (100%)
 rename smp-angular/src/app/common/{ => dialogs}/password-change-dialog/password-change-dialog.component.css (85%)
 rename smp-angular/src/app/common/{ => dialogs}/password-change-dialog/password-change-dialog.component.html (72%)
 rename smp-angular/src/app/common/{ => dialogs}/password-change-dialog/password-change-dialog.component.spec.ts (100%)
 rename smp-angular/src/app/common/{ => dialogs}/password-change-dialog/password-change-dialog.component.ts (58%)
 create mode 100644 smp-angular/src/app/common/dialogs/save-dialog/save-dialog.component.html
 rename smp-angular/src/app/common/{ => dialogs}/save-dialog/save-dialog.component.spec.ts (100%)
 rename smp-angular/src/app/common/{ => dialogs}/save-dialog/save-dialog.component.ts (100%)
 create mode 100644 smp-angular/src/app/common/directive/autofocus/auto-focus.directive.ts
 delete mode 100644 smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.html
 delete mode 100644 smp-angular/src/app/common/save-dialog/save-dialog.component.html
 create mode 100644 smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.css
 delete mode 100644 smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/utils/SMPConstants.java

diff --git a/smp-angular/src/app/alert/alert.component.html b/smp-angular/src/app/alert/alert.component.html
index 199123c6d..b5163d62c 100644
--- a/smp-angular/src/app/alert/alert.component.html
+++ b/smp-angular/src/app/alert/alert.component.html
@@ -9,7 +9,9 @@
   [showSearchPanel]="false"
   [filter]="filter"
   [allowNewItems]="false"
-  [allowDeleteItems]="securityService.isCurrentUserSystemAdmin()"
+  [allowDeleteItems]="false"
+  [allowEditItems]="false"
+  [showActionButtons]="false"
 >
   <ng-template #additionalToolButtons>
     <span style="width: 2px;background-color: deepskyblue;">&nbsp;</span>
diff --git a/smp-angular/src/app/app.component.html b/smp-angular/src/app/app.component.html
index d80d71f36..78e7522df 100644
--- a/smp-angular/src/app/app.component.html
+++ b/smp-angular/src/app/app.component.html
@@ -95,7 +95,7 @@
             <button mat-menu-item id="changePassword_id" (click)="changeCurrentUserPassword()">
               <span>Change password</span>
             </button>
-            <button mat-menu-item id="getAccessToken_id" (click)="regenerateAccesesToken()">
+            <button mat-menu-item id="getAccessToken_id" (click)="regenerateCurrentUserAccessToken()">
               <span>Generated access token</span>
             </button>
 
diff --git a/smp-angular/src/app/app.component.ts b/smp-angular/src/app/app.component.ts
index 3f9b04742..2355b7e99 100644
--- a/smp-angular/src/app/app.component.ts
+++ b/smp-angular/src/app/app.component.ts
@@ -1,4 +1,4 @@
-import {Component, ViewChild} from '@angular/core';
+import {Component} from '@angular/core';
 import {SecurityService} from './security/security.service';
 import {Router} from '@angular/router';
 import {Authority} from "./security/authority.model";
@@ -8,7 +8,6 @@ import {GlobalLookups} from "./common/global-lookups";
 import {UserController} from "./user/user-controller";
 import {HttpClient} from "@angular/common/http";
 import {SearchTableEntityStatus} from "./common/search-table/search-table-entity-status.model";
-import {SmpConstants} from "./smp.constants";
 import {UserService} from "./user/user.service";
 import {UserDetailsDialogMode} from "./user/user-details-dialog/user-details-dialog.component";
 
@@ -59,21 +58,25 @@ export class AppComponent {
     });
   }
 
+
   changeCurrentUserPassword() {
     const formRef: MatDialogRef<any> = this.userController.changePasswordDialog({
-      data: this.securityService.getCurrentUser()
+      data: {user: this.securityService.getCurrentUser(), adminUser:false}
     });
   }
 
-  regenerateAccesesToken() {
+  regenerateCurrentUserAccessToken() {
     const formRef: MatDialogRef<any> = this.userController.generateAccessTokenDialog({
-      data: this.securityService.getCurrentUser()
+      data: {user: this.securityService.getCurrentUser(), adminUser:false}
     });
     formRef.afterClosed().subscribe(result => {
-      /*if (result) {
-        const user = {...formRef.componentInstance.getCurrent(), status: SearchTableEntityStatus.UPDATED};
-        this.userService.updateUser(user);
-      }*/
+      if (result) {
+        let user = {...formRef.componentInstance.getCurrent()};
+        let currUser = this.securityService.getCurrentUser();
+        currUser.accessTokenId = user.accessTokenId;
+        currUser.accessTokenExpireOn = user.accessTokenExpireOn;
+        this.securityService.updateUserDetails(currUser);
+      }
     });
   }
 
diff --git a/smp-angular/src/app/app.module.ts b/smp-angular/src/app/app.module.ts
index df4c3b57a..79ebfde18 100644
--- a/smp-angular/src/app/app.module.ts
+++ b/smp-angular/src/app/app.module.ts
@@ -49,9 +49,9 @@ import {DatePipe} from './custom-date/date.pipe';
 import {CapitalizeFirstPipe} from './common/capitalize-first.pipe';
 import {DefaultPasswordDialogComponent} from './security/default-password-dialog/default-password-dialog.component';
 import {ServiceGroupDetailsDialogComponent} from './service-group-edit/service-group-details-dialog/service-group-details-dialog.component';
-import {CancelDialogComponent} from './common/cancel-dialog/cancel-dialog.component';
+import {CancelDialogComponent} from './common/dialogs/cancel-dialog/cancel-dialog.component';
 import {DirtyGuard} from './common/dirty.guard';
-import {SaveDialogComponent} from './common/save-dialog/save-dialog.component';
+import {SaveDialogComponent} from './common/dialogs/save-dialog/save-dialog.component';
 import {ColumnPickerComponent} from './common/column-picker/column-picker.component';
 import {PageHelperComponent} from './common/page-helper/page-helper.component';
 import {SharedModule} from './common/module/shared.module';
@@ -67,26 +67,27 @@ import {CertificateService} from './user/certificate.service';
 import {GlobalLookups} from './common/global-lookups';
 import {ServiceGroupExtensionWizardDialogComponent} from './service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component';
 import {ServiceMetadataWizardDialogComponent} from './service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component';
-import {ConfirmationDialogComponent} from './common/confirmation-dialog/confirmation-dialog.component';
+import {ConfirmationDialogComponent} from './common/dialogs/confirmation-dialog/confirmation-dialog.component';
 import {SpinnerComponent} from './common/spinner/spinner.component';
 import {UserService} from './user/user.service';
 import {UserDetailsService} from './user/user-details-dialog/user-details.service';
-import {ExpiredPasswordDialogComponent} from './common/expired-password-dialog/expired-password-dialog.component';
-import {DialogComponent} from './common/dialog/dialog.component';
+import {ExpiredPasswordDialogComponent} from './common/dialogs/expired-password-dialog/expired-password-dialog.component';
+import {DialogComponent} from './common/dialogs/dialog/dialog.component';
 import {KeystoreImportDialogComponent} from "./domain/keystore-import-dialog/keystore-import-dialog.component";
 import {KeystoreEditDialogComponent} from "./domain/keystore-edit-dialog/keystore-edit-dialog.component";
-import {CertificateDialogComponent} from "./common/certificate-dialog/certificate-dialog.component";
+import {CertificateDialogComponent} from "./common/dialogs/certificate-dialog/certificate-dialog.component";
 import {TruststoreEditDialogComponent} from "./user/truststore-edit-dialog/truststore-edit-dialog.component";
-import {InformationDialogComponent} from "./common/information-dialog/information-dialog.component";
+import {InformationDialogComponent} from "./common/dialogs/information-dialog/information-dialog.component";
 import {KeystoreService} from "./domain/keystore.service";
 import {TruststoreService} from "./user/truststore.service";
 import {SmlIntegrationService} from "./domain/sml-integration.service";
-import {PasswordChangeDialogComponent} from "./common/password-change-dialog/password-change-dialog.component";
-import {AccessTokenGenerationDialogComponent} from "./common/access-token-generation-dialog/access-token-generation-dialog.component";
+import {PasswordChangeDialogComponent} from "./common/dialogs/password-change-dialog/password-change-dialog.component";
+import {AccessTokenGenerationDialogComponent} from "./common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component";
 import {AlertComponent} from "./alert/alert.component";
 import {PropertyComponent} from "./property/property.component";
 import {PropertyDetailsDialogComponent} from "./property/property-details-dialog/property-details-dialog.component";
 import {MatCheckbox, MatCheckboxModule} from "@angular/material/checkbox";
+import {AutoFocusDirective} from "./common/directive/autofocus/auto-focus.directive";
 
 
 @NgModule({
@@ -133,6 +134,7 @@ import {MatCheckbox, MatCheckboxModule} from "@angular/material/checkbox";
     KeystoreEditDialogComponent,
     CertificateDialogComponent,
     TruststoreEditDialogComponent,
+    AutoFocusDirective,
   ],
   imports: [
     BrowserModule,
diff --git a/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.css b/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.css
deleted file mode 100644
index e3fad2cbf..000000000
--- a/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.css
+++ /dev/null
@@ -1,4 +0,0 @@
-.password-panel .mat-form-field {
-  margin-bottom: 1.5em;
-  padding: 2px;
-}
diff --git a/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.html b/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.html
deleted file mode 100644
index 3c48461f1..000000000
--- a/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<h2 mat-dialog-title>{{formTitle}}</h2>
-<mat-dialog-content style="width:700px">
-
-  <div *ngIf="message" [ngClass]="{ 'alert-message': message, 'alert-message-success': messageType === 'success', 'alert-message-error':messageType === 'error' }" id="alertmessage_id">
-    <span class="alert-message-close-button" (click)="clearAlert()">&times;</span>
-    {{message}}
-  </div>
-  <form [formGroup]="dialogForm">
-    <mat-card>
-      <mat-card-content fxLayout="column">
-        <mat-form-field style="width:100%">
-          <input matInput placeholder="User email" formControlName="email" id="em_id" readonly="true">
-        </mat-form-field>
-        <mat-form-field style="width:100%">
-          <input matInput placeholder="Username" formControlName="username" id="un_id" readonly="true">
-        </mat-form-field>
-      </mat-card-content>
-    </mat-card>
-    <mat-card>
-      <mat-card-content>
-        <mat-card-actions >
-          <button mat-raised-button color="primary" (click)="regenerateAccessToken()"
-                  [disabled]="!dialogForm.valid" >
-            <mat-icon>check_circle</mat-icon>
-            <span>Regenerate access token</span>
-          </button>
-        </mat-card-actions>
-        <mat-form-field style="width:100%">
-            <input matInput placeholder="Current Password" [type]="hideCurrPwdFiled ? 'password' : 'text'"
-                   formControlName="current-password" required id="cp_id">
-            <mat-icon matSuffix
-                      (click)="hideCurrPwdFiled = !hideCurrPwdFiled">{{hideCurrPwdFiled ? 'visibility_off' : 'visibility'}}</mat-icon>
-            <mat-error *ngIf="passwordError('current-password', 'required')">Password is required</mat-error>
-          </mat-form-field>
-
-          <mat-form-field style="width:100%">
-            <input matInput placeholder="Access token id" formControlName="accessTokenId" id="at_id" readonly="true">
-          </mat-form-field>
-
-          <mat-form-field style="width:100%">
-            <input matInput placeholder="Valid until" formControlName="accessTokenExpireOn" id="expireOn_id"
-                   readonly="true">
-          </mat-form-field>
-
-      </mat-card-content>
-    </mat-card>
-  </form>
-
-  <table class="buttonsRow">
-    <tr>
-      <td>
-        <button mat-raised-button color="primary" mat-dialog-close>
-          <mat-icon>cancel</mat-icon>
-          <span>Close</span>
-        </button>
-      </td>
-    </tr>
-  </table>
-  <div class="required-fields">* required fields</div>
-</mat-dialog-content>
diff --git a/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.ts b/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.ts
deleted file mode 100644
index e0dfb7e51..000000000
--- a/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-import {Component, Inject} from '@angular/core';
-import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
-import {
-  AbstractControl,
-  FormBuilder,
-  FormControl,
-  FormGroup,
-  FormGroupDirective, NgForm,
-  ValidatorFn,
-  Validators
-} from "@angular/forms";
-import {User} from "../../security/user.model";
-import {GlobalLookups} from "../global-lookups";
-import {UserDetailsService} from "../../user/user-details-dialog/user-details.service";
-import {AccessTokenRo} from "./access-token-ro.model";
-import {SearchTableEntityStatus} from "../search-table/search-table-entity-status.model";
-import {SecurityService} from "../../security/security.service";
-
-@Component({
-  selector: 'smp-access-token-generation-dialog',
-  templateUrl: './access-token-generation-dialog.component.html',
-  styleUrls: ['./access-token-generation-dialog.component.css']
-})
-export class AccessTokenGenerationDialogComponent {
-
-  formTitle = "Access token generation dialog!";
-  dialogForm: FormGroup;
-  hideCurrPwdFiled: boolean = true;
-  hideNewPwdFiled: boolean = true;
-  hideConfPwdFiled: boolean = true;
-  current: User;
-  message: string;
-  messageType: string = "alert-error";
-
-  constructor(
-    public dialogRef: MatDialogRef<AccessTokenGenerationDialogComponent>,
-    @Inject(MAT_DIALOG_DATA) public data: User,
-    private lookups: GlobalLookups,
-    private userDetailsService: UserDetailsService,
-    private securityService: SecurityService,
-    private fb: FormBuilder
-  ) {
-    this.current = {...data}
-
-
-    this.dialogForm = fb.group({
-      'email': new FormControl({value: null, readonly: true}, null),
-      'username': new FormControl({value: null, readonly: true}, null),
-      'accessTokenId': new FormControl({value: null, readonly: true}, null),
-      'accessTokenExpireOn': new FormControl({value: null, readonly: true}, null),
-      'current-password': new FormControl({value: null, readonly: false}, [Validators.required]),
-    });
-
-    this.dialogForm.controls['email'].setValue(this.current.emailAddress);
-    this.dialogForm.controls['username'].setValue(this.current.username);
-    this.dialogForm.controls['accessTokenId'].setValue(this.current.accessTokenId);
-    this.dialogForm.controls['accessTokenExpireOn'].setValue(this.current.accessTokenExpireOn);
-    this.dialogForm.controls['current-password'].setValue('');
-  }
-
-  public passwordError = (controlName: string, errorName: string) => {
-    return this.dialogForm.controls[controlName].hasError(errorName);
-  }
-
-  regenerateAccessToken() {
-    this.clearAlert();
-
-    // update password
-    this.userDetailsService.regenerateAccessToken(this.current.userId,
-      this.dialogForm.controls['current-password'].value).subscribe((response: AccessTokenRo) => {
-        this.showSuccessMessage("Token with id: " + response.identifier + " and value: " + response.value + " was generated!")
-        this.current.accessTokenId = response.identifier;
-        this.current.accessTokenExpireOn = response.expireOn;
-        // set to current form
-        this.dialogForm.controls['accessTokenId'].setValue(this.current.accessTokenId);
-        this.dialogForm.controls['accessTokenExpireOn'].setValue(this.current.accessTokenExpireOn);
-        // save new values
-        const user = {...this.current, status: SearchTableEntityStatus.UPDATED};
-        this.securityService.updateUserDetails(user);
-      },
-      (err) => {
-        this.showErrorMessage(err.error.errorDescription);
-      }
-    );
-  }
-
-  showSuccessMessage(value: string) {
-    this.message = value;
-    this.messageType = "success";
-  }
-
-  showErrorMessage(value: string) {
-    this.message = value;
-    this.messageType = "error";
-  }
-
-  clearAlert() {
-    this.message = null;
-    this.messageType = null;
-  }
-}
diff --git a/smp-angular/src/app/common/cancel-dialog/cancel-dialog.component.html b/smp-angular/src/app/common/cancel-dialog/cancel-dialog.component.html
deleted file mode 100644
index c01a602f0..000000000
--- a/smp-angular/src/app/common/cancel-dialog/cancel-dialog.component.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<smp-dialog [title]="'Do you want to cancel all unsaved operations?'"
-            [type]="'confirmation'"
-            [dialogRef]="dialogRef">
-</smp-dialog>
diff --git a/smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.html b/smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.html
deleted file mode 100644
index 0d0d6265b..000000000
--- a/smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<h2 mat-dialog-title>{{formTitle}}</h2>
-<mat-dialog-content style="height:450px;width:900px">
-  <form [formGroup]="certificateForm">
-    <mat-card>
-      <mat-card-content fxLayout="column">
-         <mat-form-field class="alias" style="width:100%">
-           <input matInput placeholder="Alias" [formControl]="certificateForm.controls['alias']" id="alias_id" readonly="true">
-         </mat-form-field>
-         <mat-form-field class="certificate-subject" style="width:100%">
-           <input matInput placeholder="Subject Name" [formControl]="certificateForm.controls['subject']" id="subject_id" readonly="true">
-         </mat-form-field>
-         <mat-form-field class="certificate-valid-from" style="width:100%">
-           <input matInput placeholder="Valid From" [formControl]="certificateForm.controls['validFrom']" id="validFrom_id" readonly="true">
-         </mat-form-field>
-         <mat-form-field class="certificate-valid-to" style="width:100%">
-           <input matInput placeholder="Valid To" [formControl]="certificateForm.controls['validTo']" id="validTo_id" readonly="true">
-         </mat-form-field>
-         <mat-form-field class="certificate-issuer" style="width:100%">
-           <input matInput placeholder="Issuer" [formControl]="certificateForm.controls['issuer']" id="issuer_id" readonly="true">
-         </mat-form-field>
-         <mat-form-field class="certificate-serial-number" style="width:100%">
-           <input matInput placeholder="Serial Number" [formControl]="certificateForm.controls['serialNumber']"
-                  id="servialNumber_id" readonly="true">
-         </mat-form-field>
-         <mat-form-field class="certificate-id" style="width:100%">
-           <input matInput placeholder="SMP certificate ID" [formControl]="certificateForm.controls['certificateId']"
-                  id="certificateId_id"
-                  resizeable="true" readonly="true">
-         </mat-form-field>
-      </mat-card-content>
-    </mat-card>
-
-  </form>
-</mat-dialog-content>
-
-<table class="buttonsRow">
-  <tr>
-    <td>
-      <button mat-raised-button color="primary" mat-dialog-close>
-        <mat-icon>close</mat-icon>
-        <span>Close</span>
-      </button>
-    </td>
-  </tr>
-</table>
-
-
diff --git a/smp-angular/src/app/common/dialog/dialog.component.html b/smp-angular/src/app/common/dialog/dialog.component.html
deleted file mode 100644
index 594a5fb0e..000000000
--- a/smp-angular/src/app/common/dialog/dialog.component.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<div class="dialog">
-  <h1 mat-dialog-title>{{title}}</h1>
-
-  <div class="divTable">
-    <div class="divTableBody">
-
-      <div class="divTableRow">
-
-        <div *ngIf="isConfirmationDialog()" class="divTableCell" >
-          <button mat-raised-button color="primary" (click)="dialogRef.close(true)" id="yesbuttondialog_id" tabindex="0">
-            <mat-icon>check_circle</mat-icon>
-            <span>Yes</span>
-          </button>
-        </div>
-
-        <div *ngIf="isConfirmationDialog()" class="divTableCell">
-          <button mat-raised-button color="primary" (click)="dialogRef.close(false)" id="nobuttondialog_id" tabindex="1">
-            <mat-icon>cancel</mat-icon>
-            <span>No</span>
-          </button>
-        </div>
-
-        <div *ngIf="isInformationDialog()" class="divTableCell">
-          <button mat-raised-button color="primary" (click)="dialogRef.close(true)" id="okbuttondialog_id" tabindex="3">
-            <mat-icon>warning</mat-icon>
-            <span>OK</span>
-          </button>
-        </div>
-      </div>
-    </div>
-  </div>
-</div>
diff --git a/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.css b/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.css
new file mode 100644
index 000000000..56d452bb7
--- /dev/null
+++ b/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.css
@@ -0,0 +1,3 @@
+.empty-field-label {
+  color: gray;
+}
diff --git a/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.html b/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.html
new file mode 100644
index 000000000..53b5fa91b
--- /dev/null
+++ b/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.html
@@ -0,0 +1,63 @@
+<h2 mat-dialog-title>{{formTitle}}</h2>
+<mat-dialog-content style="width:700px">
+  <div *ngIf="message"
+       [ngClass]="{ 'alert-message': message, 'alert-message-success': messageType === 'success', 'alert-message-error':messageType === 'error' }"
+       id="alertmessage_id">
+    <span class="alert-message-close-button" (click)="clearAlert()">&times;</span>
+    {{message}}
+  </div>
+  <form [formGroup]="dialogForm">
+    <mat-card>
+      <mat-card-content fxLayout="column">
+        <mat-form-field style="width:100%">
+          <input matInput placeholder="Generate access token for Username" formControlName="username" id="un_id" readonly="true">
+        </mat-form-field>
+        <mat-form-field style="width:100%">
+          <input matInput placeholder="Generate access token for User with email" formControlName="email" id="em_id"
+                 [ngClass]="{ 'empty-field-label': isEmptyEmailAddress }" readonly="true"  >
+        </mat-form-field>
+      </mat-card-content>
+    </mat-card>
+    <mat-card>
+      <mat-card-content>
+        <mat-card-actions>
+          <button mat-raised-button color="primary" (click)="regenerateAccessToken()"
+                  [disabled]="!dialogForm.valid">
+            <mat-icon>check_circle</mat-icon>
+            <span>Regenerate access token</span>
+          </button>
+          <mat-label *ngIf="adminUser" style="color: red;font-weight: bold">
+            Token will be generated immediately.
+          </mat-label>
+        </mat-card-actions>
+        <mat-form-field style="width:100%">
+          <input matInput [placeholder]="getPasswordTitle" [type]="hideCurrPwdFiled ? 'password' : 'text'"
+                 formControlName="current-password" required id="cp_id">
+          <mat-icon matSuffix
+                    (click)="hideCurrPwdFiled = !hideCurrPwdFiled">{{hideCurrPwdFiled ? 'visibility_off' : 'visibility'}}</mat-icon>
+          <mat-error *ngIf="passwordError('current-password', 'required')">Password is required</mat-error>
+        </mat-form-field>
+
+        <mat-form-field style="width:100%">
+          <input matInput placeholder="Access token id" formControlName="accessTokenId" id="at_id" readonly="true">
+        </mat-form-field>
+
+        <mat-form-field style="width:100%">
+          <input matInput placeholder="Valid until"
+                 value="{{dialogForm.get('accessTokenExpireOn').value | date:dateTimeFormat}}"
+                  id="expireOn_id"
+                 readonly="true">
+        </mat-form-field>
+      </mat-card-content>
+    </mat-card>
+  </form>
+</mat-dialog-content>
+<div class="required-fields">* required fields</div>
+
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" (click)="closeDialog()">
+    <mat-icon>cancel</mat-icon>
+    <span>Close</span>
+  </button>
+</mat-dialog-actions>
+
diff --git a/smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.spec.ts b/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.spec.ts
similarity index 100%
rename from smp-angular/src/app/common/access-token-generation-dialog/access-token-generation-dialog.component.spec.ts
rename to smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.spec.ts
diff --git a/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.ts b/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.ts
new file mode 100644
index 000000000..8ddc1334d
--- /dev/null
+++ b/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component.ts
@@ -0,0 +1,142 @@
+import {Component, Inject} from '@angular/core';
+import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
+import {FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";
+import {User} from "../../../security/user.model";
+import {GlobalLookups} from "../../global-lookups";
+import {UserDetailsService} from "../../../user/user-details-dialog/user-details.service";
+import {AccessTokenRo} from "./access-token-ro.model";
+import {SecurityService} from "../../../security/security.service";
+import {SmpConstants} from "../../../smp.constants";
+import {SearchTableEntityStatus} from "../../search-table/search-table-entity-status.model";
+
+@Component({
+  selector: 'smp-access-token-generation-dialog',
+  templateUrl: './access-token-generation-dialog.component.html',
+  styleUrls: ['./access-token-generation-dialog.component.css']
+})
+export class AccessTokenGenerationDialogComponent {
+
+  dateTimeFormat: string = SmpConstants.DATE_TIME_FORMAT;
+  formTitle = "Access token generation dialog!";
+  dialogForm: FormGroup;
+  hideCurrPwdFiled: boolean = true;
+  hideNewPwdFiled: boolean = true;
+  hideConfPwdFiled: boolean = true;
+  tokenChanged: boolean = false;
+  adminUser: boolean = false;
+  current: User;
+  message: string;
+  messageType: string = "alert-error";
+
+
+  constructor(
+    public dialogRef: MatDialogRef<AccessTokenGenerationDialogComponent>,
+    @Inject(MAT_DIALOG_DATA) public data: any,
+    private lookups: GlobalLookups,
+    private userDetailsService: UserDetailsService,
+    private securityService: SecurityService,
+    private fb: FormBuilder
+  ) {
+    dialogRef.disableClose = true;//disable default close operation
+
+    this.current = {...data.user}
+    this.adminUser = data.adminUser
+
+
+    this.dialogForm = fb.group({
+      'email': new FormControl({value: null, readonly: true}, null),
+      'username': new FormControl({value: null, readonly: true}, null),
+      'accessTokenId': new FormControl({value: null, readonly: true}, null),
+      'accessTokenExpireOn': new FormControl({value: null, readonly: true}, null),
+      'current-password': new FormControl({value: null, readonly: false}, [Validators.required]),
+    });
+
+    this.dialogForm.controls['email'].setValue(this.isEmptyEmailAddress ? "Empty email address!" : this.current.emailAddress);
+    this.dialogForm.controls['username'].setValue(this.current.username);
+    this.dialogForm.controls['accessTokenId'].setValue(this.current.accessTokenId);
+    this.dialogForm.controls['accessTokenExpireOn'].setValue(this.current.accessTokenExpireOn);
+    this.dialogForm.controls['current-password'].setValue('');
+    this.tokenChanged = false;
+  }
+
+  public passwordError = (controlName: string, errorName: string) => {
+    return this.dialogForm.controls[controlName].hasError(errorName);
+  }
+
+  get isEmptyEmailAddress() {
+    return !this.current.emailAddress;
+  }
+
+  get getPasswordTitle(): string{
+    return this.adminUser?"Admin password for user ["+this.securityService.getCurrentUser().username+"]":"Current password";
+  }
+
+  regenerateAccessToken() {
+    this.clearAlert();
+
+    if (this.adminUser) {
+// update password
+      this.userDetailsService.regenerateAccessTokenAdmin(this.securityService.getCurrentUser().userId,
+        this.dialogForm.controls['current-password'].value,
+      this.current.userId
+      ).subscribe((response: AccessTokenRo) => {
+          this.showSuccessMessage("Token with id: " + response.identifier + " and value: " + response.value + " was generated!")
+          this.current.accessTokenId = response.identifier;
+          this.current.accessTokenExpireOn = response.expireOn;
+          // set to current form
+          this.dialogForm.controls['accessTokenId'].setValue(this.current.accessTokenId);
+          this.dialogForm.controls['accessTokenExpireOn'].setValue(this.current.accessTokenExpireOn);
+          this.tokenChanged = true;
+        },
+        (err) => {
+          this.showErrorMessage(err.error.errorDescription);
+        }
+      );
+    } else {
+      // update access token for currently logged-in user
+      this.userDetailsService.regenerateAccessToken(this.current.userId,
+        this.dialogForm.controls['current-password'].value).subscribe((response: AccessTokenRo) => {
+          this.showSuccessMessage("Token with id: " + response.identifier + " and value: " + response.value + " was generated!")
+          this.current.accessTokenId = response.identifier;
+          this.current.accessTokenExpireOn = response.expireOn;
+          // set to current form
+          this.dialogForm.controls['accessTokenId'].setValue(this.current.accessTokenId);
+          this.dialogForm.controls['accessTokenExpireOn'].setValue(this.current.accessTokenExpireOn);
+          // save new values
+          const user = {...this.current, status: SearchTableEntityStatus.UPDATED};
+          this.securityService.updateUserDetails(user);
+          this.tokenChanged = true;
+        },
+        (err) => {
+          this.showErrorMessage(err.error.errorDescription);
+        }
+      );
+    }
+  }
+
+  showSuccessMessage(value: string) {
+    this.message = value;
+    this.messageType = "success";
+  }
+
+  showErrorMessage(value: string) {
+    this.message = value;
+    this.messageType = "error";
+  }
+
+  clearAlert() {
+    this.message = null;
+    this.messageType = null;
+  }
+
+  public getCurrent() {
+    if (this.tokenChanged) {
+      return this.current;
+    }
+    return null;
+  }
+
+  closeDialog() {
+    this.dialogRef.close(this.getCurrent())
+  }
+}
diff --git a/smp-angular/src/app/common/access-token-generation-dialog/access-token-ro.model.ts b/smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-ro.model.ts
similarity index 100%
rename from smp-angular/src/app/common/access-token-generation-dialog/access-token-ro.model.ts
rename to smp-angular/src/app/common/dialogs/access-token-generation-dialog/access-token-ro.model.ts
diff --git a/smp-angular/src/app/common/dialogs/cancel-dialog/cancel-dialog.component.html b/smp-angular/src/app/common/dialogs/cancel-dialog/cancel-dialog.component.html
new file mode 100644
index 000000000..e10a14faa
--- /dev/null
+++ b/smp-angular/src/app/common/dialogs/cancel-dialog/cancel-dialog.component.html
@@ -0,0 +1,5 @@
+<smp-dialog [title]="'Unsaved data'"
+            [text]="'Do you want to cancel all unsaved operations?'"
+            [type]="'confirmation'"
+            [dialogRef]="dialogRef">
+</smp-dialog>
diff --git a/smp-angular/src/app/common/cancel-dialog/cancel-dialog.component.spec.ts b/smp-angular/src/app/common/dialogs/cancel-dialog/cancel-dialog.component.spec.ts
similarity index 100%
rename from smp-angular/src/app/common/cancel-dialog/cancel-dialog.component.spec.ts
rename to smp-angular/src/app/common/dialogs/cancel-dialog/cancel-dialog.component.spec.ts
diff --git a/smp-angular/src/app/common/cancel-dialog/cancel-dialog.component.ts b/smp-angular/src/app/common/dialogs/cancel-dialog/cancel-dialog.component.ts
similarity index 100%
rename from smp-angular/src/app/common/cancel-dialog/cancel-dialog.component.ts
rename to smp-angular/src/app/common/dialogs/cancel-dialog/cancel-dialog.component.ts
diff --git a/smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.html b/smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.html
new file mode 100644
index 000000000..19a1e50d6
--- /dev/null
+++ b/smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.html
@@ -0,0 +1,54 @@
+<h2 mat-dialog-title>{{formTitle}}</h2>
+<mat-dialog-content style="height:450px;width:900px">
+  <form [formGroup]="certificateForm">
+    <mat-card>
+      <mat-card-content fxLayout="column">
+        <mat-form-field  *ngIf="!!this.current.alias" class="alias" style="width:100%">
+          <input matInput  placeholder="Alias" [formControl]="certificateForm.controls['alias']" id="alias_id"
+                 readonly="true">
+        </mat-form-field>
+        <mat-form-field class="certificate-subject" style="width:100%">
+          <input matInput placeholder="Subject Name" [formControl]="certificateForm.controls['subject']" id="subject_id"
+                 readonly="true">
+        </mat-form-field>
+        <mat-form-field class="certificate-valid-from" style="width:100%">
+          <input matInput placeholder="Valid To"
+                 value="{{certificateForm.get('validFrom').value | date:dateTimeFormat}}"
+                 id="validFrom_id"
+                 readonly="true">
+
+        </mat-form-field>
+        <mat-form-field class="certificate-valid-to" style="width:100%">
+          <input matInput placeholder="Valid To"
+                 value="{{certificateForm.get('validTo').value | date:dateTimeFormat}}"
+                 id="validTo_id"
+                 readonly="true">
+
+        </mat-form-field>
+        <mat-form-field class="certificate-issuer" style="width:100%">
+          <input matInput placeholder="Issuer" [formControl]="certificateForm.controls['issuer']" id="issuer_id"
+                 readonly="true">
+        </mat-form-field>
+        <mat-form-field class="certificate-serial-number" style="width:100%">
+          <input matInput placeholder="Serial Number" [formControl]="certificateForm.controls['serialNumber']"
+                 id="servialNumber_id" readonly="true">
+        </mat-form-field>
+        <mat-form-field class="certificate-id" style="width:100%">
+          <input matInput placeholder="SMP certificate ID" [formControl]="certificateForm.controls['certificateId']"
+                 id="certificateId_id"
+                 resizeable="true" readonly="true">
+        </mat-form-field>
+      </mat-card-content>
+    </mat-card>
+
+  </form>
+</mat-dialog-content>
+
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" mat-dialog-close>
+    <mat-icon>close</mat-icon>
+    <span>Close</span>
+  </button>
+</mat-dialog-actions>
+
+
diff --git a/smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.spec.ts b/smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.spec.ts
similarity index 100%
rename from smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.spec.ts
rename to smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.spec.ts
diff --git a/smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.ts b/smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.ts
similarity index 87%
rename from smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.ts
rename to smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.ts
index 567b826b5..385f21d2c 100644
--- a/smp-angular/src/app/common/certificate-dialog/certificate-dialog.component.ts
+++ b/smp-angular/src/app/common/dialogs/certificate-dialog/certificate-dialog.component.ts
@@ -1,17 +1,18 @@
 import {Component, Inject} from '@angular/core';
 import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
 import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
-import {CertificateRo} from "../../user/certificate-ro.model";
-import {SecurityService} from "../../security/security.service";
+import {CertificateRo} from "../../../user/certificate-ro.model";
+import {SecurityService} from "../../../security/security.service";
+import {SmpConstants} from "../../../smp.constants";
 
 @Component({
   selector: 'keystore-certificate-dialog',
   templateUrl: './certificate-dialog.component.html'
 })
 export class CertificateDialogComponent {
+  readonly dateTimeFormat: string = SmpConstants.DATE_TIME_FORMAT;
   formTitle: string;
   certificateForm: FormGroup;
-
   current: CertificateRo;
 
   constructor(
@@ -21,7 +22,7 @@ export class CertificateDialogComponent {
     private fb: FormBuilder) {
 
     this.formTitle = "Certificate details";
-    this.current = {...data.row}
+    this.current = { ...data.row}
 
 // set empty form ! do not bind it to current object !
     this.certificateForm = fb.group({
diff --git a/smp-angular/src/app/common/confirmation-dialog/confirmation-dialog.component.css b/smp-angular/src/app/common/dialogs/confirmation-dialog/confirmation-dialog.component.css
similarity index 100%
rename from smp-angular/src/app/common/confirmation-dialog/confirmation-dialog.component.css
rename to smp-angular/src/app/common/dialogs/confirmation-dialog/confirmation-dialog.component.css
diff --git a/smp-angular/src/app/common/confirmation-dialog/confirmation-dialog.component.html b/smp-angular/src/app/common/dialogs/confirmation-dialog/confirmation-dialog.component.html
similarity index 100%
rename from smp-angular/src/app/common/confirmation-dialog/confirmation-dialog.component.html
rename to smp-angular/src/app/common/dialogs/confirmation-dialog/confirmation-dialog.component.html
diff --git a/smp-angular/src/app/common/confirmation-dialog/confirmation-dialog.component.ts b/smp-angular/src/app/common/dialogs/confirmation-dialog/confirmation-dialog.component.ts
similarity index 100%
rename from smp-angular/src/app/common/confirmation-dialog/confirmation-dialog.component.ts
rename to smp-angular/src/app/common/dialogs/confirmation-dialog/confirmation-dialog.component.ts
diff --git a/smp-angular/src/app/common/dialog/dialog.component.css b/smp-angular/src/app/common/dialogs/dialog/dialog.component.css
similarity index 94%
rename from smp-angular/src/app/common/dialog/dialog.component.css
rename to smp-angular/src/app/common/dialogs/dialog/dialog.component.css
index 6286aff86..bd42de012 100644
--- a/smp-angular/src/app/common/dialog/dialog.component.css
+++ b/smp-angular/src/app/common/dialogs/dialog/dialog.component.css
@@ -43,3 +43,7 @@ label:hover, label:active, input:hover + label, input:active + label {
 .divTableBody {
   display: table-row-group;
 }
+
+.empty-field-label {
+  color: gray;
+}
diff --git a/smp-angular/src/app/common/dialogs/dialog/dialog.component.html b/smp-angular/src/app/common/dialogs/dialog/dialog.component.html
new file mode 100644
index 000000000..078918ccf
--- /dev/null
+++ b/smp-angular/src/app/common/dialogs/dialog/dialog.component.html
@@ -0,0 +1,25 @@
+<h1 mat-dialog-title>{{title}}</h1>
+<mat-dialog-content>{{text}}</mat-dialog-content>
+
+<mat-dialog-actions>
+  <div *ngIf="isConfirmationDialog()" class="divTableCell">
+    <button mat-raised-button color="primary" (click)="dialogRef.close(true)" id="yesbuttondialog_id" tabindex="0">
+      <mat-icon>check_circle</mat-icon>
+      <span>Yes</span>
+    </button>
+  </div>
+
+  <div *ngIf="isConfirmationDialog()" class="divTableCell">
+    <button mat-raised-button color="primary" (click)="dialogRef.close(false)" id="nobuttondialog_id" tabindex="1">
+      <mat-icon>cancel</mat-icon>
+      <span>No</span>
+    </button>
+  </div>
+
+  <div *ngIf="isInformationDialog()" class="divTableCell">
+    <button mat-raised-button color="primary" (click)="dialogRef.close(true)" id="okbuttondialog_id" tabindex="3">
+      <mat-icon>warning</mat-icon>
+      <span>OK</span>
+    </button>
+  </div>
+</mat-dialog-actions>
diff --git a/smp-angular/src/app/common/dialog/dialog.component.spec.ts b/smp-angular/src/app/common/dialogs/dialog/dialog.component.spec.ts
similarity index 100%
rename from smp-angular/src/app/common/dialog/dialog.component.spec.ts
rename to smp-angular/src/app/common/dialogs/dialog/dialog.component.spec.ts
diff --git a/smp-angular/src/app/common/dialog/dialog.component.ts b/smp-angular/src/app/common/dialogs/dialog/dialog.component.ts
similarity index 95%
rename from smp-angular/src/app/common/dialog/dialog.component.ts
rename to smp-angular/src/app/common/dialogs/dialog/dialog.component.ts
index 96a9dede6..0745fa125 100644
--- a/smp-angular/src/app/common/dialog/dialog.component.ts
+++ b/smp-angular/src/app/common/dialogs/dialog/dialog.component.ts
@@ -9,6 +9,7 @@ import { MatDialogRef } from '@angular/material/dialog';
 export class DialogComponent {
 
   @Input() title: String;
+  @Input() text: String;
 
   @Input() type: string;
 
diff --git a/smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.html b/smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.html
new file mode 100644
index 000000000..1aeead3a4
--- /dev/null
+++ b/smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.html
@@ -0,0 +1,6 @@
+<smp-dialog style="width: 400px"
+            [title]="'Password about to expire!'"
+            [text]="'Your password is more than three months old. Please change it as soon as possible!'"
+            [type]="'information'"
+            [dialogRef]="dialogRef">
+</smp-dialog>
diff --git a/smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.spec.ts b/smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.spec.ts
similarity index 100%
rename from smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.spec.ts
rename to smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.spec.ts
diff --git a/smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.ts b/smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.ts
similarity index 86%
rename from smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.ts
rename to smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.ts
index 076e466bc..49e189660 100644
--- a/smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.ts
+++ b/smp-angular/src/app/common/dialogs/expired-password-dialog/expired-password-dialog.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit } from '@angular/core';
+import { Component} from '@angular/core';
 import { MatDialogRef } from '@angular/material/dialog';
 
 @Component({
diff --git a/smp-angular/src/app/common/information-dialog/information-dialog.component.css b/smp-angular/src/app/common/dialogs/information-dialog/information-dialog.component.css
similarity index 100%
rename from smp-angular/src/app/common/information-dialog/information-dialog.component.css
rename to smp-angular/src/app/common/dialogs/information-dialog/information-dialog.component.css
diff --git a/smp-angular/src/app/common/information-dialog/information-dialog.component.html b/smp-angular/src/app/common/dialogs/information-dialog/information-dialog.component.html
similarity index 100%
rename from smp-angular/src/app/common/information-dialog/information-dialog.component.html
rename to smp-angular/src/app/common/dialogs/information-dialog/information-dialog.component.html
diff --git a/smp-angular/src/app/common/information-dialog/information-dialog.component.ts b/smp-angular/src/app/common/dialogs/information-dialog/information-dialog.component.ts
similarity index 100%
rename from smp-angular/src/app/common/information-dialog/information-dialog.component.ts
rename to smp-angular/src/app/common/dialogs/information-dialog/information-dialog.component.ts
diff --git a/smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.css b/smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.css
similarity index 85%
rename from smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.css
rename to smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.css
index 6336193ff..dde2f2400 100644
--- a/smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.css
+++ b/smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.css
@@ -13,4 +13,6 @@
   z-index: 1000;
   background-color: #f44336;
 }
-
+.empty-field-label {
+  color: gray;
+}
diff --git a/smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.html b/smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.html
similarity index 72%
rename from smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.html
rename to smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.html
index b9d22ede2..a238df605 100644
--- a/smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.html
+++ b/smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.html
@@ -1,7 +1,9 @@
 <h2 mat-dialog-title>{{formTitle}}</h2>
 <mat-dialog-content style="width:500px">
 
-  <div *ngIf="message" [ngClass]="{ 'alert-message': message, 'alert-message-success': messageType === 'success', 'alert-message-error':messageType === 'error' }" id="alertmessage_id">
+  <div *ngIf="message"
+       [ngClass]="{ 'alert-message': message, 'alert-message-success': messageType === 'success', 'alert-message-error':messageType === 'error' }"
+       id="alertmessage_id">
     <span class="alert-message-close-button" (click)="clearAlert()">&times;</span>
     {{message}}
   </div>
@@ -9,24 +11,19 @@
     <mat-card>
       <mat-card-content fxLayout="column">
         <mat-form-field style="width:100%">
-          <input matInput placeholder="User email" formControlName="email" id="em_id" readonly="true">
+          <input matInput placeholder="Username" formControlName="username" id="un_id" readonly="true">
         </mat-form-field>
         <mat-form-field style="width:100%">
-          <input matInput placeholder="Username" formControlName="username" id="un_id" readonly="true">
+          <input matInput placeholder="User email" formControlName="email" id="em_id"
+                 [ngClass]="{ 'empty-field-label': isEmptyEmailAddress }" readonly="true">
         </mat-form-field>
+
       </mat-card-content>
     </mat-card>
     <mat-card class="password-panel">
       <mat-card-content>
-        <mat-card-actions >
-          <button mat-raised-button color="primary" (click)="changeCurrentUserPassword()"
-                  [disabled]="!dialogForm.valid ">
-            <mat-icon>check_circle</mat-icon>
-            <span>Change password</span>
-          </button>
-        </mat-card-actions>
         <mat-form-field style="width:100%">
-          <input matInput placeholder="Current Password" [type]="hideCurrPwdFiled ? 'password' : 'text'"
+          <input matInput [placeholder]="getPasswordTitle" [type]="hideCurrPwdFiled ? 'password' : 'text'"
                  formControlName="current-password" required id="cp_id">
           <mat-icon matSuffix
                     (click)="hideCurrPwdFiled = !hideCurrPwdFiled">{{hideCurrPwdFiled ? 'visibility_off' : 'visibility'}}</mat-icon>
@@ -34,7 +31,7 @@
 
         <mat-form-field style="width:100%">
           <input matInput placeholder="New Password" [type]="hideNewPwdFiled ? 'password' : 'text'"
-                 formControlName="new-password" required id="np_id">
+                 formControlName="new-password" required id="np_id" auto-focus-directive>
           <mat-icon matSuffix
                     (click)="hideNewPwdFiled = !hideNewPwdFiled">{{hideNewPwdFiled ? 'visibility_off' : 'visibility'}}</mat-icon>
           <mat-error *ngIf="passwordError('new-password', 'required')">New password is required</mat-error>
@@ -57,16 +54,19 @@
       </mat-card-content>
     </mat-card>
   </form>
-
-  <table class="buttonsRow" *ngIf="!this.forceChange">
-    <tr>
-      <td>
-        <button mat-raised-button color="primary" mat-dialog-close>
-          <mat-icon>cancel</mat-icon>
-          <span>Close</span>
-        </button>
-      </td>
-    </tr>
-  </table>
-  <div class="required-fields">* required fields</div>
 </mat-dialog-content>
+
+<div class="required-fields">* required fields</div>
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" (click)="changeCurrentUserPassword()"
+          [disabled]="!dialogForm.valid ">
+    <mat-icon>check_circle</mat-icon>
+    <span>Change password</span>
+  </button>
+  <button *ngIf="!this.forceChange" mat-raised-button color="primary" mat-dialog-close>
+    <mat-icon>cancel</mat-icon>
+    <span>Close</span>
+  </button>
+</mat-dialog-actions>
+
+
diff --git a/smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.spec.ts b/smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.spec.ts
similarity index 100%
rename from smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.spec.ts
rename to smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.spec.ts
diff --git a/smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.ts b/smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.ts
similarity index 58%
rename from smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.ts
rename to smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.ts
index 00251ef68..0098e1cef 100644
--- a/smp-angular/src/app/common/password-change-dialog/password-change-dialog.component.ts
+++ b/smp-angular/src/app/common/dialogs/password-change-dialog/password-change-dialog.component.ts
@@ -1,23 +1,14 @@
 import {Component, Inject} from '@angular/core';
 import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog';
-import {
-  AbstractControl,
-  FormBuilder,
-  FormControl,
-  FormGroup,
-  FormGroupDirective, NgForm,
-  ValidatorFn,
-  Validators
-} from "@angular/forms";
-import {User} from "../../security/user.model";
-import {GlobalLookups} from "../global-lookups";
-import {ErrorStateMatcher} from "@angular/material/core";
-import {UserDetailsService} from "../../user/user-details-dialog/user-details.service";
-import {CertificateRo} from "../../user/certificate-ro.model";
-import {AlertMessageService} from "../alert-message/alert-message.service";
-import {ErrorResponseRO} from "../error/error-model";
-import {SecurityService} from "../../security/security.service";
+import {AbstractControl, FormBuilder, FormControl, FormGroup, ValidatorFn, Validators} from "@angular/forms";
+import {User} from "../../../security/user.model";
+import {GlobalLookups} from "../../global-lookups";
+import {UserDetailsService} from "../../../user/user-details-dialog/user-details.service";
+import {AlertMessageService} from "../../alert-message/alert-message.service";
+import {SecurityService} from "../../../security/security.service";
 import {InformationDialogComponent} from "../information-dialog/information-dialog.component";
+import {UserRo} from "../../../user/user-ro.model";
+import {SmpConstants} from "../../../smp.constants";
 
 @Component({
   selector: 'smp-password-change-dialog',
@@ -26,19 +17,20 @@ import {InformationDialogComponent} from "../information-dialog/information-dial
 })
 export class PasswordChangeDialogComponent {
 
-  formTitle = "Change password dialog!";
+  formTitle = "Change password dialog";
   dialogForm: FormGroup;
   hideCurrPwdFiled: boolean = true;
   hideNewPwdFiled: boolean = true;
   hideConfPwdFiled: boolean = true;
   current: User;
+  adminUser: boolean = false;
   message: string;
   messageType: string = "alert-error";
-  forceChange:boolean=false;
+  forceChange: boolean = false;
 
   constructor(
     public dialogRef: MatDialogRef<PasswordChangeDialogComponent>,
-    @Inject(MAT_DIALOG_DATA) public data: User,
+    @Inject(MAT_DIALOG_DATA) public data: any,
     private lookups: GlobalLookups,
     private userDetailsService: UserDetailsService,
     private alertService: AlertMessageService,
@@ -49,7 +41,8 @@ export class PasswordChangeDialogComponent {
     // disable close of focus lost
     dialogRef.disableClose = true;
 
-    this.current = {...data}
+    this.current = {...data.user}
+    this.adminUser = data.adminUser
 
     this.forceChange = this.current.forceChangeExpiredPassword;
 
@@ -67,7 +60,7 @@ export class PasswordChangeDialogComponent {
       'confirm-new-password': confirmNewPasswdFormControl
     });
 
-    this.dialogForm.controls['email'].setValue(this.current.emailAddress);
+    this.dialogForm.controls['email'].setValue(this.isEmptyEmailAddress ? "Empty email address!" : this.current.emailAddress);
     this.dialogForm.controls['username'].setValue(this.current.username);
     this.dialogForm.controls['current-password'].setValue('');
     this.dialogForm.controls['new-password'].setValue('');
@@ -78,6 +71,10 @@ export class PasswordChangeDialogComponent {
     return this.dialogForm.controls[controlName].hasError(errorName);
   }
 
+  get isEmptyEmailAddress() {
+    return !this.current.emailAddress;
+  }
+
   get passwordValidationMessage() {
     return this.lookups.cachedApplicationConfig?.passwordValidationRegExpMessage;
   }
@@ -86,30 +83,54 @@ export class PasswordChangeDialogComponent {
     return this.lookups.cachedApplicationConfig?.passwordValidationRegExp;
   }
 
+  get getPasswordTitle(): string {
+    return this.adminUser ? "Admin password for user [" + this.securityService.getCurrentUser().username + "]" : "Current password";
+  }
+
   changeCurrentUserPassword() {
     this.clearAlert();
-
-    // update password
-    this.userDetailsService.changePassword(this.current.userId,
-      this.dialogForm.controls['new-password'].value,
-      this.dialogForm.controls['current-password'].value).subscribe((res: boolean) => {
-        this.showPassChangeDialog();
-        close()
-      },
-      (err) => {
-        this.showErrorMessage(err.error.errorDescription);
-      }
-    );
+    if (this.adminUser) {
+      // update password
+      this.userDetailsService.changePasswordAdmin(
+        this.securityService.getCurrentUser().userId,
+        this.current.userId,
+        this.dialogForm.controls['new-password'].value,
+        this.dialogForm.controls['current-password'].value).subscribe((result: UserRo) => {
+          this.showPassChangeDialog();
+          this.current.passwordExpireOn = result.passwordExpireOn;
+          this.dialogRef.close(result)
+        },
+        (err) => {
+          this.showErrorMessage(err.error.errorDescription);
+        }
+      );
+    } else {
+      // update password
+      this.userDetailsService.changePassword(this.current.userId,
+        this.dialogForm.controls['new-password'].value,
+        this.dialogForm.controls['current-password'].value).subscribe((res: boolean) => {
+          this.showPassChangeDialog();
+          close()
+        },
+        (err) => {
+          this.showErrorMessage(err.error.errorDescription);
+        }
+      );
+    }
   }
-  showPassChangeDialog(){
+
+  showPassChangeDialog() {
     this.dialog.open(InformationDialogComponent, {
       data: {
         title: "Password changed!",
-        description: "Password has been successfully changed. Login again to the application with the new password!"
+        description: "Password has been successfully changed. " +
+          (!this.adminUser ? "Login again to the application with the new password!" : "")
       }
     }).afterClosed().subscribe(result => {
-      // no need to logout because service itself logouts
-      this.securityService.finalizeLogout(result);
+      if (!this.adminUser) {
+        // logout if changed for itself
+        this.securityService.finalizeLogout(result);
+      }
       close();
     })
   }
diff --git a/smp-angular/src/app/common/dialogs/save-dialog/save-dialog.component.html b/smp-angular/src/app/common/dialogs/save-dialog/save-dialog.component.html
new file mode 100644
index 000000000..36b2013f9
--- /dev/null
+++ b/smp-angular/src/app/common/dialogs/save-dialog/save-dialog.component.html
@@ -0,0 +1,5 @@
+<smp-dialog [title]="'Save changes'"
+            [text]="'Do you want to save your changes?'"
+            [type]="'confirmation'"
+            [dialogRef]="dialogRef">
+</smp-dialog>
diff --git a/smp-angular/src/app/common/save-dialog/save-dialog.component.spec.ts b/smp-angular/src/app/common/dialogs/save-dialog/save-dialog.component.spec.ts
similarity index 100%
rename from smp-angular/src/app/common/save-dialog/save-dialog.component.spec.ts
rename to smp-angular/src/app/common/dialogs/save-dialog/save-dialog.component.spec.ts
diff --git a/smp-angular/src/app/common/save-dialog/save-dialog.component.ts b/smp-angular/src/app/common/dialogs/save-dialog/save-dialog.component.ts
similarity index 100%
rename from smp-angular/src/app/common/save-dialog/save-dialog.component.ts
rename to smp-angular/src/app/common/dialogs/save-dialog/save-dialog.component.ts
diff --git a/smp-angular/src/app/common/directive/autofocus/auto-focus.directive.ts b/smp-angular/src/app/common/directive/autofocus/auto-focus.directive.ts
new file mode 100644
index 000000000..27eb92d39
--- /dev/null
+++ b/smp-angular/src/app/common/directive/autofocus/auto-focus.directive.ts
@@ -0,0 +1,11 @@
+import { Directive, ElementRef, OnInit } from '@angular/core';
+
+@Directive({
+  selector: '[auto-focus-directive]'
+})
+export class AutoFocusDirective implements OnInit {
+  constructor(private elRef: ElementRef) { }
+  ngOnInit(): void {
+    this.elRef.nativeElement.focus();
+  }
+}
diff --git a/smp-angular/src/app/common/dirty.guard.ts b/smp-angular/src/app/common/dirty.guard.ts
index 05aba0f2b..7b9d354c6 100644
--- a/smp-angular/src/app/common/dirty.guard.ts
+++ b/smp-angular/src/app/common/dirty.guard.ts
@@ -2,7 +2,7 @@ import {Injectable} from '@angular/core';
 import {ActivatedRouteSnapshot, CanActivate, CanDeactivate, RouterStateSnapshot} from '@angular/router';
 import {Observable} from 'rxjs';
 import {MatDialog} from '@angular/material/dialog';
-import {CancelDialogComponent} from './cancel-dialog/cancel-dialog.component';
+import {CancelDialogComponent} from './dialogs/cancel-dialog/cancel-dialog.component';
 
 @Injectable()
 export class DirtyGuard implements CanActivate, CanDeactivate<any> {
diff --git a/smp-angular/src/app/common/domain-selector/domain-selector.component.ts b/smp-angular/src/app/common/domain-selector/domain-selector.component.ts
index 8c9cad664..f7ae848b8 100644
--- a/smp-angular/src/app/common/domain-selector/domain-selector.component.ts
+++ b/smp-angular/src/app/common/domain-selector/domain-selector.component.ts
@@ -3,7 +3,7 @@ import {SecurityService} from '../../security/security.service';
 import {DomainService} from '../../security/domain.service';
 import {Domain} from '../../security/domain.model';
 import {MatDialog} from '@angular/material/dialog';
-import {CancelDialogComponent} from '../cancel-dialog/cancel-dialog.component';
+import {CancelDialogComponent} from '../dialogs/cancel-dialog/cancel-dialog.component';
 
 @Component({
   selector: 'domain-selector',
diff --git a/smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.html b/smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.html
deleted file mode 100644
index cd140de69..000000000
--- a/smp-angular/src/app/common/expired-password-dialog/expired-password-dialog.component.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<smp-dialog [title]="'Your password is more than three months old. Please change it as soon as possible!'"
-            [type]="'information'"
-            [dialogRef]="dialogRef">
-</smp-dialog>
diff --git a/smp-angular/src/app/common/global-lookups.ts b/smp-angular/src/app/common/global-lookups.ts
index f76bd2865..af21c9edd 100644
--- a/smp-angular/src/app/common/global-lookups.ts
+++ b/smp-angular/src/app/common/global-lookups.ts
@@ -10,6 +10,7 @@ import {Subscription} from "rxjs/internal/Subscription";
 import {SmpInfo} from "../app-info/smp-info.model";
 import {SmpConfig} from "../app-config/smp-config.model";
 import {SecurityEventService} from "../security/security-event.service";
+import {Subject} from "rxjs";
 
 /**
  * Purpose of object is to fetch lookups as domains and users
@@ -31,8 +32,8 @@ export class GlobalLookups implements OnInit {
   cachedApplicationConfig?: SmpConfig;
   cachedTrustedCertificateList: Array<any> = [];
 
-  loginSubscription: Subscription;
-  logoutSubscription: Subscription;
+  // lookup refresh subscriptions.
+  private trustedCertificateListRefreshEventEmitter = new Subject<any>();
 
 
   constructor(protected alertService: AlertMessageService,
@@ -74,7 +75,7 @@ export class GlobalLookups implements OnInit {
   public refreshDomainLookupForLoggedUser() {
     let domainUrl = SmpConstants.REST_PUBLIC_DOMAIN_SEARCH;
     // for authenticated admin use internal url which returns more data!
-    if (this.securityService.isCurrentUserSMPAdmin() || this.securityService.isCurrentUserSystemAdmin()) {
+    if (this.securityService.isCurrentUserSystemAdmin()) {
       domainUrl = SmpConstants.REST_INTERNAL_DOMAIN_MANAGE;
     }
     this.refreshDomainLookup(domainUrl);
@@ -192,15 +193,21 @@ export class GlobalLookups implements OnInit {
       // init users
       this.trustedCertificateObserver = this.http.get<SearchTableResult>(SmpConstants.REST_INTERNAL_TRUSTSTORE);
       this.trustedCertificateObserver.subscribe((certs: SearchTableResult) => {
-        this.cachedTrustedCertificateList = certs.serviceEntities.map(serviceEntity => {
-          return {...serviceEntity}
-
-        });
-      }, (error: any) => {
+        this.cachedTrustedCertificateList = [...certs.serviceEntities];
+          this.notifyTrustedCertificateListRefreshEvent(this.cachedTrustedCertificateList );
+        }, (error: any) => {
         // check if unauthorized
         // just console try latter
-        console.log("Error occurred while loading trusted certifcates lookup [" + error + "]");
+        console.log("Error occurred while loading trusted certificates lookup [" + error + "]");
       });
     }
   }
+
+  onTrustedCertificateListRefreshEvent(): Observable<any> {
+    return this.trustedCertificateListRefreshEventEmitter.asObservable();
+  }
+
+  notifyTrustedCertificateListRefreshEvent(newList) {
+    this.trustedCertificateListRefreshEventEmitter.next(newList);
+  }
 }
diff --git a/smp-angular/src/app/common/save-dialog/save-dialog.component.html b/smp-angular/src/app/common/save-dialog/save-dialog.component.html
deleted file mode 100644
index c7ff33a66..000000000
--- a/smp-angular/src/app/common/save-dialog/save-dialog.component.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<smp-dialog [title]="'Do you want to save your changes?'"
-            [type]="'confirmation'"
-            [dialogRef]="dialogRef">
-</smp-dialog>
diff --git a/smp-angular/src/app/common/search-table/search-table.component.ts b/smp-angular/src/app/common/search-table/search-table.component.ts
index b444941cf..b9737821e 100644
--- a/smp-angular/src/app/common/search-table/search-table.component.ts
+++ b/smp-angular/src/app/common/search-table/search-table.component.ts
@@ -9,11 +9,11 @@ import {SearchTableController} from './search-table-controller';
 import {finalize} from 'rxjs/operators';
 import {SearchTableEntity} from './search-table-entity.model';
 import {SearchTableEntityStatus} from './search-table-entity-status.model';
-import {CancelDialogComponent} from '../cancel-dialog/cancel-dialog.component';
-import {SaveDialogComponent} from '../save-dialog/save-dialog.component';
+import {CancelDialogComponent} from '../dialogs/cancel-dialog/cancel-dialog.component';
+import {SaveDialogComponent} from '../dialogs/save-dialog/save-dialog.component';
 import {DownloadService} from '../../download/download.service';
 import {HttpParams} from '@angular/common/http';
-import {ConfirmationDialogComponent} from "../confirmation-dialog/confirmation-dialog.component";
+import {ConfirmationDialogComponent} from "../dialogs/confirmation-dialog/confirmation-dialog.component";
 import {SearchTableValidationResult} from "./search-table-validation-result.model";
 import {ExtendedHttpClient} from "../../http/extended-http-client";
 import {Router} from "@angular/router";
@@ -84,7 +84,7 @@ export class SearchTableComponent implements OnInit {
     this.columnIndex = {
       cellTemplate: this.rowIndex,
       name: 'Index',
-      width: 50,
+      width: 30,
       maxWidth: 80,
       sortable: false
     };
@@ -92,7 +92,7 @@ export class SearchTableComponent implements OnInit {
     this.columnActions = {
       cellTemplate: this.rowActions,
       name: 'Actions',
-      width: 80,
+      width: 100,
       maxWidth: 150,
       sortable: false,
       showInitially: false
diff --git a/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.html b/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.html
index 1f30f9c83..1b0b30923 100644
--- a/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.html
+++ b/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.html
@@ -1,5 +1,5 @@
 <h2 mat-dialog-title>{{formTitle}}</h2>
-<mat-dialog-content style="height:600px;width:1000px">
+<mat-dialog-content >
   <form [formGroup]="domainForm">
     <mat-card>
       <mat-card-title>Domain properties</mat-card-title>
@@ -27,7 +27,9 @@
                    matTooltip="The domain-specific part of the SML DNS zone (e.g., ‘mydomain’ for mydomain.sml.dns.zone or leave empty for sml.dns.zone). Note: has informative value only, SML DNS zone used for publishing is based on SML configuration."
                    name="smlSubdomain" id="smldomain_id"
                    [formControl]="domainForm.controls['smlSubdomain']" maxlength="63">
-            <mat-hint align="end">The domain-specific part of the SML DNS zone (e.g., ‘mydomain’ for mydomain.sml.dns.zone).</mat-hint>
+            <mat-hint align="end">The domain-specific part of the SML DNS zone (e.g., ‘mydomain’ for
+              mydomain.sml.dns.zone).
+            </mat-hint>
             <div
               *ngIf="(!editMode && domainForm.controls['smlSubdomain'].touched || editMode)
               &&  domainForm.controls['smlSubdomain'].hasError('pattern')"
@@ -119,19 +121,15 @@
 
 </mat-dialog-content>
 
-<table class="buttonsRow">
-  <tr>
-    <td>
-      <button mat-raised-button color="primary" (click)="submitForm()" [disabled]="!domainForm.valid">
-        <mat-icon>check_circle</mat-icon>
-        <span>OK</span>
-      </button>
-      <button mat-raised-button color="primary" mat-dialog-close>
-        <mat-icon>cancel</mat-icon>
-        <span>Cancel</span>
-      </button>
-    </td>
-  </tr>
-</table>
-<div style="text-align: right; font-size: 70%">* required fields</div>
+<div class="required-fields">* required fields</div>
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" (click)="submitForm()" [disabled]="!domainForm.valid">
+    <mat-icon>check_circle</mat-icon>
+    <span>OK</span>
+  </button>
+  <button mat-raised-button color="primary" mat-dialog-close>
+    <mat-icon>cancel</mat-icon>
+    <span>Cancel</span>
+  </button>
+</mat-dialog-actions>
 
diff --git a/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.ts b/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.ts
index 65bddca78..5db36fe23 100644
--- a/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.ts
+++ b/smp-angular/src/app/domain/domain-details-dialog/domain-details-dialog.component.ts
@@ -8,6 +8,7 @@ import {GlobalLookups} from "../../common/global-lookups";
 import {CertificateRo} from "../../user/certificate-ro.model";
 import {KeystoreEditDialogComponent} from "../keystore-edit-dialog/keystore-edit-dialog.component";
 import {ServiceGroupDomainEditRo} from "../../service-group-edit/service-group-domain-edit-ro.model";
+import {BreakpointObserver, Breakpoints} from "@angular/cdk/layout";
 
 @Component({
   selector: 'domain-details-dialog',
@@ -41,6 +42,7 @@ export class DomainDetailsDialogComponent {
   constructor(
     public dialog: MatDialog,
     public lookups: GlobalLookups,
+    private responsive: BreakpointObserver,
     private dialogRef: MatDialogRef<DomainDetailsDialogComponent>,
     private alertService: AlertMessageService,
     @Inject(MAT_DIALOG_DATA) public data: any,
@@ -96,6 +98,15 @@ export class DomainDetailsDialogComponent {
       this.selectedSMLCert = this.lookups.cachedCertificateList.find(crt => crt.alias === this.current.smlClientKeyAlias);
       this.domainForm.controls['smlClientKeyCertificate'].setValue(this.selectedSMLCert );
     }
+
+    this.responsive.observe(Breakpoints.Small)
+      .subscribe(result => {
+
+        if (result.matches) {
+          console.log("screens matches HandsetLandscape");
+        }
+
+      });
   }
 
   submitForm() {
diff --git a/smp-angular/src/app/domain/domain.component.ts b/smp-angular/src/app/domain/domain.component.ts
index 6f57cccb9..909990944 100644
--- a/smp-angular/src/app/domain/domain.component.ts
+++ b/smp-angular/src/app/domain/domain.component.ts
@@ -10,7 +10,7 @@ import {GlobalLookups} from "../common/global-lookups";
 import {SearchTableComponent} from "../common/search-table/search-table.component";
 import {SecurityService} from "../security/security.service";
 import {DomainRo} from "./domain-ro.model";
-import {ConfirmationDialogComponent} from "../common/confirmation-dialog/confirmation-dialog.component";
+import {ConfirmationDialogComponent} from "../common/dialogs/confirmation-dialog/confirmation-dialog.component";
 import {SearchTableEntityStatus} from "../common/search-table/search-table-entity-status.model";
 import {KeystoreEditDialogComponent} from "./keystore-edit-dialog/keystore-edit-dialog.component";
 import {SmpInfoService} from "../app-info/smp-info.service";
diff --git a/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.css b/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.css
new file mode 100644
index 000000000..aaf6e06f5
--- /dev/null
+++ b/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.css
@@ -0,0 +1,8 @@
+.scroller-div {
+  padding: 4px;
+  width: 100%;
+  height: 308px;
+  overflow-x: hidden;
+  overflow-y: auto;
+  text-align: justify;
+}
diff --git a/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.html b/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.html
index e8d6800d6..a96650049 100644
--- a/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.html
+++ b/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.html
@@ -1,25 +1,24 @@
 <h2 mat-dialog-title>{{formTitle}}</h2>
-<mat-dialog-content style="height:600px;width:1000px">
-  <mat-card style="height:500px">
+<mat-dialog-content style="height:400px;width:850px">
+  <mat-card>
     <mat-card-content >
+      <div class="scroller-div">
       <ngx-datatable
         id='keystoreTable_id'
-        class='material striped'
-        style="height: 450px;"
+        class='material'
+        style="min-height: 300px"
         [reorderable]="true"
-        [sorts]="[{prop: 'alias', dir: 'asc'}]"
-        [selectionType]='"signle"'
+        [selectionType]='"single"'
         [rows]='lookups.cachedCertificateList'
         [columnMode]='"force"'
         [headerHeight]='50'
-        [footerHeight]='50'
-        [rowHeight]='"fixed"'
+        [footerHeight]='0'
+        [rowHeight]='40'
         (activate)='onActivate($event)'
         [count]='lookups.cachedCertificateList.length'
-        [limit]="5"
       >
         <ngx-datatable-column prop="alias" name="Alias" maxWidth="250"></ngx-datatable-column>
-        <ngx-datatable-column prop="certificateId" name="Certificate id"></ngx-datatable-column>
+        <ngx-datatable-column prop="certificateId" minWidth="300" name="Certificate id"></ngx-datatable-column>
         <ngx-datatable-column [cellTemplate]="certificateRowActions" name="Actions"
                               minWidth="100" maxWidth="180" > </ngx-datatable-column>
 
@@ -38,6 +37,7 @@
           </div>
         </ng-template>
       </ngx-datatable>
+      </div>
       <button mat-raised-button color="primary" (click)="openImportKeystoreDialog()">
         <mat-icon>vpn_key</mat-icon>
         <span>Import keystore</span>
@@ -45,14 +45,10 @@
     </mat-card-content>
   </mat-card>
 </mat-dialog-content>
-<table class="buttonsRow">
-  <tr>
-    <td>
-      <button mat-raised-button color="primary" mat-dialog-close>
+
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" mat-dialog-close>
         <mat-icon>close</mat-icon>
         <span>Close</span>
       </button>
-    </td>
-  </tr>
-</table>
-
+</mat-dialog-actions>
diff --git a/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.ts b/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.ts
index 441017a73..ef16ddb0c 100644
--- a/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.ts
+++ b/smp-angular/src/app/domain/keystore-edit-dialog/keystore-edit-dialog.component.ts
@@ -1,22 +1,23 @@
-import {Component, Inject} from '@angular/core';
+import {AfterViewChecked, Component, Inject} from '@angular/core';
 import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog';
 import {FormBuilder} from "@angular/forms";
 import {AlertMessageService} from "../../common/alert-message/alert-message.service";
 import {GlobalLookups} from "../../common/global-lookups";
 import {HttpClient} from "@angular/common/http";
 import {SecurityService} from "../../security/security.service";
-import {CertificateDialogComponent} from "../../common/certificate-dialog/certificate-dialog.component";
-import {ConfirmationDialogComponent} from "../../common/confirmation-dialog/confirmation-dialog.component";
+import {CertificateDialogComponent} from "../../common/dialogs/certificate-dialog/certificate-dialog.component";
+import {ConfirmationDialogComponent} from "../../common/dialogs/confirmation-dialog/confirmation-dialog.component";
 import {KeystoreImportDialogComponent} from "../keystore-import-dialog/keystore-import-dialog.component";
-import {InformationDialogComponent} from "../../common/information-dialog/information-dialog.component";
+import {InformationDialogComponent} from "../../common/dialogs/information-dialog/information-dialog.component";
 import {KeystoreService} from "../keystore.service";
 import {KeystoreResult} from "../keystore-result.model";
 
 @Component({
   selector: 'keystore-edit-dialog',
-  templateUrl: './keystore-edit-dialog.component.html'
+  templateUrl: './keystore-edit-dialog.component.html',
+  styleUrls: ['keystore-edit-dialog.component.css']
 })
-export class KeystoreEditDialogComponent {
+export class KeystoreEditDialogComponent implements AfterViewChecked{
   formTitle: string;
 
   displayedColumns = ['alias', 'certificateId'];
@@ -34,6 +35,11 @@ export class KeystoreEditDialogComponent {
     this.formTitle = "Keystore edit dialog";
   }
 
+  ngAfterViewChecked(): void {
+    // fix bug updating the columns
+    //https://github.com/swimlane/ngx-datatable/issues/1266
+    window.dispatchEvent(new Event('resize'));
+  }
 
   onDeleteCertificateRowActionClicked(row) {
 
diff --git a/smp-angular/src/app/domain/keystore-import-dialog/keystore-import-dialog.component.html b/smp-angular/src/app/domain/keystore-import-dialog/keystore-import-dialog.component.html
index ad474e2b3..052676f46 100644
--- a/smp-angular/src/app/domain/keystore-import-dialog/keystore-import-dialog.component.html
+++ b/smp-angular/src/app/domain/keystore-import-dialog/keystore-import-dialog.component.html
@@ -61,9 +61,8 @@
   </form>
 </mat-dialog-content>
 
-<table class="buttonsRow">
-  <tr>
-    <td>
+<div class="required-fields">* required fields</div>
+<mat-dialog-actions>
       <button mat-raised-button color="primary" (click)="importKeystore()" [disabled]="!dialogForm.valid">
         <mat-icon>vpn_key</mat-icon>
         <span>Import</span>
@@ -72,8 +71,5 @@
         <mat-icon>cancel</mat-icon>
         <span>Cancel</span>
       </button>
-    </td>
-  </tr>
-</table>
-<div style="text-align: right; font-size: 70%">* required fields</div>
+</mat-dialog-actions>
 
diff --git a/smp-angular/src/app/login/login.component.ts b/smp-angular/src/app/login/login.component.ts
index 2c8110438..929b22a41 100644
--- a/smp-angular/src/app/login/login.component.ts
+++ b/smp-angular/src/app/login/login.component.ts
@@ -8,11 +8,11 @@ import {User} from '../security/user.model';
 import {MatDialogRef, MatDialog} from '@angular/material/dialog';
 import {DefaultPasswordDialogComponent} from 'app/security/default-password-dialog/default-password-dialog.component';
 import {Subscription} from 'rxjs';
-import {ExpiredPasswordDialogComponent} from '../common/expired-password-dialog/expired-password-dialog.component';
+import {ExpiredPasswordDialogComponent} from '../common/dialogs/expired-password-dialog/expired-password-dialog.component';
 import {GlobalLookups} from "../common/global-lookups";
-import {PasswordChangeDialogComponent} from "../common/password-change-dialog/password-change-dialog.component";
+import {PasswordChangeDialogComponent} from "../common/dialogs/password-change-dialog/password-change-dialog.component";
 import {UserDetailsDialogMode} from "../user/user-details-dialog/user-details-dialog.component";
-import {InformationDialogComponent} from "../common/information-dialog/information-dialog.component";
+import {InformationDialogComponent} from "../common/dialogs/information-dialog/information-dialog.component";
 import {DatePipe, formatDate} from "@angular/common";
 
 @Component({
@@ -45,7 +45,7 @@ export class LoginComponent implements OnInit, OnDestroy {
       user => {
         if (user && user.passwordExpired) {
           if (user.forceChangeExpiredPassword) {
-            this.dialog.open(PasswordChangeDialogComponent, {data: user}).afterClosed().subscribe(res =>
+            this.dialog.open(PasswordChangeDialogComponent, {data: {user:user,adminUser:false}}).afterClosed().subscribe(res =>
               this.securityService.finalizeLogout(res)
             );
           } else {
diff --git a/smp-angular/src/app/property/property-controller.ts b/smp-angular/src/app/property/property-controller.ts
index bf7d72413..a47c0651c 100644
--- a/smp-angular/src/app/property/property-controller.ts
+++ b/smp-angular/src/app/property/property-controller.ts
@@ -36,7 +36,6 @@ export class PropertyController implements SearchTableController {
   }
 
   public showDetails(row: any) {
-    alert("show dialog")
     let dialogRef: MatDialogRef<PropertyDetailsDialogComponent> = this.dialog.open(PropertyDetailsDialogComponent);
     dialogRef.afterClosed().subscribe(result => {
       console.log("Property dialog is closed!");
diff --git a/smp-angular/src/app/property/property-details-dialog/property-details-dialog.component.html b/smp-angular/src/app/property/property-details-dialog/property-details-dialog.component.html
index 80a8076de..8fad6515a 100644
--- a/smp-angular/src/app/property/property-details-dialog/property-details-dialog.component.html
+++ b/smp-angular/src/app/property/property-details-dialog/property-details-dialog.component.html
@@ -16,7 +16,7 @@
             formControlName="value" [pattern]="propertyForm.controls['valuePattern'].value"/>
         </mat-form-field>
         <mat-checkbox *ngIf="propertyForm.controls['type'].value === 'BOOLEAN'"
-                      formControlName="value" >
+                      formControlName="value">
           {{ propertyForm.controls['property'].value }}
         </mat-checkbox>
         <div *ngIf="propertyForm.controls['errorMessage'].value" class="alert-message-error">
@@ -27,17 +27,13 @@
   </form>
 </mat-dialog-content>
 
-<table class="buttonsRow">
-  <tr>
-    <td>
-      <button mat-raised-button color="primary" (click)="submitForm()" [disabled]="!propertyForm.valid">
-        <mat-icon>check_circle</mat-icon>
-        <span>OK</span>
-      </button>
-      <button mat-raised-button color="primary" mat-dialog-close>
-        <mat-icon>cancel</mat-icon>
-        <span>Cancel</span>
-      </button>
-    </td>
-  </tr>
-</table>
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" (click)="submitForm()" [disabled]="!propertyForm.valid">
+    <mat-icon>check_circle</mat-icon>
+    <span>OK</span>
+  </button>
+  <button mat-raised-button color="primary" mat-dialog-close>
+    <mat-icon>cancel</mat-icon>
+    <span>Cancel</span>
+  </button>
+</mat-dialog-actions>
diff --git a/smp-angular/src/app/security/user.model.ts b/smp-angular/src/app/security/user.model.ts
index 4fc85ce4a..4a19dc78d 100644
--- a/smp-angular/src/app/security/user.model.ts
+++ b/smp-angular/src/app/security/user.model.ts
@@ -8,7 +8,8 @@ export interface User {
   accessTokenExpireOn?: Date;
   authorities: Array<Authority>;
   defaultPasswordUsed: boolean;
-  forceChangeExpiredPassword?:boolean;
-  showPasswordExpirationWarning?:boolean;
+  forceChangeExpiredPassword?: boolean;
+  showPasswordExpirationWarning?: boolean;
   passwordExpireOn?: Date;
+  casUserDataUrl?: string;
 }
diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css
index 0545fd5b2..1a69b5329 100644
--- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css
+++ b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.css
@@ -1,10 +1,14 @@
+.flex-dialog-content{
+  display: flex; justify-content: space-around;
+  flex-flow: row;
+  align-items: stretch;height:510px;min-width:950px
+}
+
 #extensionTextArea {
-  border: none;
-  width: 610px;
-  height:340px;
-  -webkit-box-sizing: border-box; /* <=iOS4, <= Android  2.3 */
-  -moz-box-sizing: border-box; /* FF1+ */
-  box-sizing: border-box; /* Chrome, IE8, Opera, Safari 5.1*/
+  display: block;
+  margin: 0 auto;
+  border: #03A9F4 1px solid;
+  flex-grow: 1;
 }
 
 ::ng-deep .domainWarning {
diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html
index c1c4f717b..a5c83f584 100644
--- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html
+++ b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.html
@@ -1,218 +1,187 @@
 <h2 mat-dialog-title>{{formTitle}}</h2>
-<spinner [show]="showSpinner" [size]="150"> </spinner>
-<mat-dialog-content style="height:600px;width:1200px">
+<spinner [show]="showSpinner" [size]="150"></spinner>
+<mat-dialog-content [class]="'flex-dialog-content'">
 
-  <div fxLayout="row">
-    <div fxLayout="column">
-      <mat-card fxFlex="200px">
-        <!-- mat-card-title>Identifier</mat-card-title -->
-        <mat-card-content style="height: 100px">
-          <div class="panel">
-          <mat-form-field style="width:100%">
-            <input matInput placeholder="Participant identifier" name="participantIdentifier"
-                   id="participantIdentifier_id"
-                   [formControl]="dialogForm.controls['participantIdentifier']" maxlength="50" required>
-            <div
-              *ngIf="(!editMode && dialogForm.controls['participantIdentifier'].touched || editMode) &&  dialogForm.controls['participantIdentifier'].hasError('required')"
-              style="color:red; font-size: 70%">
-              Participant identifier must not be empty and must be up to 50 characters long.
-            </div>
-            <div
-              *ngIf="(!editMode &&  dialogForm.controls['participantIdentifier'].hasError('dbExist'))"
-              style="color:red; font-size: 70%">
-              Participant identifier for given scheme is already defined in database!
-            </div>
-          </mat-form-field>
+  <div fxLayout="column" style="flex-grow: 1;">
+    <mat-card>
+      <!-- mat-card-title>Identifier</mat-card-title -->
+      <mat-card-content>
+        <mat-form-field style="width:100%">
+          <input matInput placeholder="Participant identifier" name="participantIdentifier"
+                 id="participantIdentifier_id"
+                 [formControl]="dialogForm.controls['participantIdentifier']" maxlength="50" required>
+          <div
+            *ngIf="(!editMode && dialogForm.controls['participantIdentifier'].touched || editMode) &&  dialogForm.controls['participantIdentifier'].hasError('required')"
+            style="color:red; font-size: 70%">
+            Participant identifier must not be empty and must be up to 50 characters long.
+          </div>
+          <div
+            *ngIf="(!editMode &&  dialogForm.controls['participantIdentifier'].hasError('dbExist'))"
+            style="color:red; font-size: 70%">
+            Participant identifier for given scheme is already defined in database!
+          </div>
+        </mat-form-field>
 
-          <mat-form-field style="width:100%">
-            <input *ngIf="lookups.cachedApplicationConfig.partyIDSchemeMandatory  else notRequired"
-                   matInput placeholder="Participant scheme" name="participantScheme"
-                   id="participantSchemeMandatory_id"
-                   [formControl]="dialogForm.controls['participantScheme']"
-                   maxlength="255" required>
-            <input #notRequired
-                   matInput placeholder="Participant scheme" name="participantScheme"
-                   id="participantScheme_id"
-                   [formControl]="dialogForm.controls['participantScheme']"
-                   maxlength="255" >
-            <div
-              *ngIf="(!editMode && dialogForm.controls['participantScheme'].touched || editMode) &&  dialogForm.controls['participantScheme'].hasError('required')"
-              style="color:red; font-size: 70%">
-              Participant scheme must not be empty.
-            </div>
-            <div
-              *ngIf="(!editMode && dialogForm.controls['participantScheme'].touched || editMode) &&
+        <mat-form-field style="width:100%">
+          <input *ngIf="lookups.cachedApplicationConfig.partyIDSchemeMandatory  else notRequired"
+                 matInput placeholder="Participant scheme" name="participantScheme"
+                 id="participantSchemeMandatory_id"
+                 [formControl]="dialogForm.controls['participantScheme']"
+                 maxlength="255" required>
+          <input #notRequired
+                 matInput placeholder="Participant scheme" name="participantScheme"
+                 id="participantScheme_id"
+                 [formControl]="dialogForm.controls['participantScheme']"
+                 maxlength="255">
+          <div
+            *ngIf="(!editMode && dialogForm.controls['participantScheme'].touched || editMode) &&  dialogForm.controls['participantScheme'].hasError('required')"
+            style="color:red; font-size: 70%">
+            Participant scheme must not be empty.
+          </div>
+          <div
+            *ngIf="(!editMode && dialogForm.controls['participantScheme'].touched || editMode) &&
                dialogForm.controls['participantScheme'].hasError('pattern')"
-              style="color:red; font-size: 70%">
-              {{participantSchemeMessage}}
-            </div>
-          </mat-form-field>
+            style="color:red; font-size: 70%">
+            {{participantSchemeMessage}}
           </div>
-        </mat-card-content>
-      </mat-card>
-      <mat-card>
-        <mat-card-content>
-          <mat-accordion id="accordion_panel_id">
-            <mat-expansion-panel *ngIf="securityService.isCurrentUserSMPAdmin()" [expanded]="true" id="owner_expansion_panel_id">
-              <mat-expansion-panel-header id="owner_expansion_header_id">
-                <mat-panel-title>Owners*
-                </mat-panel-title>
-                <mat-panel-description id="owner_expansion_description_id">
-                  <div>
+        </mat-form-field>
+      </mat-card-content>
+    </mat-card>
+    <mat-card>
+      <mat-card-content>
+        <mat-accordion id="accordion_panel_id">
+          <mat-expansion-panel *ngIf="securityService.isCurrentUserSMPAdmin()" [expanded]="true"
+                               id="owner_expansion_panel_id">
+            <mat-expansion-panel-header id="owner_expansion_header_id">
+              <mat-panel-title>Owners*
+              </mat-panel-title>
+              <mat-panel-description id="owner_expansion_description_id">
+                <div>
                   Selected user count: {{usersSelected.selectedOptions?.selected.length}}
                   <div
                     *ngIf="(!editMode && dialogForm.controls['users'].touched || editMode) &&  dialogForm.controls['users'].hasError('minSelectedListCount')"
                     style="color:red; font-size: 70%">
                     At least one user (owner) must be selected!
                   </div>
-                  </div>
-                </mat-panel-description>
-              </mat-expansion-panel-header>
-              <mat-selection-list #usersSelected
-                                  [disabled]="!securityService.isCurrentUserSMPAdmin()"
-                                  [compareWith]="compareUserByUserId"
-                                  [formControl]="dialogForm.controls['users']"
-                                  style="height: 200px;  overflow-y: scroll; overflow-x: auto;">
-                <!--                  // if username is null then there must be an cerificate id! -->
-                <mat-list-option  *ngFor="let user of lookups.cachedServiceGroupOwnerList" [value]='user'
-                                  style="max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;">
-                  {{user.username?user.username:user.certificate?.certificateId}}
-                </mat-list-option>
-              </mat-selection-list>
-            </mat-expansion-panel>
+                </div>
+              </mat-panel-description>
+            </mat-expansion-panel-header>
+            <mat-selection-list #usersSelected
+                                [disabled]="!securityService.isCurrentUserSMPAdmin()"
+                                [compareWith]="compareUserByUserId"
+                                [formControl]="dialogForm.controls['users']"
+                                style="min-height: 100px; height: 150px; overflow-y: scroll; overflow-x: auto;">
+              <!--                  // if username is null then there must be an cerificate id! -->
+              <mat-list-option *ngFor="let user of lookups.cachedServiceGroupOwnerList" [value]='user'
+                               style="max-width: 400px;max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;">
+                {{user.username ? user.username : user.certificate?.certificateId}}
+              </mat-list-option>
+            </mat-selection-list>
+          </mat-expansion-panel>
 
-            <mat-expansion-panel [expanded]="!securityService.isCurrentUserSMPAdmin()" id="domain_expansion_panel_id">
-              <mat-expansion-panel-header id="domain_expansion_header_id">
-                <mat-panel-title>Domains*</mat-panel-title>
-                <mat-panel-description id="domain_expansion_description_id">
-                  <div>
-                    Selected domain count: {{domainSelector.selectedOptions?.selected.length}}
-                    <div
-                      *ngIf="(!editMode && dialogForm.controls['serviceGroupDomains'].touched || editMode)
+          <mat-expansion-panel [expanded]="!securityService.isCurrentUserSMPAdmin()" id="domain_expansion_panel_id">
+            <mat-expansion-panel-header id="domain_expansion_header_id">
+              <mat-panel-title>Domains*</mat-panel-title>
+              <mat-panel-description id="domain_expansion_description_id">
+                <div>
+                  Selected domain count: {{domainSelector.selectedOptions?.selected.length}}
+                  <div
+                    *ngIf="(!editMode && dialogForm.controls['serviceGroupDomains'].touched || editMode)
                       &&  dialogForm.controls['serviceGroupDomains'].hasError('minSelectedListCount')"
-                      style="color:red; font-size: 70%">
-                      At least one domain must be selected!
-                    </div>
-                    <div
-                      *ngIf="(!editMode && dialogForm.controls['serviceGroupDomains'].touched || editMode)
+                    style="color:red; font-size: 70%">
+                    At least one domain must be selected!
+                  </div>
+                  <div
+                    *ngIf="(!editMode && dialogForm.controls['serviceGroupDomains'].touched || editMode)
                       &&  dialogForm.controls['serviceGroupDomains'].hasError('multiDomainError')"
-                      style="color:red; font-size: 70%">
-                      SMP is in participant single domain mode! Only one domain must be selected.
-                    </div>
-
-
+                    style="color:red; font-size: 70%">
+                    SMP is in participant single domain mode! Only one domain must be selected.
                   </div>
-                </mat-panel-description>
-              </mat-expansion-panel-header>
-              <mat-selection-list  #domainSelector
-                                   [disabled]="!securityService.isCurrentUserSMPAdmin()"
-                                   [compareWith]="compareDomain"
-                                   [formControl]="dialogForm.controls['serviceGroupDomains']"
-                                   (selectionChange)="onDomainSelectionChanged($event)"
-                                   style="height: 200px;  overflow-y: scroll; overflow-x: auto;">
-                <mat-list-option *ngFor="let domain of lookups.cachedDomainList" [value]='domain'
-                                 style="max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;"
-                                  >
-                  <label [class]="getDomainCodeClass(domain)" [title]="getDomainConfigurationWarning(domain)">{{domain.domainCode}} ({{domain.smlSubdomain}})</label>
-                </mat-list-option>
-              </mat-selection-list>
-            </mat-expansion-panel>
-          </mat-accordion>
-        </mat-card-content>
-      </mat-card>
-    </div>
-
-    <mat-card fxFlex="60">
-      <mat-card-title>Extension
-        <div style="font-size:70%">
-          Extension is automatically wrapped to root element to form vaild XML! No ExtensionWrapper element is needed.
-        </div>
-      </mat-card-title>
 
-      <mat-card-content >
-        <mat-toolbar>
-          <mat-toolbar-row>
-            <button mat-raised-button color="primary"
-                    matTooltip="Clear the extension content."
-                    matTooltipPosition="below"
-            (click)="onExtensionDelete()" >
-              <mat-icon>clear</mat-icon>
-              <span>Clear</span>
-            </button>
-            <button mat-raised-button color="primary"
-                    matTooltip="Opens wizard for adding new Extension. New extension is appended to existing extensions."
-                    matTooltipPosition="below"
-              (click)="onStartWizardDialog()">
-              <mat-icon>add_box</mat-icon>
-              <span>Extension wizard</span>
-            </button>
-            <button mat-raised-button color="primary"
-                    matTooltip="Validate extension by XSD scheme."
-                    matTooltipPosition="below"
-                    (click)="onExtensionValidate()">
-              <mat-icon>warning</mat-icon>
-              <span>Validate</span>
-            </button>
-            <!--  add and test this fuction on backend
-            button mat-raised-button color="primary"
-                    atTooltip="Pritty print extension!"
-                    matTooltipPosition="below"
-                    (click)="onPrettyPrintExtension()">
-              <mat-icon>warning</mat-icon>
-              <span>format XML</span>
-            </button -->
-          </mat-toolbar-row>
-        </mat-toolbar>
-
-        <div style="display: block;" style="border:1px; solid: #999999;margin:5px 0; padding:3px;">
-          <div class="textwrapper">
-            <textarea matInput style="width:100%;border: #03A9F4 1px solid" cols="2" rows="30"
-                      resizeable="false"
-                      id="extensionTextArea"
-                      placeholder="Extension" name="extension"
-                      [formControl]="dialogForm.controls['extension']"
-            ></textarea>
-          </div>
-          <div
-            *ngIf="extensionValidationMessage"
-            [style.color]="isExtensionValid?'green':'red'">
-            {{extensionValidationMessage}}
-          </div>
-        </div>
-        <!-- mat-form-field>
-          <div>
-          <textarea style="width:100% !important;height: 400px !important;  -webkit-box-sizing: border-box;
-       -moz-box-sizing: border-box;
-            box-sizing: border-box;"
 
-                    matInput id="extensionTextArea"
-                    placeholder="Extension" name="extension"
-                    [formControl]="dialogForm.controls['extension']"
-          ></textarea>
-  </div>
-        </mat-form-field -->
+                </div>
+              </mat-panel-description>
+            </mat-expansion-panel-header>
+            <mat-selection-list #domainSelector
+                                [disabled]="!securityService.isCurrentUserSMPAdmin()"
+                                [compareWith]="compareDomain"
+                                [formControl]="dialogForm.controls['serviceGroupDomains']"
+                                (selectionChange)="onDomainSelectionChanged($event)"
+                                style="min-height: 100px; height: 150px; overflow-y: scroll; overflow-x: auto;">
+              <mat-list-option *ngFor="let domain of lookups.cachedDomainList" [value]='domain'
+                               style="max-width: 400px;max-width: 450px !important; word-wrap: break-word !important; height: auto; min-height: 30px !important;"
+              >
+                <label>{{domain.domainCode}} ({{domain.smlSubdomain}})</label>
+              </mat-list-option>
+            </mat-selection-list>
+          </mat-expansion-panel>
+        </mat-accordion>
       </mat-card-content>
     </mat-card>
   </div>
+
+  <mat-card >
+
+    <mat-card-title>Extension
+      <div style="font-size:50%">
+        Extension is automatically wrapped to root element to form valid XML! No ExtensionWrapper element is needed.
+      </div>
+    </mat-card-title>
+
+    <mat-card-content fxLayout="column" style="flex-grow: 1;display: flex;
+    align-items: stretch;">
+      <mat-toolbar style="flex-grow: 0">
+        <mat-toolbar-row>
+          <button mat-raised-button color="primary"
+                  matTooltip="Clear the extension content."
+                  matTooltipPosition="below"
+                  (click)="onExtensionDelete()">
+            <mat-icon>clear</mat-icon>
+            <span>Clear</span>
+          </button>
+          <button mat-raised-button color="primary"
+                  matTooltip="Opens wizard for adding new Extension. New extension is appended to existing extensions."
+                  matTooltipPosition="below"
+                  (click)="onStartWizardDialog()">
+            <mat-icon>add_box</mat-icon>
+            <span>Extension wizard</span>
+          </button>
+          <button mat-raised-button color="primary"
+                  matTooltip="Validate extension by XSD scheme."
+                  matTooltipPosition="below"
+                  (click)="onExtensionValidate()">
+            <mat-icon>warning</mat-icon>
+            <span>Validate</span>
+          </button>
+        </mat-toolbar-row>
+      </mat-toolbar>
+      <div *ngIf="extensionValidationMessage"
+           [ngClass]="{ 'alert-message': extensionValidationMessage, 'alert-message-success': isExtensionValid, 'alert-message-error':!isExtensionValid }"
+           id="alertmessage_id">
+        <span class="alert-message-close-button" (click)="clearAlert()">&times;</span>
+        {{extensionValidationMessage}}
+      </div>
+
+        <textarea matInput style="min-height:250px;flex-grow: 2;background-color: #e1e4e8"
+                id="extensionTextArea"
+                placeholder="Extension" name="extension"
+                [formControl]="dialogForm.controls['extension']"></textarea>
+
+    </mat-card-content>
+  </mat-card>
 </mat-dialog-content>
 
+<div class="required-fields">* required fields</div>
 <mat-dialog-actions>
-  <div class="group-action-button">
-    <button mat-raised-button color="primary" (click)="submitForm()"
-            [disabled]="!dialogForm.valid">
-      <mat-icon>check_circle</mat-icon>
-      <span>OK</span>
-    </button>
-
-    <button mat-raised-button color="primary" mat-dialog-close>
-      <mat-icon>cancel</mat-icon>
-      <span>Cancel</span>
-    </button>
-  </div>
+  <button mat-raised-button color="primary" (click)="submitForm()"
+          [disabled]="!dialogForm.valid">
+    <mat-icon>check_circle</mat-icon>
+    <span>OK</span>
+  </button>
+  <button mat-raised-button color="primary" mat-dialog-close>
+    <mat-icon>cancel</mat-icon>
+    <span>Cancel</span>
+  </button>
 </mat-dialog-actions>
-<div style="text-align: right; font-size: 70%">* required fields</div>
 
-<ng-template mat-tab-label>
-  <label  class="labelHeading" matTooltip="See Pictures"matTooltipClass="example-tooltip-red1">Bounced Users
-  </label>
-</ng-template>
+
diff --git a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts
index 214c5f7f2..6c865718b 100644
--- a/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts
+++ b/smp-angular/src/app/service-group-edit/service-group-details-dialog/service-group-details-dialog.component.ts
@@ -12,7 +12,7 @@ import {ServiceGroupExtensionWizardDialogComponent} from "../service-group-exten
 import {ServiceGroupValidationRo} from "./service-group-validation-edit-ro.model";
 import {DomainRo} from "../../domain/domain-ro.model";
 import {ServiceGroupDomainEditRo} from "../service-group-domain-edit-ro.model";
-import {ConfirmationDialogComponent} from "../../common/confirmation-dialog/confirmation-dialog.component";
+import {ConfirmationDialogComponent} from "../../common/dialogs/confirmation-dialog/confirmation-dialog.component";
 import {SecurityService} from "../../security/security.service";
 import {UserRo} from "../../user/user-ro.model";
 import {ServiceGroupValidationErrorCodeModel} from "./service-group-validation-error-code.model";
@@ -150,37 +150,9 @@ export class ServiceGroupDetailsDialogComponent implements OnInit {
     this.changeDetector.detectChanges()
   }
 
-  getDomainCodeClass(domain) {
-    let domainWarning = this.getDomainConfigurationWarning(domain);
-    if (!!domainWarning) {
-      return 'domainWarning';
-    }
-    return "";
-  }
-  getDomainConfigurationWarning(domain: DomainRo) {
-    let msg =null;
-    if (!domain.signatureKeyAlias) {
-      msg = "The domain should have a defined signature CertAlias."
-    }
-    if (this.lookups.cachedApplicationConfig.smlIntegrationOn) {
-      if( !domain.smlSmpId || !domain.smlClientCertHeader ){
-        msg = (!msg?"": msg+" ") + "For SML integration the SMP SMP ID and SML client certificate must be defined!"
-      }
-    }
-    if(msg) {
-       msg = msg + " To use domain first fix domain configuration."
-    }
-    return msg;
-  }
-
-  isDomainProperlyConfigured(domain: DomainRo){
-    return !this.getDomainConfigurationWarning(domain);
-  }
-
   submitForm() {
     this.checkValidity(this.dialogForm);
 
-
     let request: ServiceGroupValidationRo = {
       serviceGroupId: this.current.id,
       participantScheme: this.dialogForm.controls['participantScheme'].value,
@@ -386,4 +358,8 @@ export class ServiceGroupDetailsDialogComponent implements OnInit {
   isEmpty(str): boolean {
     return (!str || 0 === str.length);
   }
+
+  clearAlert() {
+    this.extensionValidationMessage = null;
+  }
 }
diff --git a/smp-angular/src/app/service-group-edit/service-group-edit.component.html b/smp-angular/src/app/service-group-edit/service-group-edit.component.html
index b81235044..cf7d8e9da 100644
--- a/smp-angular/src/app/service-group-edit/service-group-edit.component.html
+++ b/smp-angular/src/app/service-group-edit/service-group-edit.component.html
@@ -41,7 +41,7 @@
 
   <ng-template #additionalToolButtons></ng-template>
 
-  <ng-template #additionalRowActionButtons let-row="row">
+  <ng-template #additionalRowActionButtons let-row="row" >
     <button mat-icon-button color="primary" [disabled]="row?.deleted || loading"
             (click)="onAddMetadataRow(row)" matTooltip="Add service metadata">
       <mat-icon>playlist_add</mat-icon>
diff --git a/smp-angular/src/app/service-group-edit/service-group-edit.component.ts b/smp-angular/src/app/service-group-edit/service-group-edit.component.ts
index d3c5adeac..86c2afaae 100644
--- a/smp-angular/src/app/service-group-edit/service-group-edit.component.ts
+++ b/smp-angular/src/app/service-group-edit/service-group-edit.component.ts
@@ -48,26 +48,26 @@ export class ServiceGroupEditComponent implements OnInit, AfterViewInit {
 
     this.columnPicker.allColumns = [
       {
-        name: 'Metadata size',
+        name: 'Metadata',
         prop: 'serviceMetadata.length',
         showInitially: true,
-        width: 120,
-        maxWidth: 120,
+        width: 75,
+        maxWidth: 75,
         resizable: "false",
       },
       {
-        name: 'Owners size',
+        name: 'Owners',
         prop: 'users.length',
         showInitially: true,
-        width: 120,
-        maxWidth: 120,
+        width: 75,
+        maxWidth: 75,
         resizable: "false"
       },
       {
         name: 'Participant scheme',
         prop: 'participantScheme',
         showInitially: true,
-        width: 300,
+        width: 200,
         maxWidth: 300,
         resizable: "false"
       },
@@ -80,7 +80,7 @@ export class ServiceGroupEditComponent implements OnInit, AfterViewInit {
         cellTemplate: this.rowSMPUrlLinkAction,
         name: 'OASIS ServiceGroup URL',
         showInitially: true,
-        width: 250,
+        width: 150,
         maxWidth: 250,
         resizable: "false",
         sortable: false
diff --git a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.css b/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.css
index 66c5204a6..b734d415f 100644
--- a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.css
+++ b/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.css
@@ -1,8 +1,5 @@
-#extensionTextArea {
-  border: none;
-  width: 610px;
-  height:340px;
-  -webkit-box-sizing: border-box; /* <=iOS4, <= Android  2.3 */
-  -moz-box-sizing: border-box; /* FF1+ */
-  box-sizing: border-box; /* Chrome, IE8, Opera, Safari 5.1*/
+.flex-dialog-content{
+  display: flex; justify-content: space-around;
+  flex-flow: row;
+  align-items: stretch;height:510px;min-width:950px
 }
diff --git a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.html b/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.html
index e0eb6623d..4b6e30419 100644
--- a/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.html
+++ b/smp-angular/src/app/service-group-edit/service-group-extension-wizard-dialog/service-group-extension-wizard-dialog.component.html
@@ -1,6 +1,6 @@
 <h2 mat-dialog-title>ServiceGroup Extension Wizard</h2>
 
-<mat-dialog-content>
+<mat-dialog-content [class]="'flex-dialog-content'">
   <form [formGroup]="dialogForm">
     <mat-card>
       <mat-card-content>
@@ -20,7 +20,6 @@
 </mat-dialog-content>
 
 <mat-dialog-actions>
-  <div class="group-action-button">
     <button mat-raised-button color="primary" [mat-dialog-close]="true"
             [disabled]="!dialogForm.valid">
       <mat-icon>check_circle</mat-icon>
@@ -31,5 +30,5 @@
       <mat-icon>cancel</mat-icon>
       <span>Cancel</span>
     </button>
-  </div>
+
 </mat-dialog-actions>
diff --git a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.css b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.css
index 7389196e5..c6fbe97a8 100644
--- a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.css
+++ b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.css
@@ -1,3 +1,12 @@
+.flex-dialog-content {
+  display: flex;
+  justify-content: space-around;
+  flex-flow: row;
+  align-items: stretch;
+  height: 510px;
+  min-width: 950px
+}
+
 label:hover, label:active, input:hover + label, input:active + label {
   color: #3f51b5;
 }
diff --git a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.html b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.html
index 9d5a7ddc2..3e649398a 100644
--- a/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.html
+++ b/smp-angular/src/app/service-group-edit/service-group-metadata-dialog/service-group-metadata-dialog.component.html
@@ -1,7 +1,7 @@
 <h2 mat-dialog-title>{{formTitle}}</h2>
-<mat-dialog-content style="height:750px;width:1200px">
-  <div fxLayout="column">
-    <mat-card   >
+<mat-dialog-content class="flex-dialog-content">
+  <div fxLayout="column" style="flex-grow: 1;">
+    <mat-card  style="flex-grow: 1;" >
 
       <mat-card-content >
         <div class="panel">
@@ -39,7 +39,7 @@
     </mat-card>
 
 
-    <mat-card>
+    <mat-card style="flex-grow: 1;">
       <mat-card-content>
         <mat-toolbar>
           <mat-toolbar-row>
@@ -101,18 +101,18 @@
     </mat-card>
   </div>
 </mat-dialog-content>
+
+
+<div class="required-fields">* required fields</div>
 <mat-dialog-actions>
-  <div class="group-action-button">
-    <button mat-raised-button color="primary" (click)="submitForm()"
-            [disabled]="!dialogForm.valid">
-      <mat-icon>check_circle</mat-icon>
-      <span>OK</span>
-    </button>
+  <button mat-raised-button color="primary" (click)="submitForm()"
+          [disabled]="!dialogForm.valid">
+    <mat-icon>check_circle</mat-icon>
+    <span>OK</span>
+  </button>
 
-    <button mat-raised-button color="primary" mat-dialog-close>
-      <mat-icon>cancel</mat-icon>
-      <span>Cancel</span>
-    </button>
-  </div>
+  <button mat-raised-button color="primary" mat-dialog-close>
+    <mat-icon>cancel</mat-icon>
+    <span>Cancel</span>
+  </button>
 </mat-dialog-actions>
-<div style="text-align: right; font-size: 70%">* required fields</div>
diff --git a/smp-angular/src/app/service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component.css b/smp-angular/src/app/service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component.css
index 56d17f14a..1f31b3347 100644
--- a/smp-angular/src/app/service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component.css
+++ b/smp-angular/src/app/service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component.css
@@ -1,3 +1,9 @@
+.flex-dialog-content{
+  display: flex; justify-content: space-around;
+  flex-flow: row;
+  align-items: stretch;height:510px;min-width:950px
+}
+
 #extensionTextArea {
   border: none;
   width: 610px;
diff --git a/smp-angular/src/app/service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component.html b/smp-angular/src/app/service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component.html
index 3540d6360..527f9f3ab 100644
--- a/smp-angular/src/app/service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component.html
+++ b/smp-angular/src/app/service-group-edit/service-metadata-wizard-dialog/service-metadata-wizard-dialog.component.html
@@ -1,6 +1,6 @@
-<h2 mat-dialog-title>ServiceMetadataWizard</h2>
+<h2 mat-dialog-title>Service Metadata Wizard</h2>
 
-<mat-dialog-content>
+<mat-dialog-content class="flex-dialog-content">
   <form [formGroup]="dialogForm">
     <mat-card>
       <mat-card-content>
@@ -104,8 +104,8 @@
   </form>
 </mat-dialog-content>
 
+<div class="required-fields">* required fields</div>
 <mat-dialog-actions>
-  <div class="group-action-button">
     <button mat-raised-button color="primary" [mat-dialog-close]="true"
             [disabled]="!dialogForm.valid">
       <mat-icon>check_circle</mat-icon>
@@ -116,5 +116,4 @@
       <mat-icon>cancel</mat-icon>
       <span>Cancel</span>
     </button>
-  </div>
 </mat-dialog-actions>
diff --git a/smp-angular/src/app/smp.constants.ts b/smp-angular/src/app/smp.constants.ts
index 7038d8a5d..a3ad75c35 100644
--- a/smp-angular/src/app/smp.constants.ts
+++ b/smp-angular/src/app/smp.constants.ts
@@ -1,6 +1,9 @@
 export class SmpConstants {
 
+  public static readonly  DATE_TIME_FORMAT = 'dd/MM/yyyy, HH:mm:ss z';
+
   public static readonly PATH_PARAM_ENC_USER_ID = '{user-id}';
+  public static readonly PATH_PARAM_ENC_MANAGED_USER_ID = '{managed-user-id}';
   public static readonly PATH_PARAM_SRV_GROUP_ID = '{service-group-id}';
 
   //------------------------------
@@ -43,11 +46,15 @@ export class SmpConstants {
   public static readonly REST_INTERNAL_PROPERTY_VALIDATE = SmpConstants.REST_INTERNAL_PROPERTY_MANAGE + '/validate';
   public static readonly REST_INTERNAL_DOMAIN_VALIDATE_DELETE = SmpConstants.REST_INTERNAL_DOMAIN_MANAGE + '/validate-delete';
   public static readonly REST_INTERNAL_USER_MANAGE = SmpConstants.REST_INTERNAL + 'user';
+  public static readonly REST_INTERNAL_USER_GENERATE_ACCESS_TOKEN = SmpConstants.REST_INTERNAL_USER_MANAGE +
+    '/' + SmpConstants.PATH_PARAM_ENC_USER_ID + '/' + 'generate-access-token-for'+ '/' + SmpConstants.PATH_PARAM_ENC_MANAGED_USER_ID;
+
+  public static readonly REST_INTERNAL_USER_CHANGE_PASSWORD = SmpConstants.REST_INTERNAL_USER_MANAGE +
+    '/' + SmpConstants.PATH_PARAM_ENC_USER_ID + '/' + 'change-password-for'+ '/' + SmpConstants.PATH_PARAM_ENC_MANAGED_USER_ID;
+
   public static readonly REST_INTERNAL_USER_VALIDATE_DELETE = `${SmpConstants.REST_INTERNAL_USER_MANAGE}/validate-delete`;
   public static readonly REST_INTERNAL_APPLICATION_CONFIG = SmpConstants.REST_INTERNAL + 'application/config';
   public static readonly REST_INTERNAL_KEYSTORE = SmpConstants.REST_INTERNAL + 'keystore';
   public static readonly REST_INTERNAL_TRUSTSTORE = SmpConstants.REST_INTERNAL + 'truststore';
-  public static readonly REST_INTERNAL_TRUSTSTORE_UPLOAD_CERT = SmpConstants.REST_INTERNAL_TRUSTSTORE + "/" + SmpConstants.PATH_PARAM_ENC_USER_ID + "/" + 'upload-certificate';
-
-
+  public static readonly REST_INTERNAL_TRUSTSTORE_UPLOAD_CERT = SmpConstants.REST_INTERNAL_TRUSTSTORE + '/' + SmpConstants.PATH_PARAM_ENC_USER_ID + '/' + 'upload-certificate';
 }
diff --git a/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.css b/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.css
index 9f3dfc897..402a80713 100644
--- a/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.css
+++ b/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.css
@@ -3,7 +3,7 @@
 }
 
 .custom-file-upload {
-  display: inline-block;
+  display: block;
   cursor: pointer;
 }
 
@@ -13,6 +13,15 @@
 }
 
 .has-error {
-  color:red;
+  color: red;
   font-size: 70%;
 }
+
+.scroller-div {
+  padding: 4px;
+  width: 100%;
+  height: 308px;
+  overflow-x: hidden;
+  overflow-y: auto;
+  text-align: justify;
+}
diff --git a/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.html b/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.html
index 33a04d5cc..b5dfda97b 100644
--- a/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.html
+++ b/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.html
@@ -1,6 +1,6 @@
 <h2 mat-dialog-title>{{formTitle}}</h2>
-<mat-dialog-content style="height:600px;width:1000px">
-  <mat-card style="height:500px">
+<mat-dialog-content style="height:480px;width:850px">
+  <mat-card style="min-height:350px;">
     <mat-card-content>
       <mat-label style="color: red;font-weight: bold">
         If truststore is empty users certificates are NOT verified if trusted!
@@ -14,62 +14,58 @@
         Not trusted certificates cannot access REST services.
       </mat-label>
       <br/>
-      <ngx-datatable
-        id='truststoreTable_id'
-        class='material striped'
-        style="height: 450px;"
-        [reorderable]="true"
-        [sorts]="[{prop: 'alias', dir: 'asc'}]"
-        [selectionType]='"signle"'
-        [rows]='lookups.cachedTrustedCertificateList'
-        [columnMode]='"force"'
-        [headerHeight]='50'
-        [footerHeight]='50'
-        [rowHeight]='"fixed"'
-        (activate)='onActivate($event)'
-        [count]='lookups.cachedTrustedCertificateList.length'
-        [limit]="5"
-      >
-        <ngx-datatable-column prop="alias" name="Alias" maxWidth="250"></ngx-datatable-column>
-        <ngx-datatable-column prop="certificateId" name="Certificate id"></ngx-datatable-column>
-        <ngx-datatable-column [cellTemplate]="certificateRowActions" name="Actions"
-                              maxWidth="180"></ngx-datatable-column>
-
-        <ng-template #certificateRowActions let-row="row" ngx-datatable-cell-template>
-          <div>
-            <button mat-icon-button color="primary"
-                    matTooltip="Certificate details"
-                    (click)="onShowCertificateDataRow(row)">
-              <mat-icon>details</mat-icon>
-            </button>
-            <button mat-icon-button color="primary"
-                    matTooltip="Delete certificate"
-                    (click)="onDeleteCertificateRowActionClicked(row)">
-              <mat-icon>delete</mat-icon>
-            </button>
-          </div>
-        </ng-template>
-      </ngx-datatable>
-      <label class="custom-file-upload">
+      <div class="scroller-div">
+        <ngx-datatable
+          id='truststoreTable_id'
+          class='material'
+          style="min-height: 300px"
+          [reorderable]="true"
+          [selectionType]='"single"'
+          [columns]="tableColumns"
+          [rows]='trustedCertificateList'
+          [columnMode]='"force"'
+          [headerHeight]='50'
+          [footerHeight]='0'
+          [rowHeight]='40'
+          (activate)='onActivate($event)'
+        >
+          <ng-template #certificateRowActions let-row="row" ngx-datatable-cell-template>
+            <div>
+              <button mat-icon-button color="primary"
+                      matTooltip="Certificate details"
+                      (click)="onShowCertificateDataRow(row)">
+                <mat-icon>details</mat-icon>
+              </button>
+              <button mat-icon-button color="primary"
+                      matTooltip="Delete certificate"
+                      (click)="onDeleteCertificateRowActionClicked(row)">
+                <mat-icon>delete</mat-icon>
+              </button>
+            </div>
+          </ng-template>
+          <ng-template #rowIndex let-row="row" ngx-datatable-cell-template>
+            <span>{{row.index + 1}}</span>
+          </ng-template>
+        </ngx-datatable>
+      </div>
+    </mat-card-content>
+  </mat-card>
+  <mat-toolbar>
+    <mat-toolbar-row>
+      <div class="custom-file-upload">
         <input #fileInput type="file" id="custom-file-upload" accept=".cer,.crt,.pem,.der"
                (change)="uploadCertificate($event)">
-        <button mat-flat-button color="primary"
+        <button mat-raised-button mat-flat-button color="primary"
                 (click)="fileInput.click()"
         >Add certificate
         </button>
-      </label>
-
-    </mat-card-content>
-  </mat-card>
+      </div>
+    </mat-toolbar-row>
+  </mat-toolbar>
 </mat-dialog-content>
-<table class="buttonsRow">
-  <tr>
-    <td>
-      <button mat-raised-button color="primary" mat-dialog-close>
-        <mat-icon>close</mat-icon>
-        <span>Close</span>
-      </button>
-    </td>
-  </tr>
-</table>
-
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" mat-dialog-close>
+    <mat-icon>close</mat-icon>
+    <span>Close</span>
+  </button>
+</mat-dialog-actions>
diff --git a/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.ts b/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.ts
index feab2a2da..2e9589182 100644
--- a/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.ts
+++ b/smp-angular/src/app/user/truststore-edit-dialog/truststore-edit-dialog.component.ts
@@ -1,4 +1,4 @@
-import {Component, Inject} from '@angular/core';
+import {AfterViewChecked, AfterViewInit, Component, Inject, TemplateRef, ViewChild} from '@angular/core';
 import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog';
 import {FormBuilder} from "@angular/forms";
 import {AlertMessageService} from "../../common/alert-message/alert-message.service";
@@ -6,9 +6,8 @@ import {GlobalLookups} from "../../common/global-lookups";
 import {HttpClient} from "@angular/common/http";
 import {SecurityService} from "../../security/security.service";
 import {TruststoreService} from "../truststore.service";
-import {CertificateDialogComponent} from "../../common/certificate-dialog/certificate-dialog.component";
-import {ConfirmationDialogComponent} from "../../common/confirmation-dialog/confirmation-dialog.component";
-import {InformationDialogComponent} from "../../common/information-dialog/information-dialog.component";
+import {CertificateDialogComponent} from "../../common/dialogs/certificate-dialog/certificate-dialog.component";
+import {ConfirmationDialogComponent} from "../../common/dialogs/confirmation-dialog/confirmation-dialog.component";
 import {TruststoreResult} from "../truststore-result.model";
 import {CertificateRo} from "../certificate-ro.model";
 
@@ -18,10 +17,14 @@ import {CertificateRo} from "../certificate-ro.model";
   templateUrl: './truststore-edit-dialog.component.html',
   styleUrls: ['truststore-edit-dialog.component.css']
 })
-export class TruststoreEditDialogComponent {
+export class TruststoreEditDialogComponent implements AfterViewInit, AfterViewChecked {
+  @ViewChild('certificateRowActions') certificateRowActions: TemplateRef<any>;
+  @ViewChild('rowIndex') rowIndex: TemplateRef<any>;
+
   formTitle: string;
+  trustedCertificateList: Array<any> = [];
 
-  displayedColumns = ['alias', 'certificateId'];
+  tableColumns = [];
 
 
   constructor(private truststoreService: TruststoreService,
@@ -34,22 +37,64 @@ export class TruststoreEditDialogComponent {
               @Inject(MAT_DIALOG_DATA) public data: any,
               private fb: FormBuilder) {
     this.formTitle = "Truststore edit dialog";
+    // bind to trusted certificate list events
+    this.lookups.onTrustedCertificateListRefreshEvent().subscribe((data) => {
+        this.refreshData();
+      }
+    )
   }
 
+  ngAfterViewChecked(): void {
+    // fix bug updating the columns
+    //https://github.com/swimlane/ngx-datatable/issues/1266
+    window.dispatchEvent(new Event('resize'));
+  }
 
-  onDeleteCertificateRowActionClicked(row) {
+  ngAfterViewInit(): void {
+    this.tableColumns = [
+      {
+        cellTemplate: this.rowIndex,
+        name: 'Index',
+        width: 30,
+        maxWidth: 80,
+        sortable: false
+      },
+      {
+        name: 'Alias',
+        prop: 'alias',
+        sortable: false,
+      },
+      {
+        name: 'Certificate',
+        prop: 'certificateId',
+        sortable: false,
+      },
+      {
+        name: 'Actions',
+        sortable: false,
+        cellTemplate: this.certificateRowActions,
+      },
+    ];
+
+    this.refreshData();
+  }
 
-      this.dialog.open(ConfirmationDialogComponent, {
-        data: {
-          title: "Delete certificate " + row.alias + " from truststore!",
-          description: "Action will permanently delete certificate from truststore! Do you wish to continue?"
-        }
-      }).afterClosed().subscribe(result => {
-        if (result) {
-          this.deleteCertificateFromTruststore(row.alias);
-        }
-      })
 
+  refreshData() {
+    this.trustedCertificateList = [...this.lookups.cachedTrustedCertificateList];
+  }
+
+  onDeleteCertificateRowActionClicked(row) {
+    this.dialog.open(ConfirmationDialogComponent, {
+      data: {
+        title: "Delete certificate " + row.alias + " from truststore!",
+        description: "Action will permanently delete certificate from truststore! Do you wish to continue?"
+      }
+    }).afterClosed().subscribe(result => {
+      if (result) {
+        this.deleteCertificateFromTruststore(row.alias);
+      }
+    });
   }
 
   deleteCertificateFromTruststore(alias: string) {
@@ -58,9 +103,8 @@ export class TruststoreEditDialogComponent {
           if (res.errorMessage) {
             this.alertService.exception("Error occurred while deleting certificate:" + alias, res.errorMessage, false);
           } else {
-            this.alertService.success("Certificate " + alias + " deleted!");
+            this.alertService.success("Certificate with alias [" + alias + "] is deleted!");
             this.lookups.refreshTrustedCertificateLookup();
-
           }
         } else {
           this.alertService.exception("Error occurred while deleting certificate:" + alias, "Unknown Error", false);
@@ -77,7 +121,7 @@ export class TruststoreEditDialogComponent {
     const file = event.target.files[0];
     this.truststoreService.uploadCertificate$(file).subscribe((res: CertificateRo) => {
         if (res && res.certificateId) {
-          this.alertService.success("Certificate: " + res.certificateId + " is imported!");
+          this.alertService.success("Certificate: [" + res.certificateId + "] with alias [" + res.alias + "] is imported!");
           this.lookups.refreshTrustedCertificateLookup();
         } else {
           this.alertService.exception("Error occurred while uploading certificate.", "Check if uploaded file has valid certificate type.", false);
diff --git a/smp-angular/src/app/user/user-controller.ts b/smp-angular/src/app/user/user-controller.ts
index 8b320b3ab..daa108d2f 100644
--- a/smp-angular/src/app/user/user-controller.ts
+++ b/smp-angular/src/app/user/user-controller.ts
@@ -9,8 +9,9 @@ import {SearchTableValidationResult} from "../common/search-table/search-table-v
 import {SmpConstants} from "../smp.constants";
 import {HttpClient} from "@angular/common/http";
 import {CertificateRo} from "./certificate-ro.model";
-import {PasswordChangeDialogComponent} from "../common/password-change-dialog/password-change-dialog.component";
-import {AccessTokenGenerationDialogComponent} from "../common/access-token-generation-dialog/access-token-generation-dialog.component";
+import {PasswordChangeDialogComponent} from "../common/dialogs/password-change-dialog/password-change-dialog.component";
+import {AccessTokenGenerationDialogComponent} from "../common/dialogs/access-token-generation-dialog/access-token-generation-dialog.component";
+
 
 export class UserController implements SearchTableController {
 
diff --git a/smp-angular/src/app/user/user-details-dialog/user-details-dialog.component.html b/smp-angular/src/app/user/user-details-dialog/user-details-dialog.component.html
index 845e368d6..75df6989b 100644
--- a/smp-angular/src/app/user/user-details-dialog/user-details-dialog.component.html
+++ b/smp-angular/src/app/user/user-details-dialog/user-details-dialog.component.html
@@ -1,10 +1,29 @@
-<mat-dialog-content fxFlex="column">
-  <h2 mat-dialog-title>{{mode}}</h2>
+<h2 mat-dialog-title>{{mode}}</h2>
+<mat-dialog-content style="width:950px">
+
 
   <mat-card>
-    <mat-card-content >
+    <mat-card-content>
+      <mat-form-field class="username">
+        <input matInput placeholder="Username" [formControl]="userForm.controls['username']"
+               id="username_id" maxlength="255" required>
+        <div *ngIf="userForm.controls['username'].hasError('required') && userForm.controls['username'].touched"
+             class="has-error">You should type an username
+        </div>
+        <div *ngIf="userForm.controls['username'].hasError('pattern') && userForm.controls['username'].touched"
+             class="has-error">Username can only contain alphanumeric characters (letters A-Z, numbers 0-9) and must
+          have from 4 to 32 characters!
+        </div>
+        <div
+          *ngIf="(!editMode && userForm.controls['username'].touched || editMode) && userForm.controls['username'].hasError('notInList')"
+          class="has-error">
+          Username already exists!
+        </div>
+      </mat-form-field>
+
       <mat-slide-toggle *ngIf="!isPreferencesMode()" class="user-toggle"
-                mat-no-ink class="mat-primary" [formControl]="userForm.controls['active']" id="active_id">
+                        mat-no-ink class="mat-primary" [formControl]="userForm.controls['active']" id="active_id">
+
         Active
       </mat-slide-toggle>
 
@@ -18,122 +37,82 @@
         </div>
       </mat-form-field>
       <mat-form-field class="emailAddress" class="email">
-        <input matInput placeholder="Email address" name="emailAddress" [formControl]="userForm.controls['emailAddress']"
+        <input matInput placeholder="Email address" name="emailAddress"
+               [formControl]="userForm.controls['emailAddress']"
                id="emailAddress_id" maxlength="255">
       </mat-form-field>
       <div *ngIf="userForm.controls['emailAddress'].hasError('pattern') && userForm.controls['emailAddress'].touched"
            class="has-error">Email is invalid!
       </div>
-
     </mat-card-content>
   </mat-card>
-  <div fxLayout="row">
-    <mat-card fxFlex="40">
-      <mat-card-title>
-        <mat-slide-toggle mat-no-ink class="mat-primary" [formControl]="userForm.controls['userToggle']"
-                          (change)="onUserToggleChanged($event)" id="userDetailsToggle_id">
-          User/password authentication
-        </mat-slide-toggle>
-        <div *ngIf="userForm.errors?.userDetailsOrCertificateRequired && (userForm.get('userToggle').dirty || userForm.get('certificateToggle').dirty)"
-          class="has-error">You need to enter at least the details or the certificate for this user
-        </div>
-      </mat-card-title>
-
+  <div style="display: flex;flex-flow: row;">
+    <mat-card style="flex-grow: 1">
+      <mat-card-title>UI authentication credentials</mat-card-title>
       <mat-card-content>
-        <div class="panel" class="user-panel">
-          <mat-form-field class="username">
-            <input matInput placeholder="Username" [formControl]="userForm.controls['username']"
-                   id="username_id" maxlength="255" required>
-            <div *ngIf="userForm.controls['username'].hasError('required') && userForm.controls['username'].touched"
-                 class="has-error">You should type an username</div>
-            <div *ngIf="userForm.controls['username'].hasError('pattern') && userForm.controls['username'].touched"
-                 class="has-error">Username can only contain alphanumeric characters (letters A-Z, numbers 0-9) and must have from 4 to 32 characters!</div>
-            <div
-              *ngIf="(!editMode && userForm.controls['username'].touched || editMode) && userForm.controls['username'].hasError('notInList')"
-              class="has-error">
-              Username already exists!
-            </div>
-          </mat-form-field>
-
-          <mat-slide-toggle *ngIf="editMode && current.username" mat-no-ink class="mat-primary" [formControl]="userForm.controls['passwordToggle']"
-                            (change)="onPasswordToggleChanged($event)" id="passwordToggle_id">
-            Change password
-          </mat-slide-toggle>
-
-          <mat-form-field class="password">
-            <input matInput placeholder="Password" type="password" [formControl]="userForm.controls['password']"
-                   [pattern]="passwordPattern"
-                   id="password_id" [required]="!editMode || (current.username && userForm.controls['userToggle'].value )">
-            <div
-              *ngIf="!editMode && userForm.controls['password'].hasError('required') && userForm.controls['password'].touched"
-              class="has-error">You should type a password</div>
-            <div
-              *ngIf="userForm.controls['password'].dirty && userForm.controls['password'].hasError('pattern') && userForm.controls['password'].touched"
-              class="has-error">
-              Password should follow all of these rules:<br>
-              - Minimum length: 8 characters<br>
-              - Maximum length: 32 characters<br>
-              - At least one letter in lowercase<br>
-              - At least one letter in uppercase<br>
-              - At least one digit<br>
-              - At least one special character
-            </div>
-            <div *ngIf="userForm.errors?.previousPasswordUsed" class="has-error">
-              Password should be different than the previous chosen one
-            </div>
+        <fieldset style="border: solid gray 1px;">
+          <legend>Username/password credentials</legend>
+          <div style="display: flex;flex-flow: row wrap;">
+            <mat-form-field style="flex-grow: 2">
+              <input matInput placeholder="Username" [formControl]="userForm.controls['username']"
+                     id="username-password_id" maxlength="255" disabled>
+            </mat-form-field>
+            <mat-form-field style="flex-grow: 1">
+              <input matInput placeholder="Valid until"
+                     value="{{userForm.get('passwordExpireOn').value | date:dateTimeFormat}}"
+                     maxlength="255" disabled>
+            </mat-form-field>
+          </div>
+          <button mat-flat-button color="primary" style="width: 100%" id="changePassword_id"
+                  (click)="changeCurrentUserPassword()">
+            <span>Change password</span>
+          </button>
+        </fieldset>
+      </mat-card-content>
+      <mat-card-content>
+        <fieldset style="border: solid gray 1px;">
+          <legend>CAS authentication</legend>
+          <mat-form-field style="width: 100%">
+            <input matInput placeholder="Cas identifier" [formControl]="userForm.controls['username']"
+                   id="cas-user_id" maxlength="255" disabled>
           </mat-form-field>
+          <button mat-flat-button color="primary" style="width: 100%" id="openCASData"
+                  (click)="openCurrentCasUserData()">
+            <span>Open CAS user data</span>
+          </button>
 
-          <mat-form-field class="password-confirmation">
-            <input matInput placeholder="Confirmation" type="password" [formControl]="userForm.controls['confirmation']"
-                   id="usernameconfirmation_id" [required]="!editMode || (current.username && userForm.controls['userToggle'].value )">
-            <div
-              *ngIf="!editMode && userForm.controls['confirmation'].hasError('required') && userForm.controls['confirmation'].touched"
-              class="has-error">You should type a password
-            </div>
-            <div *ngIf="userForm.errors?.confirmationMatch && userForm.controls['confirmation'].touched"
-                 class="has-error">Passwords do not match
-            </div>
-          </mat-form-field>
-        </div>
+        </fieldset>
       </mat-card-content>
     </mat-card>
-    <mat-card fxFlex="60">
-      <mat-card-title>
-        <mat-slide-toggle mat-no-ink class="mat-primary" (change)="onCertificateToggleChanged($event)"
-                          [formControl]="userForm.controls['certificateToggle']"
-                          id="certificateToggle_id">
-          Certificate authentication
-        </mat-slide-toggle>
-        <div
-          *ngIf="userForm.errors?.userDetailsOrCertificateRequired && (userForm.get('userToggle').dirty || userForm.get('certificateToggle').dirty)"
-          class="has-error">You need to enter at least the details or the certificate for this user!</div>
-        <div *ngIf="userForm.errors?.certificatedetailsrequired && userForm.get('certificateToggle').touched"
-             class="has-error">All the certificate fields are required so please upload a new certificate!</div>
-        <div *ngIf="userForm.errors?.certificateIdExists"
-             class="has-error">Certificate is already used by another user!</div>
-      </mat-card-title>
+    <mat-card style="flex-grow: 2">
+      <mat-card-title>Web service credentials</mat-card-title>
       <mat-card-content>
-        <div class="panel">
-          <mat-form-field class="certificate-subject">
-            <input matInput placeholder="Subject Name" [formControl]="userForm.controls['subject']" id="subject_id">
-          </mat-form-field>
-          <mat-form-field class="certificate-valid-from">
-            <input matInput placeholder="Valid From" [formControl]="userForm.controls['validFrom']" id="validFrom_id">
-          </mat-form-field>
-          <mat-form-field class="certificate-valid-to">
-            <input matInput placeholder="Valid To" [formControl]="userForm.controls['validTo']" id="validTo_id">
-          </mat-form-field>
-          <mat-form-field class="certificate-issuer">
-            <input matInput placeholder="Issuer" [formControl]="userForm.controls['issuer']" id="issuer_id">
-          </mat-form-field>
-          <mat-form-field class="certificate-serial-number">
-            <input matInput placeholder="Serial Number" [formControl]="userForm.controls['serialNumber']"
-                   id="servialNumber_id">
-          </mat-form-field>
+        <fieldset style="border: solid gray 1px;">
+          <legend>Access token credentials</legend>
+          <div style="display: flex;flex-flow: row wrap;">
+            <mat-form-field style="flex-grow: 2">
+              <input matInput placeholder="Access token ID" [formControl]="userForm.controls['accessTokenId']"
+                     maxlength="255" disabled>
+            </mat-form-field>
+            <mat-form-field style="flex-grow: 1">
+              <input matInput placeholder="Valid until"
+                     value="{{userForm.get('accessTokenExpireOn').value | date:dateTimeFormat}}"
+                     maxlength="255" disabled>
+            </mat-form-field>
+          </div>
+          <button mat-flat-button color="primary" style="width: 100%" (click)="regenerateAccessToken()">
+            <span>Regenerate access token</span>
+          </button>
+        </fieldset>
+      </mat-card-content>
+
+      <mat-card-content>
+        <fieldset style="border: solid gray 1px;">
+          <legend>Certificate authentication</legend>
           <mat-form-field class="certificate-id">
             <input matInput placeholder="SMP certificate ID" [formControl]="userForm.controls['certificateId']"
                    id="certificateId_id"
-                  resizeable="true">
+                   resizeable="true">
           </mat-form-field>
           <div
             *ngIf="isCertificateInvalid"
@@ -141,33 +120,41 @@
             {{certificateValidationMessage}}
           </div>
 
-          <label class="custom-file-upload">
-            <input #fileInput type="file" id="custom-file-upload" accept=".cer,.crt,.pem,.der"
-                   (change)="uploadCertificate($event)" [disabled]="!userForm.controls['certificateToggle']?.value">
-            <button mat-flat-button color="primary" (click)="fileInput.click()"
-                    [disabled]="!userForm.controls['certificateToggle']?.value">Import
+          <div style="display: flex; flex-flow: row;align-items: stretch;">
+            <label class="custom-file-upload" style="flex-grow: 1">
+              <input #fileInput type="file" id="custom-file-upload" accept=".cer,.crt,.pem,.der"
+                     (change)="uploadCertificate($event)">
+              <button mat-flat-button color="primary" (click)="fileInput.click()"
+              >Import
+              </button>
+            </label>
+
+            <button mat-flat-button color="primary" style="flex-grow: 1"
+                    [disabled]="!userForm.get('certificateId').value"
+                    (click)="onShowCertificateDataRow()">
+              <span>Show details</span>
             </button>
-          </label>
-        </div>
+            <button mat-flat-button color="primary" style="flex-grow: 1"
+                    [disabled]="!userForm.get('certificateId').value"
+                    (click)="clearCertificate()">
+              <span>Clear</span>
+            </button>
+          </div>
+        </fieldset>
       </mat-card-content>
-
     </mat-card>
   </div>
-
-  <table class="buttonsRow">
-    <tr>
-      <td>
-        <button mat-raised-button color="primary" [mat-dialog-close]="true" (click)="submitForm()"
-                [disabled]="!userForm.valid ">
-          <mat-icon>check_circle</mat-icon>
-          <span>OK</span>
-        </button>
-        <button mat-raised-button color="primary" mat-dialog-close>
-          <mat-icon>cancel</mat-icon>
-          <span>Cancel</span>
-        </button>
-      </td>
-    </tr>
-  </table>
-  <div class="required-fields">* required fields</div>
 </mat-dialog-content>
+<div class="required-fields">* required fields</div>
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" [mat-dialog-close]="true" (click)="submitForm()"
+          [disabled]="!userForm.valid ">
+    <mat-icon>check_circle</mat-icon>
+    <span>OK</span>
+  </button>
+  <button mat-raised-button color="primary" mat-dialog-close>
+    <mat-icon>cancel</mat-icon>
+    <span>Cancel</span>
+  </button>
+</mat-dialog-actions>
+
diff --git a/smp-angular/src/app/user/user-details-dialog/user-details-dialog.component.ts b/smp-angular/src/app/user/user-details-dialog/user-details-dialog.component.ts
index f42b1142e..a3df888d2 100644
--- a/smp-angular/src/app/user/user-details-dialog/user-details-dialog.component.ts
+++ b/smp-angular/src/app/user/user-details-dialog/user-details-dialog.component.ts
@@ -1,9 +1,8 @@
 import {Component, Inject, ViewChild} from '@angular/core';
-import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
+import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog';
 
 import {
   AbstractControl,
-  AsyncValidatorFn,
   FormBuilder,
   FormControl,
   FormGroup,
@@ -19,25 +18,27 @@ import {CertificateService} from '../certificate.service';
 import {CertificateRo} from "../certificate-ro.model";
 import {DatePipe} from "../../custom-date/date.pipe";
 import {GlobalLookups} from "../../common/global-lookups";
-import {Observable, of} from "rxjs";
-import {catchError, map} from "rxjs/operators";
 import {UserDetailsService} from "./user-details.service";
 import {MatSlideToggleChange} from "@angular/material/slide-toggle";
-import {AccessTokenRo} from "../../common/access-token-generation-dialog/access-token-ro.model";
+import {SecurityService} from "../../security/security.service";
+import {UserController} from "../user-controller";
+import {HttpClient} from "@angular/common/http";
+import {CertificateDialogComponent} from "../../common/dialogs/certificate-dialog/certificate-dialog.component";
+import {SmpConstants} from "../../smp.constants";
 
 @Component({
   selector: 'user-details-dialog',
   templateUrl: './user-details-dialog.component.html',
-  styleUrls: ['user-details-dialog.component.css']
+  styleUrls: ['user-details-dialog.component.css'],
 })
 export class UserDetailsDialogComponent {
 
   @ViewChild('fileInput') private fileInput;
 
   readonly emailPattern = '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}';
-  readonly passwordPattern = '^(?=.*[A-Z])(?=.*[ !#$%&\'()*+,-./:;<=>?@\\[^_`{|}~\\\]"])(?=.*[0-9])(?=.*[a-z]).{8,32}$';
   readonly dateFormat: string = 'yyyy-MM-dd HH:mm:ssZ';
   readonly usernamePattern = '^[a-zA-Z0-9]{4,32}$';
+  readonly dateTimeFormat: string = SmpConstants.DATE_TIME_FORMAT;
 
   mode: UserDetailsDialogMode;
   editMode: boolean;
@@ -50,45 +51,32 @@ export class UserDetailsDialogComponent {
   current: UserRo;
   tempStoreForCertificate: CertificateRo = this.newCertificateRo();
   tempStoreForUser: UserRo = this.newUserRo();
-  newCertFile:File=null;
+  newCertFile: File = null;
+  userController: UserController;
 
-  private passwordConfirmationValidator: ValidatorFn = (control: FormGroup): ValidationErrors | null => {
-    const userToggle = control.get('userToggle');
-    const password = control.get('password');
-    const confirmation = control.get('confirmation');
-    return userToggle && password && confirmation && userToggle.value && password.value !== confirmation.value ? {confirmationMatch: true} : null;
-  };
-
-  private atLeastOneToggleCheckedValidator: ValidatorFn = (control: FormGroup): ValidationErrors | null => {
-    const userToggle = control.get('userToggle');
-    const certificateToggle = control.get('certificateToggle');
-    return userToggle && certificateToggle && !userToggle.value && !certificateToggle.value ? {userDetailsOrCertificateRequired: true} : null;
-  };
 
   private certificateValidator: ValidatorFn = (control: FormGroup): ValidationErrors | null => {
-    const certificateToggle = control.get('certificateToggle');
+    const certificateId = control.get('certificateId');
     const subject = control.get('subject');
     const validFrom = control.get('validFrom');
     const validTo = control.get('validTo');
     const issuer = control.get('issuer');
     const serialNumber = control.get('serialNumber');
-    return certificateToggle && subject && validFrom && validTo && issuer && serialNumber
-    && certificateToggle.value
+    return certificateId && subject && validFrom && validTo && issuer && serialNumber
+    && !!certificateId.value
     && !(subject.value && validFrom.value && validTo.value && issuer.value && serialNumber.value) ? {certificateDetailsRequired: true} : null;
   };
 
   private certificateExistValidator: ValidatorFn = (control: FormGroup): ValidationErrors | null => {
-    const certificateToggle = control.get('certificateToggle');
     const certificateId = control.get('certificateId');
     // get all persisted
     const listIds = this.lookups.cachedServiceGroupOwnerList.map(a => a.certificate ? a.certificate.certificateId : "NoId");
 
-    return certificateToggle && certificateId && certificateId.value
+    return  certificateId && certificateId.value
     && listIds.includes(certificateId.value) && this.current.certificate && certificateId.value !== this.current.certificate.certificateId ? {certificateIdExists: true} : null;
   };
 
 
-
   notInList(list: string[]) {
     return (c: AbstractControl): { [key: string]: any } => {
       if (c.value && list.includes(c.value.toString().toLowerCase())) {
@@ -100,13 +88,19 @@ export class UserDetailsDialogComponent {
 
 
   constructor(private dialogRef: MatDialogRef<UserDetailsDialogComponent>,
+              private dialog: MatDialog,
+              private http: HttpClient,
               private lookups: GlobalLookups,
               private certificateService: CertificateService,
               private userDetailsService: UserDetailsService,
               private alertService: AlertMessageService,
+              private securityService: SecurityService,
               private datePipe: DatePipe,
               @Inject(MAT_DIALOG_DATA) public data: any,
               private fb: FormBuilder) {
+
+    this.userController = new UserController(this.http, this.lookups, this.dialog);
+
     this.mode = data.mode;
     this.userId = data.row && data.row.userId;
     this.editMode = this.mode !== UserDetailsDialogMode.NEW_MODE;
@@ -115,14 +109,14 @@ export class UserDetailsDialogComponent {
       ? {
         ...data.row,
         password: '', // ensures the user password is cleared before editing
-        confirmation: '',
+        confirmation: null,
         certificate: data.row.certificate ? {...data.row.certificate} : this.newCertificateRo()
       } : {
         active: true,
         username: '',
         emailAddress: '',
         password: '',
-        confirmation: '',
+        confirmation: null,
         role: '',
         encodedValue: '',
         crlUrl: '',
@@ -150,18 +144,21 @@ export class UserDetailsDialogComponent {
         disabled: this.mode === UserDetailsDialogMode.PREFERENCES_MODE
       }, Validators.required),
       // username/password authentication
-      'userToggle': new FormControl(bUserPasswordAuthentication),
-      'passwordToggle': new FormControl({value: bSetPassword, disabled: !bUserPasswordAuthentication}),
+
+
       'username': new FormControl({value: '', disabled: this.editMode || !bUserPasswordAuthentication},
         !this.editMode || !this.current.username
           ? [Validators.nullValidator, Validators.pattern(this.usernamePattern), this.notInList(this.lookups.cachedServiceGroupOwnerList.map(a => a.username ? a.username.toLowerCase() : null))]
           : null),
-      // improve notInList validator
-      'password': new FormControl({value: '', disabled: !bUserPasswordAuthentication || !bSetPassword},
-        [Validators.required, Validators.pattern(this.passwordPattern)]),
-      'confirmation': new FormControl({value: ''}),
+      'passwordExpireOn': new FormControl({value: '', disabled: true}),
+      'accessTokenId': new FormControl({value: '', disabled: true}),
+
+      'accessTokenExpireOn': new FormControl({value: '', disabled: true}),
+      'casUserDataUrl': new FormControl({value: '', disabled: true}),
+
+
+      'confirmation': new FormControl({value: '', disabled: !bUserPasswordAuthentication || !bSetPassword}),
       // certificate authentication
-      'certificateToggle': new FormControl(this.current && this.current.certificate && !!this.current.certificate.certificateId),
       'subject': new FormControl({value: '', disabled: true}, Validators.required),
       'validFrom': new FormControl({value: '', disabled: true}, Validators.required),
       'validTo': new FormControl({value: '', disabled: true}, Validators.required),
@@ -173,8 +170,7 @@ export class UserDetailsDialogComponent {
       'isCertificateValid': new FormControl({value: 'true', disabled: true,}, [Validators.requiredTrue]
       ),
     }, {
-      validator: [this.passwordConfirmationValidator,
-        this.atLeastOneToggleCheckedValidator,
+      validator: [
         this.certificateValidator,
         this.certificateExistValidator,
       ]
@@ -185,7 +181,12 @@ export class UserDetailsDialogComponent {
     this.userForm.controls['role'].setValue(this.current.role);
     // username/password authentication
     this.userForm.controls['username'].setValue(this.current.username);
-    this.userForm.controls['password'].setValue(this.current.password);
+    this.userForm.controls['passwordExpireOn'].setValue(this.current.passwordExpireOn);
+    this.userForm.controls['accessTokenId'].setValue(this.current.accessTokenId);
+    this.userForm.controls['accessTokenExpireOn'].setValue(this.current.accessTokenExpireOn);
+
+    this.userForm.controls['casUserDataUrl'].setValue(this.current.casUserDataUrl);
+
     // certificate authentication
     this.userForm.controls['subject'].setValue(this.current.certificate.subject);
     this.userForm.controls['validFrom'].setValue(this.current.certificate.validFrom);
@@ -201,19 +202,85 @@ export class UserDetailsDialogComponent {
     this.certificateValidationMessage = this.current.certificate.invalidReason;
     this.isCertificateInvalid = this.current.certificate.invalid;
 
-    // if edit mode and user is given - toggle is disabled
-    // username should not be changed.!
-    if (this.editMode && bUserPasswordAuthentication) {
-      this.userForm.controls['userToggle'].disable();
-    }
   }
 
+  changeCurrentUserPassword() {
+    const formRef: MatDialogRef<any> = this.userController.changePasswordDialog({
+      data:{
+        user: this.getCurrent(),
+        adminUser: this.securityService.isCurrentUserSystemAdmin() &&
+          this.securityService.getCurrentUser().userId !== this.current.userId
+      },
+    });
+    formRef.afterClosed().subscribe(result => {
+      if (result) {
+        this.current.passwordExpireOn = result.passwordExpireOn;
+        this.userForm.controls['passwordExpireOn'].setValue(this.current.passwordExpireOn);
+      }
+    });
+
+  }
+
+  onShowCertificateDataRow() {
+    const formRef: MatDialogRef<any> = this.dialog.open(CertificateDialogComponent, {
+      data: {row:this.getCurrent().certificate}
+    });
+    formRef.afterClosed().subscribe(result => {
+      if (result) {
+        // import
+      }
+    });
+  }
+
+  clearCertificate(){
+    this.userForm.patchValue({
+      'subject': null,
+      'validFrom':null,
+      'validTo': null,
+      'issuer':null,
+      'serialNumber': null,
+      'certificateId': null,
+      'crlUrl': null,
+      'encodedValue': null,
+      'isCertificateValid': null,
+    });
+  }
+
+  openCurrentCasUserData() {
+    window.open(this.current.casUserDataUrl, "_blank");
+  }
+
+  regenerateAccessToken() {
+    const formRef: MatDialogRef<any> = this.userController.generateAccessTokenDialog({
+      data: {
+        user: this.getCurrent(),
+        adminUser: this.securityService.isCurrentUserSystemAdmin() &&
+          this.securityService.getCurrentUser().userId !== this.current.userId
+      },
+
+    });
+    formRef.afterClosed().subscribe(result => {
+      if (result) {
+        let user = {...formRef.componentInstance.getCurrent()};
+        // update value for current user
+        this.current.accessTokenId = user.accessTokenId
+        this.current.accessTokenExpireOn = user.accessTokenExpireOn
+        // set form data
+        this.userForm.controls['accessTokenId'].setValue(user.accessTokenId);
+        this.userForm.controls['accessTokenExpireOn'].setValue(user.accessTokenExpireOn);
+
+        this.lookups.refreshUserLookup();
+      }
+    });
+  }
+
+
   submitForm() {
     this.dialogRef.close(true);
   }
 
   uploadCertificate(event) {
-    this.newCertFile=null;
+    this.newCertFile = null;
     const file = event.target.files[0];
     this.certificateService.validateCertificate(file).subscribe((res: CertificateRo) => {
         if (res && res.certificateId) {
@@ -230,7 +297,7 @@ export class UserDetailsDialogComponent {
           });
           this.certificateValidationMessage = res.invalidReason;
           this.isCertificateInvalid = res.invalid;
-          this.newCertFile=file;
+          this.newCertFile = file;
         } else {
           this.alertService.exception("Error occurred while reading certificate.", "Check if uploaded file has valid certificate type.", false);
         }
@@ -242,79 +309,7 @@ export class UserDetailsDialogComponent {
 
   }
 
-  onCertificateToggleChanged({checked}: MatSlideToggleChange) {
-    if (checked) {
-      // fill from temp
-      this.userForm.controls['certificateId'].setValue(this.tempStoreForCertificate.certificateId);
-      this.userForm.controls['subject'].setValue(this.tempStoreForCertificate.subject);
-      this.userForm.controls['issuer'].setValue(this.tempStoreForCertificate.issuer);
-      this.userForm.controls['serialNumber'].setValue(this.tempStoreForCertificate.serialNumber);
-      this.userForm.controls['validFrom'].setValue(this.tempStoreForCertificate.validFrom);
-      this.userForm.controls['validFrom'].setValue(this.tempStoreForCertificate.validFrom);
-      this.userForm.controls['validTo'].setValue(this.tempStoreForCertificate.validTo);
-      this.userForm.controls['encodedValue'].setValue(this.tempStoreForCertificate.encodedValue);
-      this.userForm.controls['crlUrl'].setValue(this.tempStoreForCertificate.crlUrl);
-      this.certificateValidationMessage = this.tempStoreForCertificate.invalidReason;
-      this.isCertificateInvalid = this.tempStoreForCertificate.invalid;
-
-    } else {
-      // store data to temp, set values to null
-      this.tempStoreForCertificate.certificateId = this.userForm.controls['certificateId'].value;
-      this.tempStoreForCertificate.subject = this.userForm.controls['subject'].value;
-      this.tempStoreForCertificate.issuer = this.userForm.controls['issuer'].value;
-      this.tempStoreForCertificate.serialNumber = this.userForm.controls['serialNumber'].value;
-      this.tempStoreForCertificate.validFrom = this.userForm.controls['validFrom'].value;
-      this.tempStoreForCertificate.validTo = this.userForm.controls['validTo'].value;
-      this.tempStoreForCertificate.encodedValue = this.userForm.controls['encodedValue'].value;
-      this.tempStoreForCertificate.crlUrl = this.userForm.controls['crlUrl'].value;
-
-      this.tempStoreForCertificate.invalidReason = this.certificateValidationMessage;
-      this.tempStoreForCertificate.invalid = this.isCertificateInvalid;
-
-      this.userForm.controls['certificateId'].setValue("");
-      this.userForm.controls['subject'].setValue("");
-      this.userForm.controls['issuer'].setValue("");
-      this.userForm.controls['serialNumber'].setValue("");
-      this.userForm.controls['validFrom'].setValue("");
-      this.userForm.controls['validTo'].setValue("");
-      this.userForm.controls['crlUrl'].setValue("");
-      this.userForm.controls['encodedValue'].setValue("");
-      this.userForm.controls['isCertificateValid'].setValue("true");
-
-      this.certificateValidationMessage = null;
-      this.isCertificateInvalid = false;
-    }
-  }
 
-  onUserToggleChanged({checked}: MatSlideToggleChange) {
-    const action = checked ? 'enable' : 'disable';
-    this.userForm.get('username')[action]();
-    this.userForm.get('password')[action]();
-    this.userForm.get('confirmation')[action]();
-
-    if (checked) {
-      this.userForm.controls['username'].setValue(this.tempStoreForUser.username);
-      this.userForm.controls['password'].setValue(this.tempStoreForUser.password);
-    } else {
-      // store data to temp, set values to null
-      this.tempStoreForUser.username = this.userForm.controls['username'].value;
-      this.tempStoreForUser.password = this.userForm.controls['password'].value;
-
-      this.userForm.controls['username'].setValue("");
-      this.userForm.controls['password'].setValue("");
-    }
-    this.userForm.controls['passwordToggle'].setValue(checked || !this.editMode);
-  }
-
-  onPasswordToggleChanged({checked}: MatSlideToggleChange) {
-    const action = checked ? 'enable' : 'disable';
-    this.userForm.get('password')[action]();
-    this.userForm.get('confirmation')[action]();
-    if (!checked) {
-      this.userForm.get('password').setValue('');
-      this.userForm.get('confirmation').setValue('');
-    }
-  }
 
   isPreferencesMode() {
     return this.mode === UserDetailsDialogMode.PREFERENCES_MODE;
@@ -325,7 +320,7 @@ export class UserDetailsDialogComponent {
     this.current.emailAddress = this.userForm.get('emailAddress').value;
     this.current.role = this.userForm.get('role').value;
     // certificate data
-    if (this.userForm.get('certificateToggle')) {
+    if (this.userForm.controls['certificateId'].value) {
       this.current.certificate.certificateId = this.userForm.controls['certificateId'].value;
       this.current.certificate.subject = this.userForm.controls['subject'].value;
       this.current.certificate.issuer = this.userForm.controls['issuer'].value;
@@ -339,20 +334,7 @@ export class UserDetailsDialogComponent {
     } else {
       this.current.certificate = null;
     }
-    // set username and password for new
-    if (this.userForm.get('userToggle')) {
-      if (!this.editMode || !this.current.username) {
-        this.current.username = this.userForm.controls['username'].value;
-        this.current.password = this.userForm.controls['password'].value;
-      }
-      // if edit mode and password on  - set password
-      else if (this.editMode && this.userForm.get('passwordToggle')) {
-        this.current.password = this.userForm.controls['password'].value;
-      }
-    } else {
-      this.current.username = '';
-      this.current.password = '';
-    }
+
 
     // update data
     return this.current;
@@ -395,6 +377,7 @@ export class UserDetailsDialogComponent {
       statusPassword: SearchTableEntityStatus.NEW
     }
   }
+
 }
 
 export enum UserDetailsDialogMode {
diff --git a/smp-angular/src/app/user/user-details-dialog/user-details.service.ts b/smp-angular/src/app/user/user-details-dialog/user-details.service.ts
index a174d6c67..a65074ec6 100644
--- a/smp-angular/src/app/user/user-details-dialog/user-details.service.ts
+++ b/smp-angular/src/app/user/user-details-dialog/user-details.service.ts
@@ -2,8 +2,9 @@ import {Injectable} from "@angular/core";
 import {HttpClient} from "@angular/common/http";
 import {SmpConstants} from "../../smp.constants";
 import {Observable} from "rxjs";
-import {AccessTokenRo} from "../../common/access-token-generation-dialog/access-token-ro.model";
+import {AccessTokenRo} from "../../common/dialogs/access-token-generation-dialog/access-token-ro.model";
 import {AlertMessageService} from "../../common/alert-message/alert-message.service";
+import {UserRo} from "../user-ro.model";
 
 @Injectable()
 export class UserDetailsService {
@@ -20,19 +21,39 @@ export class UserDetailsService {
    * @param password
    */
   changePassword(userId: string, newPassword: string, currentPassword: string): Observable<boolean> {
-    return this.http.put<boolean>(SmpConstants.REST_PUBLIC_USER_CHANGE_PASSWORD.replace('{user-id}', userId),
+    return this.http.put<boolean>(SmpConstants.REST_PUBLIC_USER_CHANGE_PASSWORD
+        .replace(SmpConstants.PATH_PARAM_ENC_USER_ID, userId),
       {
           currentPassword:currentPassword,
           newPassword:newPassword
       });
   }
 
+  changePasswordAdmin(userId: string,  updateUserId: string, newPassword: string, currentPassword: string): Observable<UserRo> {
+    return this.http.put<UserRo>(SmpConstants.REST_INTERNAL_USER_CHANGE_PASSWORD
+        .replace(SmpConstants.PATH_PARAM_ENC_USER_ID, userId)
+        .replace(SmpConstants.PATH_PARAM_ENC_MANAGED_USER_ID, updateUserId),
+      {
+        currentPassword:currentPassword,
+        newPassword:newPassword
+      });
+  }
+
+  REST_INTERNAL_USER_CHANGE_PASSWORD
+
   /**
    * Submit request to regenerated request token!
    * @param userId
    * @param password - password to authenticate user before regenerating the access token.
    */
   regenerateAccessToken(userId: string, password: string): Observable<AccessTokenRo> {
-    return this.http.post<AccessTokenRo>(SmpConstants.REST_PUBLIC_USER_GENERATE_ACCESS_TOKEN.replace('{user-id}', userId), password)
+    return this.http.post<AccessTokenRo>(SmpConstants.REST_PUBLIC_USER_GENERATE_ACCESS_TOKEN
+      .replace(SmpConstants.PATH_PARAM_ENC_USER_ID, userId), password)
+  }
+
+  regenerateAccessTokenAdmin(userId: string, password: string, updateUserId: string): Observable<AccessTokenRo> {
+    return this.http.post<AccessTokenRo>(SmpConstants.REST_INTERNAL_USER_GENERATE_ACCESS_TOKEN
+      .replace(SmpConstants.PATH_PARAM_ENC_USER_ID, userId)
+      .replace(SmpConstants.PATH_PARAM_ENC_MANAGED_USER_ID, updateUserId), password)
   }
 }
diff --git a/smp-angular/src/app/user/user-ro.model.ts b/smp-angular/src/app/user/user-ro.model.ts
index f563314cf..4ac8043a4 100644
--- a/smp-angular/src/app/user/user-ro.model.ts
+++ b/smp-angular/src/app/user/user-ro.model.ts
@@ -5,11 +5,13 @@ export interface UserRo extends SearchTableEntity {
   userId?: string
   username: string;
   emailAddress: string;
-  password?: string;
   accessTokenId?: string;
+  passwordExpireOn?:	Date;
+  accessTokenExpireOn?:	Date;
   role: string;
   active: boolean;
   suspended?: boolean;
   certificate?: CertificateRo;
   statusPassword: number;
+  casUserDataUrl?: string;
 }
diff --git a/smp-angular/src/app/user/user.service.ts b/smp-angular/src/app/user/user.service.ts
index eb3135ea9..2de88b322 100644
--- a/smp-angular/src/app/user/user.service.ts
+++ b/smp-angular/src/app/user/user.service.ts
@@ -6,7 +6,7 @@ import {SmpConstants} from "../smp.constants";
 import {User} from "../security/user.model";
 import {AlertMessageService} from "../common/alert-message/alert-message.service";
 import {SecurityService} from "../security/security.service";
-import {AccessTokenRo} from "../common/access-token-generation-dialog/access-token-ro.model";
+import {AccessTokenRo} from "../common/dialogs/access-token-generation-dialog/access-token-ro.model";
 
 @Injectable()
 export class UserService {
diff --git a/smp-angular/src/styles.css b/smp-angular/src/styles.css
index 456babe0c..2101a908a 100644
--- a/smp-angular/src/styles.css
+++ b/smp-angular/src/styles.css
@@ -74,6 +74,7 @@ ngx-datatable span:before {
 .ngx-datatable span {
   word-wrap: break-word;
 }
+
 .buttonsRow {
   display: flex;
   justify-content: flex-end;
@@ -82,6 +83,44 @@ ngx-datatable span:before {
   padding: 5px;
   background: #FFF;
   box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 2px 0 rgba(0, 0, 0, 0.24);
+
+}
+.mat-dialog-title {
+  margin: 0px -24px 1em -24px !important;
+  padding: 0 24px !important;
+  background-color: #2a2a72;
+  background-image: linear-gradient(315deg, #009ffd 0%,  #2a2a72 74%);
+  color: white;
+}
+
+.mat-dialog-container{
+  padding: 0 24px !important;
+}
+.mat-dialog-actions {
+  padding: 0 23px !important;
+  justify-content: flex-end;
+  width: 100%;
+  border: gray outset 1px;
+  background-color: #c4e1f8;
+  min-heigh: 5px !important;
+  margin: 18px  -24px 0 -24px !important;
+}
+
+.required-fields {
+  text-align: left;
+  font-size: 65%;
+  margin: 0 3px;
+}
+
+.mat-toolbar-multiple-rows {
+  height: unset !important;
+  min-height: 32px !important;
+  padding: 5px;
+}
+.mat-toolbar-row {
+  padding:unset !important;
+  height: unset !important;
+  min-height: 32px !important;
 }
 
 /*--------------------------------------------------
@@ -354,3 +393,4 @@ mat-card {
 .alert-message-close-button:hover {
   color: black;
 }
+
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/AccessTokenRO.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/AccessTokenRO.java
index dc0610a48..c85e2bbfd 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/AccessTokenRO.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/AccessTokenRO.java
@@ -1,8 +1,5 @@
 package eu.europa.ec.edelivery.smp.data.ui;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-import eu.europa.ec.edelivery.smp.utils.SMPConstants;
-
 import java.io.Serializable;
 import java.time.OffsetDateTime;
 
@@ -12,9 +9,7 @@ public class AccessTokenRO implements Serializable {
 
     private String identifier;
     private String value;
-    @JsonFormat(pattern = SMPConstants.JSON_DATETIME_ISO)
     OffsetDateTime generatedOn;
-    @JsonFormat(pattern = SMPConstants.JSON_DATETIME_ISO)
     OffsetDateTime expireOn;
 
     public String getIdentifier() {
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/CertificateRO.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/CertificateRO.java
index 21286cd02..19a7af6f1 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/CertificateRO.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/CertificateRO.java
@@ -1,8 +1,5 @@
 package eu.europa.ec.edelivery.smp.data.ui;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-import eu.europa.ec.edelivery.smp.utils.SMPConstants;
-
 import java.util.Date;
 
 /**
@@ -23,11 +20,7 @@ public class CertificateRO extends BaseRO {
     private String clientCertHeader;
     private boolean isInvalid;
     private String invalidReason;
-
-
-    @JsonFormat(pattern = SMPConstants.JSON_DATETIME_ISO)
     private Date validFrom;
-    @JsonFormat(pattern = SMPConstants.JSON_DATETIME_ISO)
     private Date validTo;
 
     public CertificateRO() {
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/UserRO.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/UserRO.java
index f5be11549..686969d0a 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/UserRO.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/UserRO.java
@@ -1,10 +1,7 @@
 package eu.europa.ec.edelivery.smp.data.ui;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import eu.europa.ec.edelivery.smp.data.ui.auth.SMPAuthority;
 import eu.europa.ec.edelivery.smp.data.ui.enums.EntityROStatus;
-import eu.europa.ec.edelivery.smp.utils.SMPConstants;
 
 import java.time.OffsetDateTime;
 import java.util.Collection;
@@ -20,10 +17,8 @@ public class UserRO extends BaseRO {
 
     String username;
     String password;
-    @JsonFormat(pattern = SMPConstants.JSON_DATETIME_ISO)
     OffsetDateTime passwordExpireOn;
     String accessTokenId;
-    @JsonFormat(pattern = SMPConstants.JSON_DATETIME_ISO)
     OffsetDateTime accessTokenExpireOn;
     String emailAddress;
     Collection<SMPAuthority> authorities;
@@ -33,10 +28,12 @@ public class UserRO extends BaseRO {
     CertificateRO certificate;
     int statusPassword = EntityROStatus.PERSISTED.getStatusNumber();
     boolean passwordExpired = false;
-    boolean showPasswordExpirationWarning  = false;
-    boolean forceChangeExpiredPassword =false;
+    boolean showPasswordExpirationWarning = false;
+    boolean forceChangeExpiredPassword = false;
     boolean casAuthenticated = false;
 
+    String casUserDataUrl;
+
     /**
      * Get DB user hash value. It can be used as unique ID for the user. Use hash value for the webservice/ui and do not
      * expose internal database user identity
@@ -163,6 +160,14 @@ public class UserRO extends BaseRO {
         this.forceChangeExpiredPassword = forceChangeExpiredPassword;
     }
 
+    public String getCasUserDataUrl() {
+        return casUserDataUrl;
+    }
+
+    public void setCasUserDataUrl(String casUserDataUrl) {
+        this.casUserDataUrl = casUserDataUrl;
+    }
+
     public boolean isCasAuthenticated() {
         return casAuthenticated;
     }
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/enums/SMPPropertyEnum.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/enums/SMPPropertyEnum.java
index bc44cc485..02cafc84c 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/enums/SMPPropertyEnum.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/ui/enums/SMPPropertyEnum.java
@@ -110,10 +110,11 @@ public enum SMPPropertyEnum {
     // SSO configuration
     SSO_CAS_UI_LABEL("smp.sso.cas.ui.label", "EU Login", "The SSO service provider label.", false, false, true, STRING),
     SSO_CAS_URL("smp.sso.cas.url", "http://localhost:8080/cas/", "The SSO CAS URL endpoint", false, false, true, URL),
-    SSO_CAS_URLPATH_LOGIN("smp.sso.cas.urlpath.login", "login", "The CAS URL path for login. Complete URL is composed from parameters: ${smp.sso.cas.url}/${smp.sso.cas.urlpath.login}.", false, false, true, STRING),
+    SSO_CAS_URL_PATH_LOGIN("smp.sso.cas.urlPath.login", "login", "The CAS URL path for login. Complete URL is composed from parameters: ${smp.sso.cas.url}/${smp.sso.cas.urlpath.login}.", false, false, true, STRING),
     SSO_CAS_CALLBACK_URL("smp.sso.cas.callback.url", "http://localhost:8080/smp/ui/public/rest/security/cas", "The URL is the callback URL belonging to the local SMP Security System. If using RP make sure it target SMP path '/ui/public/rest/security/cas'", false, false, true, URL),
-    SSO_CAS_SMP_LOGIN_URI("smp.sso.cas.smp.uri", "/smp/ui/public/rest/security/cas", "SMP relative path which triggers CAS authentication", false, false, true, STRING),
-    SSO_CAS_TOKEN_VALIDATION_URLPATH("smp.sso.cas.token.validation.urlpath", "laxValidate", "The CAS URL path for login. Complete URL is composed from parameters: ${smp.sso.cas.url}/${smp.sso.cas.urlpath}.", false, false, true, STRING),
+    SSO_CAS_SMP_LOGIN_URI("smp.sso.cas.smp.urlPath", "/smp/ui/public/rest/security/cas", "SMP relative path which triggers CAS authentication", false, false, true, STRING),
+    SSO_CAS_SMP_USER_DATA_URL_PATH("smp.sso.cas.smp.user.data.urlPath", "userdata/myAccount.cgi", "Relative path for CAS user data. Complete URL is composed from parameters: ${smp.sso.cas.url}/${smp.sso.cas.smp.user.data.urlpath}.", false, false, true, STRING),
+    SSO_CAS_TOKEN_VALIDATION_URL_PATH("smp.sso.cas.token.validation.urlPath", "laxValidate", "The CAS URL path for login. Complete URL is composed from parameters: ${smp.sso.cas.url}/${smp.sso.cas.token.validation.urlpath}.", false, false, true, STRING),
     SSO_CAS_TOKEN_VALIDATION_PARAMS("smp.sso.cas.token.validation.params", "acceptStrengths:BASIC,CLIENT_CERT|assuranceLevel:TOP", "The CAS token validation key:value properties separated with '|'.Ex: 'acceptStrengths:BASIC,CLIENT_CERT|assuranceLevel:TOP'", false, false, true, MAP_STRING),
     SSO_CAS_TOKEN_VALIDATION_GROUPS("smp.sso.cas.token.validation.groups", "DIGIT_SMP|DIGIT_ADMIN", "'|' separated CAS groups user must belong to.", false, false, true, LIST_STRING),
 
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ConfigurationService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ConfigurationService.java
index c923ac990..59cfdf3f0 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ConfigurationService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ConfigurationService.java
@@ -9,9 +9,13 @@ import eu.europa.ec.edelivery.smp.data.ui.enums.SMPPropertyEnum;
 import eu.europa.ec.edelivery.smp.logging.SMPLogger;
 import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -303,13 +307,34 @@ public class ConfigurationService {
     }
 
     public String getCasURLPathLogin() {
-        return (String) configurationDAO.getCachedPropertyValue(SSO_CAS_URLPATH_LOGIN);
+        return (String) configurationDAO.getCachedPropertyValue(SSO_CAS_URL_PATH_LOGIN);
     }
 
     public String getCasURLTokenValidation() {
-        return (String) configurationDAO.getCachedPropertyValue(SSO_CAS_TOKEN_VALIDATION_URLPATH);
+        return (String) configurationDAO.getCachedPropertyValue(SSO_CAS_TOKEN_VALIDATION_URL_PATH);
+    }
+    public URL getCasUserDataURL() {
+        URL casUrl = getCasURL();
+        if (casUrl == null) {
+            LOG.warn("Invalid CAS configuration [{}]. Can not resolve user data URL!", SSO_CAS_URL.getProperty());
+            return null;
+        }
+        String path = (String) configurationDAO.getCachedPropertyValue(SSO_CAS_SMP_USER_DATA_URL_PATH);
+        if (StringUtils.isBlank(path)) {
+            LOG.warn("Invalid CAS configuration [{}]. Can not resolve user data URL!", SSO_CAS_SMP_USER_DATA_URL_PATH.getProperty());
+            return null;
+        }
+        try {
+            return casUrl.toURI().resolve(path).toURL();
+        } catch (MalformedURLException | URISyntaxException e) {
+            LOG.warn("Invalid CAS configuration [{}]. Can not resolve user data URL! Error: [{}]",
+                    SSO_CAS_SMP_USER_DATA_URL_PATH.getProperty(),
+                    ExceptionUtils.getRootCauseMessage(e));
+        }
+        return null;
     }
 
+
     public Map<String, String> getCasTokenValidationParams() {
         return (Map<String, String>) configurationDAO.getCachedPropertyValue(SSO_CAS_TOKEN_VALIDATION_PARAMS);
     }
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIUserService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIUserService.java
index 29debdc14..d8ab8f2a1 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIUserService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIUserService.java
@@ -102,28 +102,37 @@ public class UIUserService extends UIServiceBase<DBUser, UserRO> {
      * Method regenerate access token for user and returns access token
      * In the database the access token value is saved in format BCryptPasswordHash
      *
-     * @param userId
+     * @param authorizedUserId which is authorized for update
+     * @param userToUpdateId   the user id to be updated
      * @return generated AccessToken.
      */
     @Transactional
-    public AccessTokenRO generateAccessTokenForUser(Long userId, String currentPassword) {
+    public AccessTokenRO generateAccessTokenForUser(Long authorizedUserId, Long userToUpdateId, String currentPassword) {
 
-        DBUser dbUser = userDao.find(userId);
+        DBUser dbUser = userDao.find(authorizedUserId);
         if (dbUser == null) {
-            LOG.error("Can not update user password because user for id [{}] does not exist!", userId);
+            LOG.error("Can not update user password because authorized user with id [{}] does not exist!", authorizedUserId);
             throw new SMPRuntimeException(ErrorCode.INVALID_REQUEST, "UserId", "Can not find user id!");
         }
         if (!BCrypt.checkpw(currentPassword, dbUser.getPassword())) {
             throw new BadCredentialsException("Password change failed; Invalid current password!");
         }
+
+        DBUser dbUserToUpdate = userToUpdateId == null || authorizedUserId == userToUpdateId
+                ? dbUser : userDao.find(userToUpdateId);
+        if (dbUserToUpdate == null) {
+            LOG.error("Can not update user access token because user for with [{}] does not exist!", userToUpdateId);
+            throw new SMPRuntimeException(ErrorCode.INVALID_REQUEST, "UserId", "Can not find user id to update!");
+        }
+
         Boolean testMode = configurationService.isSMPStartupInDevMode();
         AccessTokenRO token = SecurityUtils.generateAccessToken(testMode);
         OffsetDateTime generatedTime = token.getGeneratedOn();
         token.setExpireOn(generatedTime.plusDays(configurationService.getAccessTokenPolicyValidDays()));
-        dbUser.setAccessTokenIdentifier(token.getIdentifier());
-        dbUser.setAccessToken(BCryptPasswordHash.hashPassword(token.getValue()));
-        dbUser.setAccessTokenGeneratedOn(generatedTime);
-        dbUser.setAccessTokenExpireOn(token.getExpireOn());
+        dbUserToUpdate.setAccessTokenIdentifier(token.getIdentifier());
+        dbUserToUpdate.setAccessToken(BCryptPasswordHash.hashPassword(token.getValue()));
+        dbUserToUpdate.setAccessTokenGeneratedOn(generatedTime);
+        dbUserToUpdate.setAccessTokenExpireOn(token.getExpireOn());
 
         return token;
     }
@@ -132,30 +141,39 @@ public class UIUserService extends UIServiceBase<DBUser, UserRO> {
      * Method regenerate access token for user and returns access token
      * In the database the access token value is saved in format BCryptPasswordHash
      *
-     * @param userId
+     * @param authorizedUserId - authorized user id
      * @return generated AccessToken.
      */
     @Transactional
-    public boolean updateUserPassword(Long userId, String currentPassword, String newPassword) {
+    public DBUser updateUserPassword(Long authorizedUserId, Long userToUpdateId, String currentPassword, String newPassword) {
 
         Pattern pattern = configurationService.getPasswordPolicyRexExp();
         if (!pattern.matcher(newPassword).matches()) {
             throw new SMPRuntimeException(ErrorCode.INVALID_REQUEST, "PasswordChange", configurationService.getPasswordPolicyValidationMessage());
         }
-        DBUser dbUser = userDao.find(userId);
-        if (dbUser == null) {
-            LOG.error("Can not update user password because user for id [{}] does not exist!", userId);
+        DBUser dbAuthorizedUser = userDao.find(authorizedUserId);
+        if (dbAuthorizedUser == null) {
+            LOG.error("Can not update user password because user for id [{}] does not exist!", authorizedUserId);
             throw new SMPRuntimeException(ErrorCode.INVALID_REQUEST, "UserId", "Can not find user id!");
         }
 
-        if (!BCrypt.checkpw(currentPassword, dbUser.getPassword())) {
+        if (!BCrypt.checkpw(currentPassword, dbAuthorizedUser.getPassword())) {
             throw new BadCredentialsException("Password change failed; Invalid current password!");
         }
-        dbUser.setPassword(BCryptPasswordHash.hashPassword(newPassword));
+
+        DBUser dbUserToUpdate = userToUpdateId == null || authorizedUserId == userToUpdateId
+                ? dbAuthorizedUser : userDao.find(userToUpdateId);
+
+        if (dbUserToUpdate == null) {
+            LOG.error("Can not update user password because user for with [{}] does not exist!", userToUpdateId);
+            throw new SMPRuntimeException(ErrorCode.INVALID_REQUEST, "UserId", "Can not find user id to update!");
+        }
+
+        dbUserToUpdate.setPassword(BCryptPasswordHash.hashPassword(newPassword));
         OffsetDateTime currentTime = OffsetDateTime.now();
-        dbUser.setPasswordChanged(currentTime);
-        dbUser.setPasswordExpireOn(currentTime.plusDays(configurationService.getPasswordPolicyValidDays()));
-        return true;
+        dbUserToUpdate.setPasswordChanged(currentTime);
+        dbUserToUpdate.setPasswordExpireOn(currentTime.plusDays(configurationService.getPasswordPolicyValidDays()));
+        return dbUserToUpdate;
     }
 
     @Transactional
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/utils/SMPConstants.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/utils/SMPConstants.java
deleted file mode 100644
index df009bc23..000000000
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/utils/SMPConstants.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package eu.europa.ec.edelivery.smp.utils;
-
-public class SMPConstants {
-    public static final String JSON_DATETIME_ISO="yyyy-MM-dd'T'HH:mm:ss";
-}
-
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ConfigurationServiceAllGetMethodsTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ConfigurationServiceAllGetMethodsTest.java
index 0cafecf10..7b250d995 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ConfigurationServiceAllGetMethodsTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ConfigurationServiceAllGetMethodsTest.java
@@ -1,7 +1,6 @@
 package eu.europa.ec.edelivery.smp.services;
 
 import eu.europa.ec.edelivery.smp.data.dao.ConfigurationDao;
-import eu.europa.ec.edelivery.smp.data.ui.enums.AlertLevelEnum;
 import eu.europa.ec.edelivery.smp.data.ui.enums.SMPPropertyEnum;
 import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.commons.lang3.reflect.MethodUtils;
@@ -100,9 +99,9 @@ public class ConfigurationServiceAllGetMethodsTest {
                 {AUTOMATION_AUTHENTICATION_TYPES, TEST_STRING_LIST, "getAutomationAuthenticationTypes", true},
                 {SSO_CAS_UI_LABEL, TEST_STRING, "getCasUILabel", true},
                 {SSO_CAS_URL, TEST_URL, "getCasURL", true},
-                {SSO_CAS_URLPATH_LOGIN, TEST_STRING, "getCasURLPathLogin", true},
+                {SSO_CAS_URL_PATH_LOGIN, TEST_STRING, "getCasURLPathLogin", true},
                 {SSO_CAS_CALLBACK_URL, TEST_URL, "getCasCallbackUrl", true},
-                {SSO_CAS_TOKEN_VALIDATION_URLPATH, TEST_STRING, "getCasURLTokenValidation", true},
+                {SSO_CAS_TOKEN_VALIDATION_URL_PATH, TEST_STRING, "getCasURLTokenValidation", true},
                 {SSO_CAS_TOKEN_VALIDATION_PARAMS, TEST_MAP, "getCasTokenValidationParams", true},
                 {SSO_CAS_TOKEN_VALIDATION_GROUPS, TEST_STRING_LIST, "getCasURLTokenValidationGroups", true},
                 {PARTC_EBCOREPARTYID_CONCATENATE, Boolean.FALSE, "getForceConcatenateEBCorePartyId", true},
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIUserServiceIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIUserServiceIntegrationTest.java
index 4ff730c83..c6d61ec30 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIUserServiceIntegrationTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ui/UIUserServiceIntegrationTest.java
@@ -41,7 +41,6 @@ public class UIUserServiceIntegrationTest extends AbstractServiceIntegrationTest
     protected UIUserService testInstance;
 
 
-
     protected void insertDataObjects(int size) {
         for (int i = 0; i < size; i++) {
             DBUser d = TestDBUtils.createDBUserByUsername("user" + i);
@@ -275,7 +274,7 @@ public class UIUserServiceIntegrationTest extends AbstractServiceIntegrationTest
     @Test
     @Transactional
     public void testGenerateAccessTokenForUser() {
-        String userPassword=UUID.randomUUID().toString();
+        String userPassword = UUID.randomUUID().toString();
         DBUser user = new DBUser();
         user.setPassword(BCrypt.hashpw(userPassword, BCrypt.gensalt()));
         user.setUsername(UUID.randomUUID().toString());
@@ -284,7 +283,7 @@ public class UIUserServiceIntegrationTest extends AbstractServiceIntegrationTest
         userDao.persistFlushDetach(user);
 
 
-        AccessTokenRO token = testInstance.generateAccessTokenForUser(user.getId(), userPassword);
+        AccessTokenRO token = testInstance.generateAccessTokenForUser(user.getId(), user.getId(), userPassword);
 
         Optional<DBUser> optResult = userDao.findUserByAuthenticationToken(token.getIdentifier());
         assertTrue(optResult.isPresent());
diff --git a/smp-soapui-tests/groovy/mysql-4.1_integration_test_data.sql b/smp-soapui-tests/groovy/mysql-4.1_integration_test_data.sql
index 669cadf52..b789020d4 100644
--- a/smp-soapui-tests/groovy/mysql-4.1_integration_test_data.sql
+++ b/smp-soapui-tests/groovy/mysql-4.1_integration_test_data.sql
@@ -5,7 +5,7 @@ insert into SMP_USER (ID, EMAIL, USERNAME, PASSWORD, ACCESS_TOKEN_ID, ACCESS_TOK
 insert into SMP_USER (ID, EMAIL, USERNAME, PASSWORD, ACCESS_TOKEN_ID, ACCESS_TOKEN, ROLE, ACTIVE, CREATED_ON, LAST_UPDATED_ON) values (5, 'test@test-mail.eu','test', '','test', '',  'SMP_ADMIN', 1, NOW(), NOW());
 insert into SMP_USER (ID, EMAIL, USERNAME, PASSWORD, ACCESS_TOKEN_ID, ACCESS_TOKEN, ROLE, ACTIVE, CREATED_ON, LAST_UPDATED_ON) values (6, 'test1@test-mail.eu','test1', '$2a$06$toKXJgjqQINZdjQqSao3NeWz2n1S64PFPhVU1e8gIHh4xdbwzy1Uy','test1', '$2a$06$toKXJgjqQINZdjQqSao3NeWz2n1S64PFPhVU1e8gIHh4xdbwzy1Uy', 'SMP_ADMIN', 1, NOW(), NOW());
 insert into SMP_USER (ID, EMAIL, USERNAME, PASSWORD, ACCESS_TOKEN_ID, ACCESS_TOKEN, ROLE, ACTIVE, CREATED_ON, LAST_UPDATED_ON) values (7, 'system@test-mail.eu','system', '$2a$06$FDmjewn/do3C219uysNm9.XG8mIn.ubHnMydAzC8lsv61HsRpOR36','system', '$2a$06$FDmjewn/do3C219uysNm9.XG8mIn.ubHnMydAzC8lsv61HsRpOR36', 'SYSTEM_ADMIN', 1, NOW(), NOW());
-insert into SMP_USER (ID, EMAIL, USERNAME, PASSWORD, ACCESS_TOKEN_ID, ACCESS_TOKEN, ROLE, ACTIVE, CREATED_ON, LAST_UPDATED_ON) values (8, 'smp@test-mail.eu','smp', '$2a$06$FDmjewn/do3C219uysNm9.XG8mIn.ubHnMydAzC8lsv61HsRpOR36','smp', '$2a$06$FDmjewn/do3C219uysNm9.XG8mIn.ubHnMydAzC8lsv61HsRpOR36', 'SMP_ADMIN', 1, NOW(), NOW());
+insert into SMP_USER (ID, EMAIL, USERNAME, PASSWORD, ACCESS_TOKEN_ID, ACCESS_TOKEN, ROLE, ACTIVE, CREATED_ON, LAST_UPDATED_ON) values (8, null,'smp', '$2a$06$FDmjewn/do3C219uysNm9.XG8mIn.ubHnMydAzC8lsv61HsRpOR36','smp', '$2a$06$FDmjewn/do3C219uysNm9.XG8mIn.ubHnMydAzC8lsv61HsRpOR36', 'SMP_ADMIN', 1, NOW(), NOW());
 insert into SMP_USER (ID, EMAIL, USERNAME, PASSWORD, ACCESS_TOKEN_ID, ACCESS_TOKEN, ROLE, ACTIVE, CREATED_ON, LAST_UPDATED_ON) values (9, 'user@test-mail.eu','user', '$2a$06$FDmjewn/do3C219uysNm9.XG8mIn.ubHnMydAzC8lsv61HsRpOR36','user', '$2a$06$FDmjewn/do3C219uysNm9.XG8mIn.ubHnMydAzC8lsv61HsRpOR36', 'SERVICE_GROUP_ADMIN', 1, NOW(), NOW());
 
 
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationService.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationService.java
index 3620970e1..aa8f00fd8 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationService.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationService.java
@@ -1,5 +1,6 @@
 package eu.europa.ec.edelivery.smp.auth;
 
+import eu.europa.ec.edelivery.smp.auth.enums.SMPUserAuthenticationTypes;
 import eu.europa.ec.edelivery.smp.data.dao.UserDao;
 import eu.europa.ec.edelivery.smp.data.model.DBUser;
 import eu.europa.ec.edelivery.smp.data.ui.UserRO;
@@ -18,6 +19,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.web.authentication.session.SessionAuthenticationException;
 import org.springframework.stereotype.Service;
 
+import java.net.URL;
 import java.time.OffsetDateTime;
 import java.util.stream.Collectors;
 
@@ -43,7 +45,7 @@ public class SMPAuthorizationService {
                                    UserDao userDao) {
         this.serviceGroupService = serviceGroupService;
         this.conversionService = conversionService;
-        this.configurationService=configurationService;
+        this.configurationService = configurationService;
         this.userDao = userDao;
     }
 
@@ -123,7 +125,7 @@ public class SMPAuthorizationService {
     public UserRO getLoggedUserData() {
         SMPUserDetails userDetails = getAndValidateUserDetails();
         // refresh data from database!
-        DBUser dbUser =userDao.find(userDetails.getUser().getId());
+        DBUser dbUser = userDao.find(userDetails.getUser().getId());
         if (dbUser == null || !dbUser.isActive()) {
             LOG.warn("User: [{}] with id [{}] does not exists anymore or is not active.",
                     userDetails.getUser().getId(),
@@ -147,11 +149,16 @@ public class SMPAuthorizationService {
      */
     protected UserRO getUpdatedUserData(UserRO userRO) {
         userRO.setShowPasswordExpirationWarning(userRO.getPasswordExpireOn() != null &&
-                OffsetDateTime.now()
-                        .minusDays(configurationService.getPasswordPolicyUIWarningDaysBeforeExpire())
-                        .isBefore(userRO.getPasswordExpireOn()));
+                OffsetDateTime.now().plusDays(configurationService.getPasswordPolicyUIWarningDaysBeforeExpire())
+                        .isAfter(userRO.getPasswordExpireOn()));
 
         userRO.setForceChangePassword(userRO.isPasswordExpired() && configurationService.getPasswordPolicyForceChangeIfExpired());
+        // set cas authentication data
+        if (configurationService.getUIAuthenticationTypes().contains(SMPUserAuthenticationTypes.SSO.name())) {
+            URL casUrlData = configurationService.getCasUserDataURL();
+            userRO.setCasUserDataUrl(casUrlData!=null?casUrlData.toString():null);
+        }
+
         return sanitize(userRO);
     }
 }
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpWebAppConfig.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpWebAppConfig.java
index 38c38ead8..d93ed2fe8 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpWebAppConfig.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpWebAppConfig.java
@@ -28,7 +28,10 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
 import org.springframework.web.servlet.config.annotation.*;
 import org.springframework.web.util.UrlPathHelper;
 
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
 import java.util.List;
+import java.util.TimeZone;
 
 import static org.springframework.core.Ordered.HIGHEST_PRECEDENCE;
 
@@ -87,6 +90,10 @@ public class SmpWebAppConfig implements WebMvcConfigurer {
         objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
         converter.setObjectMapper(objectMapper);
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+        dateFormat.setTimeZone(TimeZone.getDefault());
+        objectMapper.setDateFormat(dateFormat);
+
         converters.add(0, converter);
     }
 }
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/AuthenticationResource.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/AuthenticationResource.java
index 6aaebf73a..ae2d4ff54 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/AuthenticationResource.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/AuthenticationResource.java
@@ -41,9 +41,7 @@ import static eu.europa.ec.edelivery.smp.utils.SMPCookieWriter.SESSION_COOKIE_NA
 public class AuthenticationResource {
 
     private static final SMPLogger LOG = SMPLoggerFactory.getLogger(AuthenticationResource.class);
-    public static final String RELATIVE_BASE_ENTRY="../../../#/";
-
-    private UIUserService uiUserService;
+    public static final String RELATIVE_BASE_ENTRY = "../../../#/";
 
     protected SMPAuthenticationService authenticationService;
 
@@ -67,7 +65,6 @@ public class AuthenticationResource {
         this.configurationService = configurationService;
         this.smpCookieWriter = smpCookieWriter;
         this.csrfTokenRepository = csrfTokenRepository;
-        this.uiUserService = uiUserService;
     }
 
     @PostMapping(value = "authentication")
@@ -123,7 +120,6 @@ public class AuthenticationResource {
     public void recreatedSessionCookie(HttpServletRequest request, HttpServletResponse response) {
         // recreate session id  (first make sure it exists)
         String sessionId = request.getSession(true).getId();
-//        String sessionId = request.changeSessionId();
         smpCookieWriter.writeCookieToResponse(SESSION_COOKIE_NAME,
                 sessionId,
                 configurationService.getSessionCookieSecure(),
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/external/UserResource.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/external/UserResource.java
index c166b98e9..a7d8e4f44 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/external/UserResource.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/external/UserResource.java
@@ -9,7 +9,6 @@ import eu.europa.ec.edelivery.smp.data.ui.UserRO;
 import eu.europa.ec.edelivery.smp.logging.SMPLogger;
 import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory;
 import eu.europa.ec.edelivery.smp.services.ui.UIUserService;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.MimeTypeUtils;
 import org.springframework.web.bind.annotation.*;
@@ -45,7 +44,7 @@ public class UserResource {
         Long entityId = decryptEntityId(userId);
         LOG.info("Generated access token for user:[{}] with id:[{}] ", userId, entityId);
 
-        return uiUserService.generateAccessTokenForUser(entityId, password);
+        return uiUserService.generateAccessTokenForUser(entityId, entityId, password);
     }
 
     @PreAuthorize("@smpAuthorizationService.isCurrentlyLoggedIn(#userId)")
@@ -53,12 +52,12 @@ public class UserResource {
     public boolean changePassword(@PathVariable("user-id") String userId, @RequestBody PasswordChangeRO newPassword, HttpServletRequest request, HttpServletResponse response) {
         Long entityId = decryptEntityId(userId);
         LOG.info("Validating the password of the currently logged in user:[{}] with id:[{}] ", userId, entityId);
-        boolean result = uiUserService.updateUserPassword(entityId, newPassword.getCurrentPassword(), newPassword.getNewPassword());
-        if (result){
+        DBUser result = uiUserService.updateUserPassword(entityId, entityId, newPassword.getCurrentPassword(), newPassword.getNewPassword());
+        if (result!=null) {
             LOG.info("Password successfully changed. Logout the user, to be able to login with the new password!");
             authenticationService.logout(request, response);
         }
-        return result;
+        return result!=null;
     }
 
     /**
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/internal/TruststoreAdminResource.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/internal/TruststoreAdminResource.java
index 8c325dd3d..2b6776f2f 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/internal/TruststoreAdminResource.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/internal/TruststoreAdminResource.java
@@ -49,9 +49,11 @@ public class TruststoreAdminResource {
     public ServiceResult<CertificateRO> getCertificateList() {
         List<CertificateRO> lst = uiTruststoreService.getCertificateROEntriesList();
         // clear encoded value to reduce http traffic
-        lst.stream().forEach(certificateRO -> {
+        int i =0;
+        for (CertificateRO certificateRO : lst) {
             certificateRO.setEncodedValue(null);
-        });
+            certificateRO.setIndex(i++);
+        }
 
         ServiceResult<CertificateRO> sg = new ServiceResult<>();
         sg.getServiceEntities().addAll(lst);
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/internal/UserAdminResource.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/internal/UserAdminResource.java
index ed946f78d..ebaa92d14 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/internal/UserAdminResource.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/ui/internal/UserAdminResource.java
@@ -1,12 +1,9 @@
 package eu.europa.ec.edelivery.smp.ui.internal;
 
-import eu.europa.ec.edelivery.smp.auth.SMPAuthenticationToken;
 import eu.europa.ec.edelivery.smp.auth.SMPAuthorizationService;
 import eu.europa.ec.edelivery.smp.auth.SMPUserDetails;
 import eu.europa.ec.edelivery.smp.data.model.DBUser;
-import eu.europa.ec.edelivery.smp.data.ui.DeleteEntityValidation;
-import eu.europa.ec.edelivery.smp.data.ui.ServiceResult;
-import eu.europa.ec.edelivery.smp.data.ui.UserRO;
+import eu.europa.ec.edelivery.smp.data.ui.*;
 import eu.europa.ec.edelivery.smp.data.ui.auth.SMPAuthority;
 import eu.europa.ec.edelivery.smp.logging.SMPLogger;
 import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory;
@@ -15,16 +12,17 @@ import eu.europa.ec.edelivery.smp.services.ui.UIUserService;
 import eu.europa.ec.edelivery.smp.services.ui.filters.UserFilter;
 import eu.europa.ec.edelivery.smp.utils.SessionSecurityUtils;
 import org.springframework.security.access.annotation.Secured;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.util.MimeTypeUtils;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 
 import static eu.europa.ec.edelivery.smp.ui.ResourceConstants.CONTEXT_PATH_INTERNAL_USER;
+import static eu.europa.ec.edelivery.smp.utils.SessionSecurityUtils.decryptEntityId;
 
 /**
  * @author Joze Rihtarsic
@@ -86,6 +84,32 @@ public class UserAdminResource {
         return uiUserService.validateDeleteRequest(dres);
     }
 
+    @PostMapping(path = "/{user-id}/generate-access-token-for/{update-user-id}", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
+    @Secured({SMPAuthority.S_AUTHORITY_TOKEN_SYSTEM_ADMIN})
+    public AccessTokenRO generateAccessTokenForUser(
+            @PathVariable("user-id") String userId,
+            @PathVariable("update-user-id") String regenerateForUserId,
+            @RequestBody String password) {
+        Long authorizedUserId = decryptEntityId(userId);
+        Long changeUserId = decryptEntityId(regenerateForUserId);
+        LOG.info("Generated access token for user:[{}] with id:[{}] by the system user with id [{}]", userId, regenerateForUserId, authorizedUserId);
+
+        return uiUserService.generateAccessTokenForUser(authorizedUserId, changeUserId, password);
+    }
+
+
+    @PutMapping(path = "/{user-id}/change-password-for/{update-user-id}", consumes = MimeTypeUtils.APPLICATION_JSON_VALUE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
+    @Secured({SMPAuthority.S_AUTHORITY_TOKEN_SYSTEM_ADMIN})
+    public UserRO changePassword(@PathVariable("user-id") String userId,
+                                 @PathVariable("update-user-id") String regenerateForUserId,
+                                 @RequestBody PasswordChangeRO newPassword, HttpServletRequest request, HttpServletResponse response) {
+        Long authorizedUserId = decryptEntityId(userId);
+        Long changeUserId = decryptEntityId(regenerateForUserId);
+        LOG.info("change the password of the currently logged in user:[{}] with id:[{}] ", changeUserId, regenerateForUserId);
+        DBUser user = uiUserService.updateUserPassword(authorizedUserId, changeUserId, newPassword.getCurrentPassword(), newPassword.getNewPassword());
+        return authorizationService.sanitize(uiUserService.convertToRo(user));
+    }
+
     private SMPUserDetails getLoggedUserData() {
         return authorizationService.getAndValidateUserDetails();
     }
diff --git a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationServiceTest.java b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationServiceTest.java
index ff29e08e4..bbc019875 100644
--- a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationServiceTest.java
+++ b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/auth/SMPAuthorizationServiceTest.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 
-
 public class SMPAuthorizationServiceTest {
 
     UserRO user = null;
@@ -161,9 +160,10 @@ public class SMPAuthorizationServiceTest {
     }
 
     @Test
-    public void testGetUpdatedUserDataDoNotShowWarning() {
+    public void testGetUpdatedUserDataAboutToExpireNoWarning() {
         UserRO user = new UserRO();
-        user.setPasswordExpireOn(OffsetDateTime.now().minusDays(11));
+        // password will expire in 11 days. But the warning is 10 days before expire
+        user.setPasswordExpireOn(OffsetDateTime.now().plusDays(11));
         Mockito.doReturn(10).when(configurationService).getPasswordPolicyUIWarningDaysBeforeExpire();
         Mockito.doReturn(false).when(configurationService).getPasswordPolicyForceChangeIfExpired();
 
@@ -174,6 +174,21 @@ public class SMPAuthorizationServiceTest {
         Assert.assertFalse(user.isPasswordExpired());
     }
 
+    @Test
+    public void testGetUpdatedUserDataAboutToExpireShowWarning() {
+        UserRO user = new UserRO();
+        // password will expire in 9 days. Warning is 10 days before expire
+        user.setPasswordExpireOn(OffsetDateTime.now().plusDays(9));
+        Mockito.doReturn(10).when(configurationService).getPasswordPolicyUIWarningDaysBeforeExpire();
+        Mockito.doReturn(false).when(configurationService).getPasswordPolicyForceChangeIfExpired();
+
+        user = testInstance.getUpdatedUserData(user);
+
+        Assert.assertTrue(user.isShowPasswordExpirationWarning());
+        Assert.assertFalse(user.isForceChangeExpiredPassword());
+        Assert.assertFalse(user.isPasswordExpired());
+    }
+
     @Test
     public void testGetUpdatedUserDataForceChange() {
         UserRO user = new UserRO();
-- 
GitLab