From 7a89597101bd6cb70fc12764d2f3d91a8e262443 Mon Sep 17 00:00:00 2001 From: Timo Date: Wed, 3 Feb 2021 13:19:07 +0200 Subject: [PATCH] digital signature initial setup --- apps/red-ui/src/app/app.module.ts | 12 +- .../admin-breadcrumbs.component.html | 9 + .../digital-signature-screen.component.html | 70 ++++++++ .../digital-signature-screen.component.scss | 23 +++ .../digital-signature-screen.component.ts | 113 ++++++++++++ apps/red-ui/src/assets/i18n/en.json | 27 ++- libs/red-ui-http/src/lib/api.module.ts | 4 +- libs/red-ui-http/src/lib/api/api.ts | 9 +- .../api/digitalSignatureController.service.ts | 170 ++++++++++++++++++ .../src/lib/model/digitalSignature.ts | 19 ++ libs/red-ui-http/src/lib/model/models.ts | 1 + 11 files changed, 452 insertions(+), 5 deletions(-) create mode 100644 apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.html create mode 100644 apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.scss create mode 100644 apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.ts create mode 100644 libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts create mode 100644 libs/red-ui-http/src/lib/model/digitalSignature.ts diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index 5bdc49032..675f5447e 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -109,6 +109,7 @@ import { LicenseInformationScreenComponent } from './screens/admin/license-infor import { DefaultColorsScreenComponent } from './screens/admin/default-colors-screen/default-colors-screen.component'; import { EditColorDialogComponent } from './screens/admin/default-colors-screen/edit-color-dialog/edit-color-dialog.component'; import { DownloadsListScreenComponent } from './screens/downloads-list-screen/downloads-list-screen.component'; +import { DigitalSignatureScreenComponent } from './screens/admin/digital-signature-screen/digital-signature-screen.component'; export function HttpLoaderFactory(httpClient: HttpClient) { return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json'); @@ -263,6 +264,14 @@ const routes = [ data: { routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] } + }, + { + path: 'digital-signature', + component: DigitalSignatureScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } } ] } @@ -358,7 +367,8 @@ const matImports = [ LicenseInformationScreenComponent, DefaultColorsScreenComponent, EditColorDialogComponent, - DownloadsListScreenComponent + DownloadsListScreenComponent, + DigitalSignatureScreenComponent ], imports: [ BrowserModule, diff --git a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html index 5752f40a6..8d121eaf0 100644 --- a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html +++ b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html @@ -8,6 +8,15 @@ *ngIf="root || !!appStateService.activeRuleSet" > + + + + +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+
+
+
+
+ + + diff --git a/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.scss b/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.scss new file mode 100644 index 000000000..d80cd118a --- /dev/null +++ b/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.scss @@ -0,0 +1,23 @@ +@import '../../../../assets/styles/red-mixins'; +@import '../../../../assets/styles/red-variables'; + +.left-container { + width: 100vw; + @include inset-shadow; + + .left-container-content { + margin: 20px; + } +} + +@font-face { + font-family: 'secret'; + src: url(data:font/woff;base64,d09GRgABAAAAAAusAAsAAAAAMGgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZjRmM5Y21hcAAAAYQAAAgCAAArYmjjYVVnbHlmAAAJiAAAAEEAAABQiOYj2mhlYWQAAAnMAAAALgAAADYOx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ADIAAAAAAAAAAoAAB4nGNgZGBgYGIQA2IGMIuBgQsIGRj+g/kMAArUATEAAHicjY69TsMwFIWP+4doJYSKhMTmoUJIqOnPWIm1ZWDq0IEtTZw2VRpHjlu1D8A7MPMczAw8DM/AifFEl9qS9d1zzr3XAK7xBYHqCHTdW50aLlj9cZ1057lBfvTcRAdPnlvUnz23mXj13MEN3jhBNC6p9PDuuYYrfHquU//23CD/eG7iVnQ9t9ATD57bWIgXzx3ciw+rDrZfqmhnUnvsx2kZzdVql4Xm1DhVFsqUqc7lKBiemjOVKxNaFcvlUZb71djaRCZGb+VU51ZlmZaF0RsV2WBtbTEZDBKvB5HewkLhwLePkhRhB4OU9ZFKTCqpzems6GQI6Z7TcU5mQceQUmjkkBghwPCszhmd3HWHLh+ze8mEpLvnT8dULRLWCTMaW9LUbanSGa+mUjhv47ZY7l67rgITDHiTf/mAKU76BTuXfk8AAHicY2BigAARBuyAiZGJkZmBJSWzOJmBAQALQwHHAAAA) + format('woff'); +} + +/* target the input field inexplicably to throw Chrome's AI off. + * feel free to use a more complicated selector */ +input[name='keySecret'] { + font-family: 'secret'; +} diff --git a/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.ts b/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.ts new file mode 100644 index 000000000..c0eef4ada --- /dev/null +++ b/apps/red-ui/src/app/screens/admin/digital-signature-screen/digital-signature-screen.component.ts @@ -0,0 +1,113 @@ +import { Component } from '@angular/core'; +import { DigitalSignature, DigitalSignatureControllerService } from '@redaction/red-ui-http'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { NotificationService, NotificationType } from '../../../notification/notification.service'; +import { TranslateService } from '@ngx-translate/core'; +import { PermissionsService } from '../../../common/service/permissions.service'; + +@Component({ + selector: 'redaction-digital-signature-screen', + templateUrl: './digital-signature-screen.component.html', + styleUrls: ['./digital-signature-screen.component.scss'] +}) +export class DigitalSignatureScreenComponent { + public digitalSignature: DigitalSignature; + public digitalSignatureForm: FormGroup; + + public viewReady = false; + + constructor( + private readonly _digitalSignatureControllerService: DigitalSignatureControllerService, + private readonly _notificationService: NotificationService, + private readonly _formBuilder: FormBuilder, + private readonly _translateService: TranslateService, + public readonly permissionsService: PermissionsService + ) { + this.loadDigitalSignatureAndInitializeForm(); + } + + saveDigitalSignature() { + const digitalSignature = { + ...this.digitalSignatureForm.getRawValue() + }; + + this._digitalSignatureControllerService.saveDigitalSignature(digitalSignature).subscribe( + () => { + this.loadDigitalSignatureAndInitializeForm(); + this._notificationService.showToastNotification( + this._translateService.instant('digital-signature-screen.action.change-success'), + null, + NotificationType.SUCCESS + ); + }, + () => { + this._notificationService.showToastNotification( + this._translateService.instant('digital-signature-screen.action.error'), + null, + NotificationType.ERROR + ); + } + ); + } + + removeDigitalSignature() { + this._digitalSignatureControllerService.deleteDigitalSignature().subscribe( + () => { + this.loadDigitalSignatureAndInitializeForm(); + this._notificationService.showToastNotification( + this._translateService.instant('digital-signature-screen.action.delete-success'), + null, + NotificationType.SUCCESS + ); + }, + () => { + this._notificationService.showToastNotification( + this._translateService.instant('digital-signature-screen.action.error'), + null, + NotificationType.ERROR + ); + } + ); + } + + fileChanged(event) { + const file = event.target.files[0]; + const fileReader = new FileReader(); + fileReader.onload = () => { + if (typeof fileReader.result === 'string') { + this.digitalSignatureForm.get('base64EncodedPrivateKey').setValue(btoa(fileReader.result)); + } + }; + fileReader.readAsText(file); + } + + loadDigitalSignatureAndInitializeForm() { + this.viewReady = false; + this._digitalSignatureControllerService + .getDigitalSignature() + .subscribe( + (digitalSignature) => { + this.digitalSignature = digitalSignature; + }, + () => { + this.digitalSignature = {}; + } + ) + .add(() => { + this._initForm(); + this.viewReady = true; + }); + } + + private _initForm() { + this.digitalSignatureForm = this._formBuilder.group({ + contactInfo: [{ value: this.digitalSignature.contactInfo }], + location: [{ value: this.digitalSignature.location }], + keySecret: [{ value: this.digitalSignature.password }], + reason: [{ value: this.digitalSignature.reason }], + base64EncodedPrivateKey: [{ value: this.digitalSignature.base64EncodedPrivateKey }, Validators.required] + }); + } + + formChanged() {} +} diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 69c96267c..e7db830b1 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -643,6 +643,7 @@ "action": "New Dictionary" } }, + "digital-signature": "Digital Signature", "project-templates": "Project Templates", "project-templates-listing": { "table-header": { @@ -736,7 +737,7 @@ "copyright-claim-title": "Copyright Claim", "copyright-claim-text": "Copyright © 2020 - {{currentYear}} IQSER Technologie GmbH", "end-user-license-title": "End User License Agreement", - "end-user-license-text": "The use of this product is subject to the terms of the Atlassian End User Agreement, unless other specified therein.", + "end-user-license-text": "The use of this product is subject to the terms of the Redaction End User Agreement, unless other specified therein.", "3rd-party-title": "Reference to 3rd Party Licenses", "licensing-details": "Licensing Details", "licensed-to": "Licensed to", @@ -789,5 +790,29 @@ "actions": { "download": "Download" } + }, + "digital-signature-screen": { + "title": "Digital Signature", + "reason": { + "label": "Reason", + "placeholder": "Reason" + }, + "contact-info": { + "label": "Contact Information", + "placeholder": "Contact Information" + }, + "location": { + "label": "Location", + "placeholder": "Location" + }, + "password": { + "label": "Certificate Password/Key", + "placeholder": "Password" + }, + "action": { + "save": "Save Digital Signature", + "delete": "Delete Digital Signature", + "reset": "Reset" + } } } diff --git a/libs/red-ui-http/src/lib/api.module.ts b/libs/red-ui-http/src/lib/api.module.ts index 34c232c74..e30dc13b5 100644 --- a/libs/red-ui-http/src/lib/api.module.ts +++ b/libs/red-ui-http/src/lib/api.module.ts @@ -19,6 +19,7 @@ import { LegalBasisMappingControllerService } from './api/legalBasisMappingContr import { WatermarkControllerService } from './api/watermarkController.service'; import { RuleSetControllerService } from './api/ruleSetController.service'; import { DownloadControllerService } from './api/downloadController.service'; +import { DigitalSignatureControllerService } from './api/digitalSignatureController.service'; @NgModule({ imports: [], @@ -41,7 +42,8 @@ import { DownloadControllerService } from './api/downloadController.service'; ViewedPagesControllerService, LegalBasisMappingControllerService, WatermarkControllerService, - DownloadControllerService + DownloadControllerService, + DigitalSignatureControllerService ] }) export class ApiModule { diff --git a/libs/red-ui-http/src/lib/api/api.ts b/libs/red-ui-http/src/lib/api/api.ts index a4ddca993..fb8745716 100644 --- a/libs/red-ui-http/src/lib/api/api.ts +++ b/libs/red-ui-http/src/lib/api/api.ts @@ -1,4 +1,3 @@ -export * from './debugController.service'; import { DebugControllerService } from './debugController.service'; import { DictionaryControllerService } from './dictionaryController.service'; import { FileManagementControllerService } from './fileManagementController.service'; @@ -18,6 +17,7 @@ import { VersionsControllerService } from './versionsController.service'; import { ViewedPagesControllerService } from './viewedPagesController.service'; import { WatermarkControllerService } from './watermarkController.service'; import { DownloadControllerService } from './downloadController.service'; +import { DigitalSignatureControllerService } from './digitalSignatureController.service'; export * from './dictionaryController.service'; @@ -55,6 +55,10 @@ export * from './watermarkController.service'; export * from './downloadController.service'; +export * from './digitalSignatureController.service'; + +export * from './debugController.service'; + export const APIS = [ DebugControllerService, DictionaryControllerService, @@ -74,5 +78,6 @@ export const APIS = [ VersionsControllerService, ViewedPagesControllerService, WatermarkControllerService, - DownloadControllerService + DownloadControllerService, + DigitalSignatureControllerService ]; diff --git a/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts b/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts new file mode 100644 index 000000000..7f3f5852b --- /dev/null +++ b/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts @@ -0,0 +1,170 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ /* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { Observable } from 'rxjs'; + +import { DigitalSignature } from '../model/digitalSignature'; + +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; + +@Injectable() +export class DigitalSignatureControllerService { + protected basePath = ''; + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } + + /** + * Remove the digital signature + * None + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteDigitalSignature(observe?: 'body', reportProgress?: boolean): Observable; + public deleteDigitalSignature(observe?: 'response', reportProgress?: boolean): Observable>; + public deleteDigitalSignature(observe?: 'events', reportProgress?: boolean): Observable>; + public deleteDigitalSignature(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('delete', `${this.basePath}/digital-signature`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Get the current digital signature + * None + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getDigitalSignature(observe?: 'body', reportProgress?: boolean): Observable; + public getDigitalSignature(observe?: 'response', reportProgress?: boolean): Observable>; + public getDigitalSignature(observe?: 'events', reportProgress?: boolean): Observable>; + public getDigitalSignature(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ['application/json']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/digital-signature`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Save/Update the digital signature used to sign PDF's + * None + * @param body digitalSignatureModel + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public saveDigitalSignature(body: DigitalSignature, observe?: 'body', reportProgress?: boolean): Observable; + public saveDigitalSignature(body: DigitalSignature, observe?: 'response', reportProgress?: boolean): Observable>; + public saveDigitalSignature(body: DigitalSignature, observe?: 'events', reportProgress?: boolean): Observable>; + public saveDigitalSignature(body: DigitalSignature, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling saveDigitalSignature.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ['application/json']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('post', `${this.basePath}/digital-signature`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } +} diff --git a/libs/red-ui-http/src/lib/model/digitalSignature.ts b/libs/red-ui-http/src/lib/model/digitalSignature.ts new file mode 100644 index 000000000..1185a02d9 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/digitalSignature.ts @@ -0,0 +1,19 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export interface DigitalSignature { + base64EncodedPrivateKey?: string; + contactInfo?: string; + location?: string; + password?: string; + reason?: string; +} diff --git a/libs/red-ui-http/src/lib/model/models.ts b/libs/red-ui-http/src/lib/model/models.ts index f0043dc76..c5ba95a34 100644 --- a/libs/red-ui-http/src/lib/model/models.ts +++ b/libs/red-ui-http/src/lib/model/models.ts @@ -48,3 +48,4 @@ export * from './downloadResponse'; export * from './downloadStatus'; export * from './downloadStatusResponse'; export * from './prepareDownloadRequest'; +export * from './digitalSignature';