From 8c36cb86edd678ad91aa952c0c9d8d3de154d2dc Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Thu, 18 Apr 2024 10:26:51 +0200 Subject: [PATCH] frontend fixes --- README.md | 3 +- .../datasafe.postman_collection.json | 1689 +++++++++++------ .../rest/impl/security/SecurityConfig.java | 34 +- frontend/README.md | 2 + frontend/datasafe-ui/angular.json | 15 +- frontend/datasafe-ui/main.js | 2 +- frontend/datasafe-ui/main.js.map | 1 - frontend/datasafe-ui/package.json | 6 +- frontend/datasafe-ui/src/app/app.component.ts | 2 +- .../component/filetree/filetree.component.ts | 9 +- .../app/component/login/login.component.ts | 2 +- .../component/register/register.component.ts | 36 +- frontend/datasafe-ui/src/app/polyfills.ts | 3 +- pom.xml | 16 +- 14 files changed, 1158 insertions(+), 662 deletions(-) delete mode 100644 frontend/datasafe-ui/main.js.map diff --git a/README.md b/README.md index 6a867c696..f160362dd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -[![Build Status](https://travis-ci.com/adorsys/datasafe.svg?branch=develop)](https://travis-ci.com/adorsys/datasafe) [![codecov](https://codecov.io/gh/adorsys/datasafe/branch/develop/graph/badge.svg)](https://codecov.io/gh/adorsys/datasafe) -[![Maintainability](https://api.codeclimate.com/v1/badges/06ae7d4cafc3012cee85/maintainability)](https://codeclimate.com/github/adorsys/datasafe/maintainability) +[![Maintainability](https://codeclimate.com/github/adorsys/datasafe.png)](https://codeclimate.com/github/adorsys/datasafe/maintainability) # Secure, Encrypted and Versioned Data Storage Library diff --git a/datasafe-rest-impl/datasafe.postman_collection.json b/datasafe-rest-impl/datasafe.postman_collection.json index 524b1dcfb..e17f46f1d 100644 --- a/datasafe-rest-impl/datasafe.postman_collection.json +++ b/datasafe-rest-impl/datasafe.postman_collection.json @@ -1,232 +1,432 @@ { "info": { - "_postman_id": "54d63510-b402-4a2c-b518-50e79a04d569", + "_postman_id": "db124a60-8dee-44e6-9bf0-97d18e0a9c14", "name": "Datasafe", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "18419826" }, "item": [ { - "name": "authenticate", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\"userName\":\"username\",\"password\":\"password\"}" - }, - "url": { - "raw": "{{host}}/api/authenticate", - "host": [ - "{{host}}" + "name": "user", + "item": [ + { + "name": "authenticate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "pm.collectionVariables.set(\"token\", pm.response.headers.get('token'))", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "api", - "authenticate" - ] - } - }, - "response": [] - }, - { - "name": "create user", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text", + "disabled": true + }, + { + "key": "Origin", + "value": "http://localhost:8080", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\"userName\":\"username\",\"password\":\"password\"}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{host}}/api/authenticate", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "authenticate" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"userName\":\"ver\",\n\t\"password\":\"ver\"\n}" + "response": [] }, - "url": { - "raw": "{{host}}/user", - "host": [ - "{{host}}" + { + "name": "delete user Alice", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "user" - ] - } - }, - "response": [] - }, - { - "name": "delete user", - "request": { - "method": "DELETE", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "user", - "value": "Max", - "type": "text" - }, - { - "key": "password", - "value": "123", - "type": "text" + "request": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/user", + "host": [ + "{{host}}" + ], + "path": [ + "user" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/user/", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "delete user Bob", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "user", - "" - ] - } - }, - "response": [] - }, - { - "name": "store document", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream", - "type": "text" - }, - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" + "request": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "user", + "value": "Bob", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/user", + "host": [ + "{{host}}" + ], + "path": [ + "user" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "body": { - "mode": "file", - "file": { - "src": "/Users/maxim/tx/store/a.txt" - } + "response": [] }, - "url": { - "raw": "{{host}}/document/test11.txt", - "host": [ - "{{host}}" + { + "name": "create user Alice", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "document", - "test11.txt" - ] - } - }, - "response": [] - }, - { - "name": "list documents", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "vvv", - "type": "text" - }, - { - "key": "password", - "value": "vvv", - "type": "text" + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"userName\":\"Alice\",\n\t\"password\":\"123\"\n}" + }, + "url": { + "raw": "{{host}}/user", + "host": [ + "{{host}}" + ], + "path": [ + "user" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/documents/", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "create user Bob", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "documents", - "" - ] + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"userName\":\"Bob\",\n\t\"password\":\"123\"\n}" + }, + "url": { + "raw": "{{host}}/user", + "host": [ + "{{host}}" + ], + "path": [ + "user" + ] + } + }, + "response": [] } - }, - "response": [] + ] }, { - "name": "read document", - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/octet-stream", - "type": "text" - }, - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" + "name": "private", + "item": [ + { + "name": "store document", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data", + "type": "text" + }, + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "postman-cloud:///1eeb44d1-546d-4870-ae7e-c2f44aeee23e" + } + ] + }, + "url": { + "raw": "{{host}}/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "document", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/document/test11.txt", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "list documents", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "var rb = JSON.parse(responseBody);", + "", + "pm.test(\"response contains one file\", () => {", + " pm.expect(rb.length).to.eql(1);", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "document", - "test11.txt" - ] - } - }, - "response": [ + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/documents", + "host": [ + "{{host}}" + ], + "path": [ + "documents" + ] + } + }, + "response": [] + }, { "name": "read document", - "originalRequest": { + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "pm.test(\"file content is read\", () => {", + " pm.expect(responseBody).to.eql(\"hello world!\");", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { "method": "GET", "header": [ { @@ -236,455 +436,730 @@ }, { "key": "user", - "value": "ddd", + "value": "Alice", "type": "text" }, { "key": "password", - "value": "ddd", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", "type": "text" } ], "url": { - "raw": "{{host}}/document/deep/path/test.txt", + "raw": "{{host}}/document/test.txt", "host": [ "{{host}}" ], "path": [ "document", - "deep", - "path", "test.txt" ] } }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "plain", - "header": [ - { - "key": "Transfer-Encoding", - "value": "chunked" - }, + "response": [] + }, + { + "name": "delete document", + "event": [ { - "key": "Date", - "value": "Fri, 24 May 2019 11:50:22 GMT" + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } } ], - "cookie": [], - "body": "test" - } - ] - }, - { - "name": "delete document", - "request": { - "method": "DELETE", - "header": [ - { - "key": "user", - "value": "iii", - "type": "text" - }, - { - "key": "password", - "value": "iii", - "type": "text" + "request": { + "method": "DELETE", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "document", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/document/deep/path/test2.txt", - "host": [ - "{{host}}" - ], - "path": [ - "document", - "deep", - "path", - "test2.txt" - ] + "response": [] } - }, - "response": [] + ] }, { - "name": "send to inbox", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream", - "type": "text" - }, - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "body": { - "mode": "file", - "file": { - "src": "/Users/maxim/test.txt" - } - }, - "url": { - "raw": "{{host}}/inbox/test2.txt", - "host": [ - "{{host}}" + "name": "versioned", + "item": [ + { + "name": "versioned write", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "inbox", - "test2.txt" - ] - } - }, - "response": [] - }, - { - "name": "inbox read", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "Accept", - "value": "application/octet-stream", - "type": "text" + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data", + "type": "text" + }, + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "postman-cloud:///1eeb44d1-546d-4870-ae7e-c2f44aeee23e" + } + ] + }, + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/inbox/test2.txt", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versioned write 2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "inbox", - "test2.txt" - ] - } - }, - "response": [] - }, - { - "name": "inbox delete", - "request": { - "method": "DELETE", - "header": [ - { - "key": "user", - "value": "iii", - "type": "text" - }, - { - "key": "password", - "value": "iii", - "type": "text" + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data", + "type": "text" + }, + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "postman-cloud:///1eeb4517-de20-4860-b895-814e47ad657f" + } + ] + }, + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/inbox/test2.txt", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versioned list (last version)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "var rb = JSON.parse(responseBody);", + "", + "pm.test(\"response contains one file\", () => {", + " pm.expect(rb.length).to.eql(1);", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "inbox", - "test2.txt" - ] - } - }, - "response": [] - }, - { - "name": "inbox list", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "Accept", - "value": "application/json", - "type": "text" + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/inbox/", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versions list", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "var rb = JSON.parse(responseBody);", + "", + "pm.test(\"response contains one file\", () => {", + " pm.expect(rb.length).to.eql(2);", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "inbox", - "" - ] - } - }, - "response": [] - }, - { - "name": "version list", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "type": "text", - "value": "ver" - }, - { - "key": "password", - "type": "text", - "value": "ver" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - }, - { - "key": "Accept", - "value": "application/json", - "type": "text" + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "type": "text", + "value": "Alice" + }, + { + "key": "password", + "type": "text", + "value": "123" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/versions/list/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versions", + "list", + "test.txt" + ] + } }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/versions/list/", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versioned read (last version)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "pm.test(\"file content is read\", () => {", + " pm.expect(responseBody).to.eql(\"yet another file\");", + "})" + ], + "type": "text/javascript" + } + } ], - "path": [ - "versions", - "list", - "" - ] - } - }, - "response": [] - }, - { - "name": "versioned read", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - }, - { - "key": "Accept", - "value": "application/octet-stream", - "type": "text" + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/octet-stream", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/versioned/test10.txt", - "host": [ - "{{host}}" + "response": [] + }, + { + "name": "versioned delete", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "versioned", - "test10.txt" - ] - } - }, - "response": [] - }, - { - "name": "versioned delete", - "request": { - "method": "DELETE", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - }, - { - "key": "Accept", - "value": "application/json", - "type": "text" + "request": { + "method": "DELETE", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/versioned/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "versioned", + "test.txt" + ] + } }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/versioned/test4.txt", - "host": [ - "{{host}}" - ], - "path": [ - "versioned", - "test4.txt" - ] + "response": [] } - }, - "response": [] + ] }, { - "name": "versioned write", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/octet-stream", - "type": "text" + "name": "inbox", + "item": [ + { + "name": "send to inbox", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "user", + "value": "Alice", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + }, + { + "key": "recipients", + "value": "Bob", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "postman-cloud:///1eeb44d1-546d-4870-ae7e-c2f44aeee23e" + } + ] + }, + "url": { + "raw": "{{host}}/inbox/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "inbox", + "document", + "test.txt" + ] + } }, - { - "key": "user", - "value": "ver", - "type": "text" + "response": [] + }, + { + "name": "inbox list", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "var rb = JSON.parse(responseBody);", + "", + "pm.test(\"response contains one file\", () => {", + " pm.expect(rb.length).to.eql(1);", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "value": "Bob", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/inbox/documents", + "host": [ + "{{host}}" + ], + "path": [ + "inbox", + "documents" + ] + } }, - { - "key": "password", - "value": "ver", - "type": "text" + "response": [] + }, + { + "name": "inbox read", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "", + "pm.test(\"file content is read\", () => {", + " pm.expect(responseBody).to.eql(\"hello world!\");", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "user", + "value": "Bob", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "Accept", + "value": "application/octet-stream", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/inbox/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "inbox", + "document", + "test.txt" + ] + } }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - } - ], - "body": { - "mode": "file", - "file": { - "src": "/Users/maxim/parallel_transactions_merge_logic_fix.patch" - } + "response": [] }, - "url": { - "raw": "{{host}}/versioned/test10.txt", - "host": [ - "{{host}}" + { + "name": "inbox delete", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Success', function() {", + " pm.response.to.have.status(200)", + "})", + "" + ], + "type": "text/javascript" + } + } ], - "path": [ - "versioned", - "test10.txt" - ] + "request": { + "method": "DELETE", + "header": [ + { + "key": "user", + "value": "Bob", + "type": "text" + }, + { + "key": "password", + "value": "123", + "type": "text" + }, + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{host}}/inbox/document/test.txt", + "host": [ + "{{host}}" + ], + "path": [ + "inbox", + "document", + "test.txt" + ] + } + }, + "response": [] } - }, - "response": [] + ] + } + ], + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{token}}", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "versioned list", - "request": { - "method": "GET", - "header": [ - { - "key": "user", - "value": "ver", - "type": "text" - }, - { - "key": "password", - "value": "ver", - "type": "text" - }, - { - "key": "token", - "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJzZWN1cmUtYXBpIiwiYXVkIjoic2VjdXJlLWFwcCIsInN1YiI6InVzZXJuYW1lIiwiZXhwIjoxNTYxMzA0MTA4LCJyb2wiOlsiUk9MRV9VU0VSIl19.Ungu5hob8mbwb7GfWfvqj1VsrNNv1pN6UEMJYJHSAHBicRlsYVbRAE7Ju_N1nnjdoZ6TSs4hireff92SkXvesQ", - "type": "text" - }, - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "{{host}}/versioned/", - "host": [ - "{{host}}" - ], - "path": [ - "versioned", - "" - ] - } - }, - "response": [] + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "host", + "value": "http://localhost:8080", + "type": "string" + }, + { + "key": "token", + "value": "" } ] } \ No newline at end of file diff --git a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/SecurityConfig.java b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/SecurityConfig.java index ed5677088..dab705ac1 100644 --- a/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/SecurityConfig.java +++ b/datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/security/SecurityConfig.java @@ -26,10 +26,13 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.servlet.handler.HandlerMappingIntrospector; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import static de.adorsys.datasafe.rest.impl.security.SecurityConstants.TOKEN_HEADER; +import static org.springframework.security.config.Customizer.withDefaults; @Configuration @EnableWebSecurity @@ -44,7 +47,7 @@ public class SecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http, MvcRequestMatcher.Builder mvc, AuthenticationManager authenticationManager) throws Exception { - MvcRequestMatcher[] SWAGGER_RESOURCES = { + MvcRequestMatcher[] swaggerResources = { mvc.pattern("/v2/api-docs"), mvc.pattern("/configuration/ui"), mvc.pattern("/swagger-resources"), @@ -54,11 +57,10 @@ public SecurityFilterChain filterChain(HttpSecurity http, MvcRequestMatcher.Buil mvc.pattern("/swagger-resources/configuration/ui"), mvc.pattern("/swagger-ui.html") }; - - http.cors(AbstractHttpConfigurer::disable) + http.cors(withDefaults()) .csrf(AbstractHttpConfigurer::disable) .authorizeHttpRequests(authz -> authz - .requestMatchers(SWAGGER_RESOURCES).permitAll() + .requestMatchers(swaggerResources).permitAll() .requestMatchers(mvc.pattern("/static/**")).permitAll() .requestMatchers(mvc.pattern(SecurityConstants.AUTH_LOGIN_URL)).permitAll() .requestMatchers(mvc.pattern(HttpMethod.OPTIONS, "/**")).permitAll() @@ -77,8 +79,8 @@ MvcRequestMatcher.Builder mvc(HandlerMappingIntrospector introspector) { } @Bean - public InMemoryUserDetailsManager userDetailsService(PasswordEncoder passwordEncoder) { - UserDetails user = User.withDefaultPasswordEncoder() + public InMemoryUserDetailsManager userDetailsService(PasswordEncoder encoder) { + UserDetails user = User.builder().passwordEncoder(encoder::encode) .username(securityProperties.getDefaultUser()) .password(securityProperties.getDefaultPassword()) .authorities("ROLE_USER") @@ -101,19 +103,15 @@ public PasswordEncoder passwordEncoder() { } @Bean - public CorsConfigurationSource corsConfigurationSource() { + CorsConfigurationSource corsConfigurationSource() { + CorsConfiguration configuration = new CorsConfiguration(); + configuration.setAllowedOrigins(List.of("http://localhost:4200")); + configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + configuration.setAllowedHeaders(List.of("*")); + configuration.setAllowCredentials(true); + configuration.addExposedHeader(TOKEN_HEADER); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - - CorsConfiguration authConfig = new CorsConfiguration().applyPermitDefaultValues(); - authConfig.addExposedHeader(TOKEN_HEADER); - source.registerCorsConfiguration(SecurityConstants.AUTH_LOGIN_URL, authConfig); - - CorsConfiguration globalConfig = new CorsConfiguration().applyPermitDefaultValues(); - globalConfig.addAllowedMethod(HttpMethod.OPTIONS); - globalConfig.addAllowedMethod(HttpMethod.PUT); - globalConfig.addAllowedMethod(HttpMethod.DELETE); - source.registerCorsConfiguration("/**", globalConfig); - + source.registerCorsConfiguration("/**", configuration); return source; } diff --git a/frontend/README.md b/frontend/README.md index ca8275e3a..174a51035 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -3,6 +3,8 @@ Use `npm run-script ng:serve:web` for local development Use `npm run-script start` for electron development +Use `ng serve -c dev` if you need to debug + ### Notes - API url and credentials are provided by env.js file (API_URL, API_USERNAME, API_PASSWORD). Credentials (API_USERNAME, API_PASSWORD) are intended for local use only. diff --git a/frontend/datasafe-ui/angular.json b/frontend/datasafe-ui/angular.json index 544edcee8..bb53be0a1 100755 --- a/frontend/datasafe-ui/angular.json +++ b/frontend/datasafe-ui/angular.json @@ -40,7 +40,6 @@ "optimization": true, "outputHashing": "all", "sourceMap": false, - "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, @@ -53,6 +52,17 @@ "maximumError": "5mb" } ] + }, + "dev": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.dev.ts" + } + ], + "optimization": false, + "extractLicenses": false, + "sourceMap": true } } }, @@ -64,6 +74,9 @@ "configurations": { "production": { "browserTarget": "my-app:build:production" + }, + "dev": { + "browserTarget": "my-app:build:dev" } } }, diff --git a/frontend/datasafe-ui/main.js b/frontend/datasafe-ui/main.js index 49966638b..c6746dce1 100644 --- a/frontend/datasafe-ui/main.js +++ b/frontend/datasafe-ui/main.js @@ -21,7 +21,7 @@ function createWindow() { }); if (serve) { require('electron-reload')(__dirname, { - electron: require(__dirname + "/node_modules/electron") + electron: require("".concat(__dirname, "/node_modules/electron")) }); win.loadURL('http://localhost:4200'); } diff --git a/frontend/datasafe-ui/main.js.map b/frontend/datasafe-ui/main.js.map deleted file mode 100644 index f967e92ff..000000000 --- a/frontend/datasafe-ui/main.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";;AAAA,qCAAsD;AACtD,2BAA6B;AAC7B,yBAA2B;AAE3B,IAAI,GAAG,EAAE,KAAK,CAAC;AACf,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,KAAK,SAAS,EAAjB,CAAiB,CAAC,CAAC;AAE5C,SAAS,YAAY;IAEnB,IAAM,cAAc,GAAG,iBAAM,CAAC;IAC9B,IAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,EAAE,CAAC,YAAY,CAAC;IAE7D,6BAA6B;IAC7B,GAAG,GAAG,IAAI,wBAAa,CAAC;QACtB,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,cAAc,EAAE;YACd,eAAe,EAAE,IAAI;SACtB;KACF,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE;QACT,OAAO,CAAC,iBAAiB,CAAC,CAAC,SAAS,EAAE;YACpC,QAAQ,EAAE,OAAO,CAAI,SAAS,2BAAwB,CAAC;SACxD,CAAC,CAAC;QACH,GAAG,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;KACtC;SAAM;QACL,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;YACrB,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC;YACjD,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC,CAAC;KACL;IAED,IAAI,KAAK,EAAE;QACT,GAAG,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;KAChC;IAED,qCAAqC;IACrC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE;QACf,gEAAgE;QAChE,mEAAmE;QACnE,oDAAoD;QACpD,GAAG,GAAG,IAAI,CAAC;IACb,CAAC,CAAC,CAAC;AAEL,CAAC;AAED,IAAI;IAEF,wDAAwD;IACxD,yDAAyD;IACzD,sDAAsD;IACtD,cAAG,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAE9B,oCAAoC;IACpC,cAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE;QAC1B,2DAA2D;QAC3D,8DAA8D;QAC9D,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACjC,cAAG,CAAC,IAAI,EAAE,CAAC;SACZ;IACH,CAAC,CAAC,CAAC;IAEH,cAAG,CAAC,EAAE,CAAC,UAAU,EAAE;QACjB,gEAAgE;QAChE,4DAA4D;QAC5D,IAAI,GAAG,KAAK,IAAI,EAAE;YAChB,YAAY,EAAE,CAAC;SAChB;IACH,CAAC,CAAC,CAAC;CAEJ;AAAC,OAAO,CAAC,EAAE;IACV,cAAc;IACd,WAAW;CACZ"} \ No newline at end of file diff --git a/frontend/datasafe-ui/package.json b/frontend/datasafe-ui/package.json index 3195a72de..7994278ae 100644 --- a/frontend/datasafe-ui/package.json +++ b/frontend/datasafe-ui/package.json @@ -4,7 +4,7 @@ "description": "datasafe-ui with web and electron interface", "keywords": [ "angular", - "angular 8", + "angular 15", "electron", "typescript", "sass" @@ -53,7 +53,7 @@ "@types/node": "20.8.0", "codelyzer": "6.0.2", "core-js": "3.33.0", - "electron": "26.2.4", + "electron": "^26.2.4", "electron-builder": "24.7.0", "electron-reload": "1.5.0", "hammerjs": "2.0.8", @@ -75,7 +75,7 @@ "wait-on": "7.0.1", "web-animations-js": "2.3.2", "webdriver-manager": "13.0.2", - "zone.js": "0.14.0" + "zone.js": "0.13.0" }, "engines": { "node": ">=18.10.0" diff --git a/frontend/datasafe-ui/src/app/app.component.ts b/frontend/datasafe-ui/src/app/app.component.ts index 788f93502..852e4d829 100644 --- a/frontend/datasafe-ui/src/app/app.component.ts +++ b/frontend/datasafe-ui/src/app/app.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import {ErrorStateMatcher} from "@angular/material"; +import {ErrorStateMatcher} from "@angular/material/core"; import {FormControl, FormGroupDirective, NgForm} from "@angular/forms"; export class Env { diff --git a/frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts b/frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts index 57aee9256..9269168d4 100644 --- a/frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts +++ b/frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts @@ -7,7 +7,7 @@ import {ApiService} from "../../service/api/api.service"; import {CredentialsService} from "../../service/credentials/credentials.service"; import {Router} from "@angular/router"; import {ErrorMessageUtil} from "../../app.component"; -import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material"; +import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog"; class UserFileSystem { @@ -39,6 +39,7 @@ class UserFileSystem { var fullPath = ""; var folder = ""; + path = (path.startsWith('/')) ? path.substring(1) : path; path.split("/").forEach(segment => { fullPath += segment; fullPath += (fullPath === path ? "" : "/"); @@ -302,7 +303,7 @@ export class FiletreeComponent { this.error = ''; this.removePathFromUiCreatedFolders(path); this.api.deleteDocument(path, this.creds.getCredentialsForApi()) - .then(res => this.loadTree()) + .then(_ => this.loadTree()) .catch(err => this.error = 'Delete failed: ' + ErrorMessageUtil.extract(err)); } @@ -316,7 +317,7 @@ export class FiletreeComponent { uploadFile(event) { this.error = ''; this.api.uploadDocument(event.target.files[0], event.target.files[0].name, this.creds.getCredentialsForApi()) - .then(res => this.loadTree()) + .then(_ => this.loadTree()) .catch(err => { this.error = 'Upload failed: ' + ErrorMessageUtil.extract(err); }); @@ -328,7 +329,7 @@ export class FiletreeComponent { event.currentTarget.files[0], event.currentTarget.name + event.currentTarget.files[0].name, this.creds.getCredentialsForApi()) - .then(res => this.loadTree()) + .then(_ => this.loadTree()) .catch(err => { this.error = 'Upload failed: ' + ErrorMessageUtil.extract(err); }); diff --git a/frontend/datasafe-ui/src/app/component/login/login.component.ts b/frontend/datasafe-ui/src/app/component/login/login.component.ts index f943deeff..b2c947f34 100644 --- a/frontend/datasafe-ui/src/app/component/login/login.component.ts +++ b/frontend/datasafe-ui/src/app/component/login/login.component.ts @@ -3,7 +3,7 @@ import {Router} from '@angular/router'; import {FormBuilder, FormControl, Validators} from '@angular/forms'; import {CredentialsService} from '../../service/credentials/credentials.service'; import {Env, FieldErrorStateMatcher} from '../../app.component'; -import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material'; +import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog'; export interface ApiConfigData { apiUrl: string; diff --git a/frontend/datasafe-ui/src/app/component/register/register.component.ts b/frontend/datasafe-ui/src/app/component/register/register.component.ts index 4aff54c12..4c5542fe3 100644 --- a/frontend/datasafe-ui/src/app/component/register/register.component.ts +++ b/frontend/datasafe-ui/src/app/component/register/register.component.ts @@ -1,14 +1,14 @@ import {Component, OnInit} from '@angular/core'; -import {FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms"; -import {Router} from "@angular/router"; -import {ApiService} from "../../service/api/api.service"; -import {CredentialsService} from "../../service/credentials/credentials.service"; -import {ErrorMessageUtil, FieldErrorStateMatcher, ParentOrFieldErrorStateMatcher} from "../../app.component"; +import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms'; +import {Router} from '@angular/router'; +import {ApiService} from '../../service/api/api.service'; +import {CredentialsService} from '../../service/credentials/credentials.service'; +import {ErrorMessageUtil, FieldErrorStateMatcher, ParentOrFieldErrorStateMatcher} from '../../app.component'; class PasswordsMatchControl extends FormControl { constructor(private hidden: boolean) { - super('', []) + super('', []); } get Hidden(): boolean { @@ -31,6 +31,10 @@ class PasswordsMatchControl extends FormControl { }) export class RegisterComponent implements OnInit { + constructor(public router: Router, private api: ApiService, private fb: FormBuilder, + private creds: CredentialsService) { + } + userNameControl = new FormControl('', [ Validators.required, Validators.minLength(3) @@ -53,8 +57,12 @@ export class RegisterComponent implements OnInit { fieldMatcher = new FieldErrorStateMatcher(); parentOrFieldMatcher = new ParentOrFieldErrorStateMatcher(); - constructor(public router: Router, private api: ApiService, private fb: FormBuilder, - private creds: CredentialsService) { + private static checkPasswords(group: FormGroup) { // here we have the 'passwords' group + const matchControl = group.controls.matchPasswords; + const pass = group.controls.passwords.value; + const confirmPass = matchControl.value; + + return (matchControl.Hidden || pass === confirmPass) ? null : {notSame: true} } ngOnInit() { @@ -62,22 +70,14 @@ export class RegisterComponent implements OnInit { public handleCreateUserClick() { if (!this.registerForm.valid) { - return + return; } this.api.createUser(this.userNameControl.value, this.passwordControl.value) .then(res => { this.creds.setCredentials(this.userNameControl.value, this.passwordControl.value); - this.router.navigate(['/user']) + this.router.navigate(['/user']); }) .catch(error => this.registerForm.setErrors({'createFailed': ErrorMessageUtil.extract(error)})); } - - private static checkPasswords(group: FormGroup) { // here we have the 'passwords' group - let matchControl = group.controls.matchPasswords; - let pass = group.controls.passwords.value; - let confirmPass = matchControl.value; - - return (matchControl.Hidden || pass === confirmPass) ? null : {notSame: true} - } } diff --git a/frontend/datasafe-ui/src/app/polyfills.ts b/frontend/datasafe-ui/src/app/polyfills.ts index 5134b24e9..203549750 100755 --- a/frontend/datasafe-ui/src/app/polyfills.ts +++ b/frontend/datasafe-ui/src/app/polyfills.ts @@ -1,5 +1,4 @@ -import 'core-js/es6/reflect'; -import 'core-js/es7/reflect'; +import 'core-js/features/reflect'; import 'zone.js/dist/zone'; import 'hammerjs'; import 'web-animations-js'; \ No newline at end of file diff --git a/pom.xml b/pom.xml index b15b12999..16be9735c 100644 --- a/pom.xml +++ b/pom.xml @@ -74,13 +74,13 @@ src/main/java src/test/java 19.2.0 - 3.11.0 + 3.12.1 17 17 3.6.1 1.18.30 2.8.9 - 2.46.1 + 2.50 32.1.1-jre 4.0.3 5.10.0 @@ -113,7 +113,7 @@ 3.1.2 1.4.4 2.16.1 - 0.0.9 + 0.0.11-SNAPSHOT 2.1.1 2.3.1 2.8.1 @@ -741,6 +741,16 @@ + + + sonatype + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + sonatype