diff --git a/db/DML/users.json b/db/DML/users.json index b913104..bfd0a1a 100644 --- a/db/DML/users.json +++ b/db/DML/users.json @@ -2,19 +2,25 @@ { "_id": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60", "sites": [ - "404c8232-9048-4519-bfba-6e78dc7005ca" - ], + { + "siteId": "404c8232-9048-4519-bfba-6e78dc7005ca", + "hosts": [ "localhost:7174" ], + "role": 0 + } + ], "created": { "$date": "2022-01-01T00:00:00.000Z" }, "username": "admin", - "passwords": { + "authentication": { "password": { "hash": "pznndK3nv9bftf/qQxqBy4VjH7Ow9vx2Kd6376oJuqQ=", "salt": "gkEl1zxGJSLue262mUu5VA==", "created": { "$date": "2022-01-01T00:00:00.000Z" - } + }, + + "recoveryTokens": [], }, "expiration": { @@ -37,7 +43,8 @@ { "type": 0, "value": "john.doe@contoso.com", - "confirmed": false + "confirmed": false, + "primary": true }, { "type": 1, @@ -59,8 +66,6 @@ "country": "" }, - "tokens": [], - - "role": 0 + "tokens": [] } ] diff --git a/webapi/.dockerignore b/src/.dockerignore similarity index 100% rename from webapi/.dockerignore rename to src/.dockerignore diff --git a/webapi/ClientApp/.dockerignore b/src/ClientApp/.dockerignore similarity index 100% rename from webapi/ClientApp/.dockerignore rename to src/ClientApp/.dockerignore diff --git a/webapi/ClientApp/.env b/src/ClientApp/.env similarity index 100% rename from webapi/ClientApp/.env rename to src/ClientApp/.env diff --git a/webapi/ClientApp/.eslintrc.json b/src/ClientApp/.eslintrc.json similarity index 100% rename from webapi/ClientApp/.eslintrc.json rename to src/ClientApp/.eslintrc.json diff --git a/webapi/ClientApp/.vscode/launch.json b/src/ClientApp/.vscode/launch.json similarity index 100% rename from webapi/ClientApp/.vscode/launch.json rename to src/ClientApp/.vscode/launch.json diff --git a/webapi/ClientApp/ClientApp.njsproj b/src/ClientApp/ClientApp.njsproj similarity index 100% rename from webapi/ClientApp/ClientApp.njsproj rename to src/ClientApp/ClientApp.njsproj diff --git a/webapi/ClientApp/Dockerfile b/src/ClientApp/Dockerfile similarity index 100% rename from webapi/ClientApp/Dockerfile rename to src/ClientApp/Dockerfile diff --git a/webapi/ClientApp/README.md b/src/ClientApp/README.md similarity index 100% rename from webapi/ClientApp/README.md rename to src/ClientApp/README.md diff --git a/webapi/ClientApp/package-lock.json b/src/ClientApp/package-lock.json similarity index 100% rename from webapi/ClientApp/package-lock.json rename to src/ClientApp/package-lock.json diff --git a/webapi/ClientApp/package.json b/src/ClientApp/package.json similarity index 100% rename from webapi/ClientApp/package.json rename to src/ClientApp/package.json diff --git a/webapi/ClientApp/public/favicon.ico b/src/ClientApp/public/favicon.ico similarity index 100% rename from webapi/ClientApp/public/favicon.ico rename to src/ClientApp/public/favicon.ico diff --git a/webapi/ClientApp/public/index.html b/src/ClientApp/public/index.html similarity index 100% rename from webapi/ClientApp/public/index.html rename to src/ClientApp/public/index.html diff --git a/webapi/ClientApp/public/manifest.json b/src/ClientApp/public/manifest.json similarity index 100% rename from webapi/ClientApp/public/manifest.json rename to src/ClientApp/public/manifest.json diff --git a/webapi/ClientApp/src/App.test.tsx b/src/ClientApp/src/App.test.tsx similarity index 100% rename from webapi/ClientApp/src/App.test.tsx rename to src/ClientApp/src/App.test.tsx diff --git a/webapi/ClientApp/src/App.tsx b/src/ClientApp/src/App.tsx similarity index 100% rename from webapi/ClientApp/src/App.tsx rename to src/ClientApp/src/App.tsx diff --git a/webapi/ClientApp/src/components/Comments/index.tsx b/src/ClientApp/src/components/Comments/index.tsx similarity index 100% rename from webapi/ClientApp/src/components/Comments/index.tsx rename to src/ClientApp/src/components/Comments/index.tsx diff --git a/webapi/ClientApp/src/components/FeatherIcons/FeatherIcon.tsx b/src/ClientApp/src/components/FeatherIcons/FeatherIcon.tsx similarity index 100% rename from webapi/ClientApp/src/components/FeatherIcons/FeatherIcon.tsx rename to src/ClientApp/src/components/FeatherIcons/FeatherIcon.tsx diff --git a/webapi/ClientApp/src/components/FeatherIcons/IconInner.tsx b/src/ClientApp/src/components/FeatherIcons/IconInner.tsx similarity index 100% rename from webapi/ClientApp/src/components/FeatherIcons/IconInner.tsx rename to src/ClientApp/src/components/FeatherIcons/IconInner.tsx diff --git a/webapi/ClientApp/src/components/FeatherIcons/icons.json b/src/ClientApp/src/components/FeatherIcons/icons.json similarity index 100% rename from webapi/ClientApp/src/components/FeatherIcons/icons.json rename to src/ClientApp/src/components/FeatherIcons/icons.json diff --git a/webapi/ClientApp/src/components/FeatherIcons/index.tsx b/src/ClientApp/src/components/FeatherIcons/index.tsx similarity index 100% rename from webapi/ClientApp/src/components/FeatherIcons/index.tsx rename to src/ClientApp/src/components/FeatherIcons/index.tsx diff --git a/webapi/ClientApp/src/components/FeatherRating/index.tsx b/src/ClientApp/src/components/FeatherRating/index.tsx similarity index 100% rename from webapi/ClientApp/src/components/FeatherRating/index.tsx rename to src/ClientApp/src/components/FeatherRating/index.tsx diff --git a/webapi/ClientApp/src/components/FeatherRating/interfaces.ts b/src/ClientApp/src/components/FeatherRating/interfaces.ts similarity index 100% rename from webapi/ClientApp/src/components/FeatherRating/interfaces.ts rename to src/ClientApp/src/components/FeatherRating/interfaces.ts diff --git a/webapi/ClientApp/src/components/Loader/index.tsx b/src/ClientApp/src/components/Loader/index.tsx similarity index 100% rename from webapi/ClientApp/src/components/Loader/index.tsx rename to src/ClientApp/src/components/Loader/index.tsx diff --git a/webapi/ClientApp/src/components/Loader/scss/README.md b/src/ClientApp/src/components/Loader/scss/README.md similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/README.md rename to src/ClientApp/src/components/Loader/scss/README.md diff --git a/webapi/ClientApp/src/components/Loader/scss/_functions.scss b/src/ClientApp/src/components/Loader/scss/_functions.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/_functions.scss rename to src/ClientApp/src/components/Loader/scss/_functions.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/_mixins.scss b/src/ClientApp/src/components/Loader/scss/_mixins.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/_mixins.scss rename to src/ClientApp/src/components/Loader/scss/_mixins.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/_variables.scss b/src/ClientApp/src/components/Loader/scss/_variables.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/_variables.scss rename to src/ClientApp/src/components/Loader/scss/_variables.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-beat.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-beat.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-beat.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-beat.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate-multiple.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate-multiple.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate-multiple.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate-multiple.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate-pulse.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate-pulse.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate-pulse.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate-pulse.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-clip-rotate.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-grid-beat.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-grid-beat.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-grid-beat.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-grid-beat.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-grid-pulse.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-grid-pulse.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-grid-pulse.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-grid-pulse.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-pulse-rise.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-pulse-rise.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-pulse-rise.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-pulse-rise.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-pulse-round.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-pulse-round.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-pulse-round.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-pulse-round.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-pulse-sync.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-pulse-sync.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-pulse-sync.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-pulse-sync.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-pulse.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-pulse.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-pulse.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-pulse.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-rotate.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-rotate.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-rotate.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-rotate.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-scale-multiple.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-scale-multiple.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-scale-multiple.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-scale-multiple.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-scale-random.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-scale-random.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-scale-random.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-scale-random.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-scale-ripple-multiple.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-scale-ripple-multiple.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-scale-ripple-multiple.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-scale-ripple-multiple.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-scale-ripple.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-scale-ripple.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-scale-ripple.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-scale-ripple.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-scale.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-scale.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-scale.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-scale.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-spin-fade-loader.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-spin-fade-loader.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-spin-fade-loader.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-spin-fade-loader.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-spin-loader.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-spin-loader.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-spin-loader.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-spin-loader.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-triangle-path.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-triangle-path.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-triangle-path.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-triangle-path.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-zig-zag-deflect.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-zig-zag-deflect.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-zig-zag-deflect.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-zig-zag-deflect.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/ball-zig-zag.scss b/src/ClientApp/src/components/Loader/scss/animations/ball-zig-zag.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/ball-zig-zag.scss rename to src/ClientApp/src/components/Loader/scss/animations/ball-zig-zag.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/cube-transition.scss b/src/ClientApp/src/components/Loader/scss/animations/cube-transition.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/cube-transition.scss rename to src/ClientApp/src/components/Loader/scss/animations/cube-transition.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/line-scale-pulse-out-rapid.scss b/src/ClientApp/src/components/Loader/scss/animations/line-scale-pulse-out-rapid.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/line-scale-pulse-out-rapid.scss rename to src/ClientApp/src/components/Loader/scss/animations/line-scale-pulse-out-rapid.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/line-scale-pulse-out.scss b/src/ClientApp/src/components/Loader/scss/animations/line-scale-pulse-out.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/line-scale-pulse-out.scss rename to src/ClientApp/src/components/Loader/scss/animations/line-scale-pulse-out.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/line-scale-random.scss b/src/ClientApp/src/components/Loader/scss/animations/line-scale-random.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/line-scale-random.scss rename to src/ClientApp/src/components/Loader/scss/animations/line-scale-random.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/line-scale.scss b/src/ClientApp/src/components/Loader/scss/animations/line-scale.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/line-scale.scss rename to src/ClientApp/src/components/Loader/scss/animations/line-scale.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/line-spin-fade-loader.scss b/src/ClientApp/src/components/Loader/scss/animations/line-spin-fade-loader.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/line-spin-fade-loader.scss rename to src/ClientApp/src/components/Loader/scss/animations/line-spin-fade-loader.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/pacman.scss b/src/ClientApp/src/components/Loader/scss/animations/pacman.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/pacman.scss rename to src/ClientApp/src/components/Loader/scss/animations/pacman.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/semi-circle-spin.scss b/src/ClientApp/src/components/Loader/scss/animations/semi-circle-spin.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/semi-circle-spin.scss rename to src/ClientApp/src/components/Loader/scss/animations/semi-circle-spin.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/square-spin.scss b/src/ClientApp/src/components/Loader/scss/animations/square-spin.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/square-spin.scss rename to src/ClientApp/src/components/Loader/scss/animations/square-spin.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/animations/triangle-skew-spin.scss b/src/ClientApp/src/components/Loader/scss/animations/triangle-skew-spin.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/animations/triangle-skew-spin.scss rename to src/ClientApp/src/components/Loader/scss/animations/triangle-skew-spin.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/demo/demo.css b/src/ClientApp/src/components/Loader/scss/demo/demo.css similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/demo/demo.css rename to src/ClientApp/src/components/Loader/scss/demo/demo.css diff --git a/webapi/ClientApp/src/components/Loader/scss/demo/demo.html b/src/ClientApp/src/components/Loader/scss/demo/demo.html similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/demo/demo.html rename to src/ClientApp/src/components/Loader/scss/demo/demo.html diff --git a/webapi/ClientApp/src/components/Loader/scss/demo/src/demo.jade b/src/ClientApp/src/components/Loader/scss/demo/src/demo.jade similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/demo/src/demo.jade rename to src/ClientApp/src/components/Loader/scss/demo/src/demo.jade diff --git a/webapi/ClientApp/src/components/Loader/scss/demo/src/demo.scss b/src/ClientApp/src/components/Loader/scss/demo/src/demo.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/demo/src/demo.scss rename to src/ClientApp/src/components/Loader/scss/demo/src/demo.scss diff --git a/webapi/ClientApp/src/components/Loader/scss/loaders.scss b/src/ClientApp/src/components/Loader/scss/loaders.scss similarity index 100% rename from webapi/ClientApp/src/components/Loader/scss/loaders.scss rename to src/ClientApp/src/components/Loader/scss/loaders.scss diff --git a/webapi/ClientApp/src/components/Pagination/index.tsx b/src/ClientApp/src/components/Pagination/index.tsx similarity index 100% rename from webapi/ClientApp/src/components/Pagination/index.tsx rename to src/ClientApp/src/components/Pagination/index.tsx diff --git a/webapi/ClientApp/src/components/Pagination/utils.ts b/src/ClientApp/src/components/Pagination/utils.ts similarity index 100% rename from webapi/ClientApp/src/components/Pagination/utils.ts rename to src/ClientApp/src/components/Pagination/utils.ts diff --git a/webapi/ClientApp/src/components/ReactFastCompare/LICENSE b/src/ClientApp/src/components/ReactFastCompare/LICENSE similarity index 100% rename from webapi/ClientApp/src/components/ReactFastCompare/LICENSE rename to src/ClientApp/src/components/ReactFastCompare/LICENSE diff --git a/webapi/ClientApp/src/components/ReactFastCompare/README.md b/src/ClientApp/src/components/ReactFastCompare/README.md similarity index 100% rename from webapi/ClientApp/src/components/ReactFastCompare/README.md rename to src/ClientApp/src/components/ReactFastCompare/README.md diff --git a/webapi/ClientApp/src/components/ReactFastCompare/index.js b/src/ClientApp/src/components/ReactFastCompare/index.js similarity index 100% rename from webapi/ClientApp/src/components/ReactFastCompare/index.js rename to src/ClientApp/src/components/ReactFastCompare/index.js diff --git a/webapi/ClientApp/src/components/ReactHelmet/HelmetConstants.js b/src/ClientApp/src/components/ReactHelmet/HelmetConstants.js similarity index 100% rename from webapi/ClientApp/src/components/ReactHelmet/HelmetConstants.js rename to src/ClientApp/src/components/ReactHelmet/HelmetConstants.js diff --git a/webapi/ClientApp/src/components/ReactHelmet/HelmetUtils.js b/src/ClientApp/src/components/ReactHelmet/HelmetUtils.js similarity index 100% rename from webapi/ClientApp/src/components/ReactHelmet/HelmetUtils.js rename to src/ClientApp/src/components/ReactHelmet/HelmetUtils.js diff --git a/webapi/ClientApp/src/components/ReactHelmet/LICENSE b/src/ClientApp/src/components/ReactHelmet/LICENSE similarity index 100% rename from webapi/ClientApp/src/components/ReactHelmet/LICENSE rename to src/ClientApp/src/components/ReactHelmet/LICENSE diff --git a/webapi/ClientApp/src/components/ReactHelmet/README.md b/src/ClientApp/src/components/ReactHelmet/README.md similarity index 100% rename from webapi/ClientApp/src/components/ReactHelmet/README.md rename to src/ClientApp/src/components/ReactHelmet/README.md diff --git a/webapi/ClientApp/src/components/ReactHelmet/Types.ts b/src/ClientApp/src/components/ReactHelmet/Types.ts similarity index 100% rename from webapi/ClientApp/src/components/ReactHelmet/Types.ts rename to src/ClientApp/src/components/ReactHelmet/Types.ts diff --git a/webapi/ClientApp/src/components/ReactHelmet/index.js b/src/ClientApp/src/components/ReactHelmet/index.js similarity index 100% rename from webapi/ClientApp/src/components/ReactHelmet/index.js rename to src/ClientApp/src/components/ReactHelmet/index.js diff --git a/webapi/ClientApp/src/components/ReactSideEffect/LICENSE b/src/ClientApp/src/components/ReactSideEffect/LICENSE similarity index 100% rename from webapi/ClientApp/src/components/ReactSideEffect/LICENSE rename to src/ClientApp/src/components/ReactSideEffect/LICENSE diff --git a/webapi/ClientApp/src/components/ReactSideEffect/README.md b/src/ClientApp/src/components/ReactSideEffect/README.md similarity index 100% rename from webapi/ClientApp/src/components/ReactSideEffect/README.md rename to src/ClientApp/src/components/ReactSideEffect/README.md diff --git a/webapi/ClientApp/src/components/ReactSideEffect/index.js b/src/ClientApp/src/components/ReactSideEffect/index.js similarity index 100% rename from webapi/ClientApp/src/components/ReactSideEffect/index.js rename to src/ClientApp/src/components/ReactSideEffect/index.js diff --git a/webapi/ClientApp/src/components/SideWidgets/Categories.tsx b/src/ClientApp/src/components/SideWidgets/Categories.tsx similarity index 100% rename from webapi/ClientApp/src/components/SideWidgets/Categories.tsx rename to src/ClientApp/src/components/SideWidgets/Categories.tsx diff --git a/webapi/ClientApp/src/components/SideWidgets/Empty.tsx b/src/ClientApp/src/components/SideWidgets/Empty.tsx similarity index 100% rename from webapi/ClientApp/src/components/SideWidgets/Empty.tsx rename to src/ClientApp/src/components/SideWidgets/Empty.tsx diff --git a/webapi/ClientApp/src/components/SideWidgets/Search.tsx b/src/ClientApp/src/components/SideWidgets/Search.tsx similarity index 100% rename from webapi/ClientApp/src/components/SideWidgets/Search.tsx rename to src/ClientApp/src/components/SideWidgets/Search.tsx diff --git a/webapi/ClientApp/src/components/SideWidgets/index.tsx b/src/ClientApp/src/components/SideWidgets/index.tsx similarity index 100% rename from webapi/ClientApp/src/components/SideWidgets/index.tsx rename to src/ClientApp/src/components/SideWidgets/index.tsx diff --git a/webapi/ClientApp/src/enumerations/index.ts b/src/ClientApp/src/enumerations/index.ts similarity index 100% rename from webapi/ClientApp/src/enumerations/index.ts rename to src/ClientApp/src/enumerations/index.ts diff --git a/webapi/ClientApp/src/functions/dateTimeFormat.ts b/src/ClientApp/src/functions/dateTimeFormat.ts similarity index 100% rename from webapi/ClientApp/src/functions/dateTimeFormat.ts rename to src/ClientApp/src/functions/dateTimeFormat.ts diff --git a/webapi/ClientApp/src/functions/findRoutes.ts b/src/ClientApp/src/functions/findRoutes.ts similarity index 100% rename from webapi/ClientApp/src/functions/findRoutes.ts rename to src/ClientApp/src/functions/findRoutes.ts diff --git a/webapi/ClientApp/src/functions/getKeyValue.ts b/src/ClientApp/src/functions/getKeyValue.ts similarity index 100% rename from webapi/ClientApp/src/functions/getKeyValue.ts rename to src/ClientApp/src/functions/getKeyValue.ts diff --git a/webapi/ClientApp/src/functions/index.ts b/src/ClientApp/src/functions/index.ts similarity index 100% rename from webapi/ClientApp/src/functions/index.ts rename to src/ClientApp/src/functions/index.ts diff --git a/webapi/ClientApp/src/functions/jwtDecode/atob.ts b/src/ClientApp/src/functions/jwtDecode/atob.ts similarity index 100% rename from webapi/ClientApp/src/functions/jwtDecode/atob.ts rename to src/ClientApp/src/functions/jwtDecode/atob.ts diff --git a/webapi/ClientApp/src/functions/jwtDecode/base64_url_decode.ts b/src/ClientApp/src/functions/jwtDecode/base64_url_decode.ts similarity index 100% rename from webapi/ClientApp/src/functions/jwtDecode/base64_url_decode.ts rename to src/ClientApp/src/functions/jwtDecode/base64_url_decode.ts diff --git a/webapi/ClientApp/src/functions/jwtDecode/index.ts b/src/ClientApp/src/functions/jwtDecode/index.ts similarity index 100% rename from webapi/ClientApp/src/functions/jwtDecode/index.ts rename to src/ClientApp/src/functions/jwtDecode/index.ts diff --git a/webapi/ClientApp/src/index.tsx b/src/ClientApp/src/index.tsx similarity index 100% rename from webapi/ClientApp/src/index.tsx rename to src/ClientApp/src/index.tsx diff --git a/webapi/ClientApp/src/layouts/admin/NavMenu/index.tsx b/src/ClientApp/src/layouts/admin/NavMenu/index.tsx similarity index 100% rename from webapi/ClientApp/src/layouts/admin/NavMenu/index.tsx rename to src/ClientApp/src/layouts/admin/NavMenu/index.tsx diff --git a/webapi/ClientApp/src/layouts/admin/SideMenu/index.tsx b/src/ClientApp/src/layouts/admin/SideMenu/index.tsx similarity index 100% rename from webapi/ClientApp/src/layouts/admin/SideMenu/index.tsx rename to src/ClientApp/src/layouts/admin/SideMenu/index.tsx diff --git a/webapi/ClientApp/src/layouts/admin/SideMenu/scss/style.module.scss b/src/ClientApp/src/layouts/admin/SideMenu/scss/style.module.scss similarity index 100% rename from webapi/ClientApp/src/layouts/admin/SideMenu/scss/style.module.scss rename to src/ClientApp/src/layouts/admin/SideMenu/scss/style.module.scss diff --git a/webapi/ClientApp/src/layouts/admin/index.tsx b/src/ClientApp/src/layouts/admin/index.tsx similarity index 100% rename from webapi/ClientApp/src/layouts/admin/index.tsx rename to src/ClientApp/src/layouts/admin/index.tsx diff --git a/webapi/ClientApp/src/layouts/admin/scss/style.module.scss b/src/ClientApp/src/layouts/admin/scss/style.module.scss similarity index 100% rename from webapi/ClientApp/src/layouts/admin/scss/style.module.scss rename to src/ClientApp/src/layouts/admin/scss/style.module.scss diff --git a/webapi/ClientApp/src/layouts/index.tsx b/src/ClientApp/src/layouts/index.tsx similarity index 100% rename from webapi/ClientApp/src/layouts/index.tsx rename to src/ClientApp/src/layouts/index.tsx diff --git a/webapi/ClientApp/src/layouts/interfaces.tsx b/src/ClientApp/src/layouts/interfaces.tsx similarity index 100% rename from webapi/ClientApp/src/layouts/interfaces.tsx rename to src/ClientApp/src/layouts/interfaces.tsx diff --git a/webapi/ClientApp/src/layouts/public/Footer/index.tsx b/src/ClientApp/src/layouts/public/Footer/index.tsx similarity index 100% rename from webapi/ClientApp/src/layouts/public/Footer/index.tsx rename to src/ClientApp/src/layouts/public/Footer/index.tsx diff --git a/webapi/ClientApp/src/layouts/public/NavMenu/index.tsx b/src/ClientApp/src/layouts/public/NavMenu/index.tsx similarity index 100% rename from webapi/ClientApp/src/layouts/public/NavMenu/index.tsx rename to src/ClientApp/src/layouts/public/NavMenu/index.tsx diff --git a/webapi/ClientApp/src/layouts/public/index.tsx b/src/ClientApp/src/layouts/public/index.tsx similarity index 100% rename from webapi/ClientApp/src/layouts/public/index.tsx rename to src/ClientApp/src/layouts/public/index.tsx diff --git a/webapi/ClientApp/src/layouts/public/scss/style.module.scss b/src/ClientApp/src/layouts/public/scss/style.module.scss similarity index 100% rename from webapi/ClientApp/src/layouts/public/scss/style.module.scss rename to src/ClientApp/src/layouts/public/scss/style.module.scss diff --git a/webapi/ClientApp/src/layouts/scss/style.scss b/src/ClientApp/src/layouts/scss/style.scss similarity index 100% rename from webapi/ClientApp/src/layouts/scss/style.scss rename to src/ClientApp/src/layouts/scss/style.scss diff --git a/webapi/ClientApp/src/models/abstractions.ts b/src/ClientApp/src/models/abstractions.ts similarity index 100% rename from webapi/ClientApp/src/models/abstractions.ts rename to src/ClientApp/src/models/abstractions.ts diff --git a/webapi/ClientApp/src/models/index.ts b/src/ClientApp/src/models/index.ts similarity index 100% rename from webapi/ClientApp/src/models/index.ts rename to src/ClientApp/src/models/index.ts diff --git a/webapi/ClientApp/src/models/pageSections.ts b/src/ClientApp/src/models/pageSections.ts similarity index 100% rename from webapi/ClientApp/src/models/pageSections.ts rename to src/ClientApp/src/models/pageSections.ts diff --git a/webapi/ClientApp/src/models/pages.ts b/src/ClientApp/src/models/pages.ts similarity index 100% rename from webapi/ClientApp/src/models/pages.ts rename to src/ClientApp/src/models/pages.ts diff --git a/webapi/ClientApp/src/models/requests.ts b/src/ClientApp/src/models/requests.ts similarity index 100% rename from webapi/ClientApp/src/models/requests.ts rename to src/ClientApp/src/models/requests.ts diff --git a/webapi/ClientApp/src/models/responses.ts b/src/ClientApp/src/models/responses.ts similarity index 100% rename from webapi/ClientApp/src/models/responses.ts rename to src/ClientApp/src/models/responses.ts diff --git a/webapi/ClientApp/src/pages/AdminHome.tsx b/src/ClientApp/src/pages/AdminHome.tsx similarity index 100% rename from webapi/ClientApp/src/pages/AdminHome.tsx rename to src/ClientApp/src/pages/AdminHome.tsx diff --git a/webapi/ClientApp/src/pages/Blog/Catalog/index.tsx b/src/ClientApp/src/pages/Blog/Catalog/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Blog/Catalog/index.tsx rename to src/ClientApp/src/pages/Blog/Catalog/index.tsx diff --git a/webapi/ClientApp/src/pages/Blog/Item/index.tsx b/src/ClientApp/src/pages/Blog/Item/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Blog/Item/index.tsx rename to src/ClientApp/src/pages/Blog/Item/index.tsx diff --git a/webapi/ClientApp/src/pages/Blog/index.ts b/src/ClientApp/src/pages/Blog/index.ts similarity index 100% rename from webapi/ClientApp/src/pages/Blog/index.ts rename to src/ClientApp/src/pages/Blog/index.ts diff --git a/webapi/ClientApp/src/pages/Counter.tsx b/src/ClientApp/src/pages/Counter.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Counter.tsx rename to src/ClientApp/src/pages/Counter.tsx diff --git a/webapi/ClientApp/src/pages/FetchData.tsx b/src/ClientApp/src/pages/FetchData.tsx similarity index 100% rename from webapi/ClientApp/src/pages/FetchData.tsx rename to src/ClientApp/src/pages/FetchData.tsx diff --git a/webapi/ClientApp/src/pages/Home/index.tsx b/src/ClientApp/src/pages/Home/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Home/index.tsx rename to src/ClientApp/src/pages/Home/index.tsx diff --git a/webapi/ClientApp/src/pages/Home/scss/style.module.scss b/src/ClientApp/src/pages/Home/scss/style.module.scss similarity index 100% rename from webapi/ClientApp/src/pages/Home/scss/style.module.scss rename to src/ClientApp/src/pages/Home/scss/style.module.scss diff --git a/webapi/ClientApp/src/pages/Profile/index.tsx b/src/ClientApp/src/pages/Profile/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Profile/index.tsx rename to src/ClientApp/src/pages/Profile/index.tsx diff --git a/webapi/ClientApp/src/pages/Shop/Cart/index.tsx b/src/ClientApp/src/pages/Shop/Cart/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Shop/Cart/index.tsx rename to src/ClientApp/src/pages/Shop/Cart/index.tsx diff --git a/webapi/ClientApp/src/pages/Shop/Cart/scss/style.module.scss b/src/ClientApp/src/pages/Shop/Cart/scss/style.module.scss similarity index 100% rename from webapi/ClientApp/src/pages/Shop/Cart/scss/style.module.scss rename to src/ClientApp/src/pages/Shop/Cart/scss/style.module.scss diff --git a/webapi/ClientApp/src/pages/Shop/Catalog/index.tsx b/src/ClientApp/src/pages/Shop/Catalog/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Shop/Catalog/index.tsx rename to src/ClientApp/src/pages/Shop/Catalog/index.tsx diff --git a/webapi/ClientApp/src/pages/Shop/Checkout/index.tsx b/src/ClientApp/src/pages/Shop/Checkout/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Shop/Checkout/index.tsx rename to src/ClientApp/src/pages/Shop/Checkout/index.tsx diff --git a/webapi/ClientApp/src/pages/Shop/Checkout/scss/style.module.scss b/src/ClientApp/src/pages/Shop/Checkout/scss/style.module.scss similarity index 100% rename from webapi/ClientApp/src/pages/Shop/Checkout/scss/style.module.scss rename to src/ClientApp/src/pages/Shop/Checkout/scss/style.module.scss diff --git a/webapi/ClientApp/src/pages/Shop/Item/index.tsx b/src/ClientApp/src/pages/Shop/Item/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Shop/Item/index.tsx rename to src/ClientApp/src/pages/Shop/Item/index.tsx diff --git a/webapi/ClientApp/src/pages/Shop/RelatedProducts/index.tsx b/src/ClientApp/src/pages/Shop/RelatedProducts/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Shop/RelatedProducts/index.tsx rename to src/ClientApp/src/pages/Shop/RelatedProducts/index.tsx diff --git a/webapi/ClientApp/src/pages/Shop/index.ts b/src/ClientApp/src/pages/Shop/index.ts similarity index 100% rename from webapi/ClientApp/src/pages/Shop/index.ts rename to src/ClientApp/src/pages/Shop/index.ts diff --git a/webapi/ClientApp/src/pages/Signin/index.tsx b/src/ClientApp/src/pages/Signin/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Signin/index.tsx rename to src/ClientApp/src/pages/Signin/index.tsx diff --git a/webapi/ClientApp/src/pages/Signin/scss/style.scss b/src/ClientApp/src/pages/Signin/scss/style.scss similarity index 100% rename from webapi/ClientApp/src/pages/Signin/scss/style.scss rename to src/ClientApp/src/pages/Signin/scss/style.scss diff --git a/webapi/ClientApp/src/pages/Signup/index.tsx b/src/ClientApp/src/pages/Signup/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/Signup/index.tsx rename to src/ClientApp/src/pages/Signup/index.tsx diff --git a/webapi/ClientApp/src/pages/Signup/scss/style.scss b/src/ClientApp/src/pages/Signup/scss/style.scss similarity index 100% rename from webapi/ClientApp/src/pages/Signup/scss/style.scss rename to src/ClientApp/src/pages/Signup/scss/style.scss diff --git a/webapi/ClientApp/src/pages/index.tsx b/src/ClientApp/src/pages/index.tsx similarity index 100% rename from webapi/ClientApp/src/pages/index.tsx rename to src/ClientApp/src/pages/index.tsx diff --git a/webapi/ClientApp/src/react-app-env.d.ts b/src/ClientApp/src/react-app-env.d.ts similarity index 100% rename from webapi/ClientApp/src/react-app-env.d.ts rename to src/ClientApp/src/react-app-env.d.ts diff --git a/webapi/ClientApp/src/registerServiceWorker.ts b/src/ClientApp/src/registerServiceWorker.ts similarity index 100% rename from webapi/ClientApp/src/registerServiceWorker.ts rename to src/ClientApp/src/registerServiceWorker.ts diff --git a/webapi/ClientApp/src/restClient.ts b/src/ClientApp/src/restClient.ts similarity index 100% rename from webapi/ClientApp/src/restClient.ts rename to src/ClientApp/src/restClient.ts diff --git a/webapi/ClientApp/src/store/configureStore.ts b/src/ClientApp/src/store/configureStore.ts similarity index 100% rename from webapi/ClientApp/src/store/configureStore.ts rename to src/ClientApp/src/store/configureStore.ts diff --git a/webapi/ClientApp/src/store/index.ts b/src/ClientApp/src/store/index.ts similarity index 100% rename from webapi/ClientApp/src/store/index.ts rename to src/ClientApp/src/store/index.ts diff --git a/webapi/ClientApp/src/store/reducers/BlogCatalog.ts b/src/ClientApp/src/store/reducers/BlogCatalog.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/BlogCatalog.ts rename to src/ClientApp/src/store/reducers/BlogCatalog.ts diff --git a/webapi/ClientApp/src/store/reducers/BlogCategories.ts b/src/ClientApp/src/store/reducers/BlogCategories.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/BlogCategories.ts rename to src/ClientApp/src/store/reducers/BlogCategories.ts diff --git a/webapi/ClientApp/src/store/reducers/BlogFeatured.ts b/src/ClientApp/src/store/reducers/BlogFeatured.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/BlogFeatured.ts rename to src/ClientApp/src/store/reducers/BlogFeatured.ts diff --git a/webapi/ClientApp/src/store/reducers/BlogItem.ts b/src/ClientApp/src/store/reducers/BlogItem.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/BlogItem.ts rename to src/ClientApp/src/store/reducers/BlogItem.ts diff --git a/webapi/ClientApp/src/store/reducers/Content.ts b/src/ClientApp/src/store/reducers/Content.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/Content.ts rename to src/ClientApp/src/store/reducers/Content.ts diff --git a/webapi/ClientApp/src/store/reducers/Counter.ts b/src/ClientApp/src/store/reducers/Counter.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/Counter.ts rename to src/ClientApp/src/store/reducers/Counter.ts diff --git a/webapi/ClientApp/src/store/reducers/Header.ts b/src/ClientApp/src/store/reducers/Header.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/Header.ts rename to src/ClientApp/src/store/reducers/Header.ts diff --git a/webapi/ClientApp/src/store/reducers/Loader.ts b/src/ClientApp/src/store/reducers/Loader.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/Loader.ts rename to src/ClientApp/src/store/reducers/Loader.ts diff --git a/webapi/ClientApp/src/store/reducers/ShopCart.ts b/src/ClientApp/src/store/reducers/ShopCart.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/ShopCart.ts rename to src/ClientApp/src/store/reducers/ShopCart.ts diff --git a/webapi/ClientApp/src/store/reducers/ShopCatalog.ts b/src/ClientApp/src/store/reducers/ShopCatalog.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/ShopCatalog.ts rename to src/ClientApp/src/store/reducers/ShopCatalog.ts diff --git a/webapi/ClientApp/src/store/reducers/ShopCategories.ts b/src/ClientApp/src/store/reducers/ShopCategories.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/ShopCategories.ts rename to src/ClientApp/src/store/reducers/ShopCategories.ts diff --git a/webapi/ClientApp/src/store/reducers/ShopFeatured.ts b/src/ClientApp/src/store/reducers/ShopFeatured.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/ShopFeatured.ts rename to src/ClientApp/src/store/reducers/ShopFeatured.ts diff --git a/webapi/ClientApp/src/store/reducers/ShopItem.ts b/src/ClientApp/src/store/reducers/ShopItem.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/ShopItem.ts rename to src/ClientApp/src/store/reducers/ShopItem.ts diff --git a/webapi/ClientApp/src/store/reducers/ShopRelated.ts b/src/ClientApp/src/store/reducers/ShopRelated.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/ShopRelated.ts rename to src/ClientApp/src/store/reducers/ShopRelated.ts diff --git a/webapi/ClientApp/src/store/reducers/WeatherForecasts.ts b/src/ClientApp/src/store/reducers/WeatherForecasts.ts similarity index 100% rename from webapi/ClientApp/src/store/reducers/WeatherForecasts.ts rename to src/ClientApp/src/store/reducers/WeatherForecasts.ts diff --git a/webapi/ClientApp/tsconfig.json b/src/ClientApp/tsconfig.json similarity index 100% rename from webapi/ClientApp/tsconfig.json rename to src/ClientApp/tsconfig.json diff --git a/webapi/Core/Abstractions/Enumeration.cs b/src/Core/Abstractions/Enumeration.cs similarity index 100% rename from webapi/Core/Abstractions/Enumeration.cs rename to src/Core/Abstractions/Enumeration.cs diff --git a/webapi/Core/Abstractions/EquatableBase.cs b/src/Core/Abstractions/EquatableBase.cs similarity index 100% rename from webapi/Core/Abstractions/EquatableBase.cs rename to src/Core/Abstractions/EquatableBase.cs diff --git a/webapi/Core/Abstractions/Models/ModelBase.cs b/src/Core/Abstractions/Models/ModelBase.cs similarity index 100% rename from webapi/Core/Abstractions/Models/ModelBase.cs rename to src/Core/Abstractions/Models/ModelBase.cs diff --git a/webapi/Core/Abstractions/Models/PaginationModelBase.cs b/src/Core/Abstractions/Models/PaginationModelBase.cs similarity index 100% rename from webapi/Core/Abstractions/Models/PaginationModelBase.cs rename to src/Core/Abstractions/Models/PaginationModelBase.cs diff --git a/webapi/Core/Abstractions/Models/RequestModelBase.cs b/src/Core/Abstractions/Models/RequestModelBase.cs similarity index 100% rename from webapi/Core/Abstractions/Models/RequestModelBase.cs rename to src/Core/Abstractions/Models/RequestModelBase.cs diff --git a/webapi/Core/Abstractions/Models/ResponseModelBase.cs b/src/Core/Abstractions/Models/ResponseModelBase.cs similarity index 100% rename from webapi/Core/Abstractions/Models/ResponseModelBase.cs rename to src/Core/Abstractions/Models/ResponseModelBase.cs diff --git a/webapi/Core/Abstractions/ServiceBase.cs b/src/Core/Abstractions/ServiceBase.cs similarity index 100% rename from webapi/Core/Abstractions/ServiceBase.cs rename to src/Core/Abstractions/ServiceBase.cs diff --git a/webapi/Core/Core.csproj b/src/Core/Core.csproj similarity index 100% rename from webapi/Core/Core.csproj rename to src/Core/Core.csproj diff --git a/webapi/Core/Enumerations/CrudActions.cs b/src/Core/Enumerations/CrudActions.cs similarity index 100% rename from webapi/Core/Enumerations/CrudActions.cs rename to src/Core/Enumerations/CrudActions.cs diff --git a/webapi/Core/Enumerations/Errors.cs b/src/Core/Enumerations/Errors.cs similarity index 100% rename from webapi/Core/Enumerations/Errors.cs rename to src/Core/Enumerations/Errors.cs diff --git a/webapi/Core/Enumerations/MediaTypes.cs b/src/Core/Enumerations/MediaTypes.cs similarity index 100% rename from webapi/Core/Enumerations/MediaTypes.cs rename to src/Core/Enumerations/MediaTypes.cs diff --git a/webapi/Core/Middlewares/ErrorHandlerMiddleware.cs b/src/Core/Middlewares/ErrorHandlerMiddleware.cs similarity index 97% rename from webapi/Core/Middlewares/ErrorHandlerMiddleware.cs rename to src/Core/Middlewares/ErrorHandlerMiddleware.cs index 1aead0f..4ff46c0 100644 --- a/webapi/Core/Middlewares/ErrorHandlerMiddleware.cs +++ b/src/Core/Middlewares/ErrorHandlerMiddleware.cs @@ -1,5 +1,5 @@ using Core.Enumerations; -using ExtensionMethods; +using Extensions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/webapi/CryptoProvider/AesKey.cs b/src/CryptoProvider/AesKey.cs similarity index 100% rename from webapi/CryptoProvider/AesKey.cs rename to src/CryptoProvider/AesKey.cs diff --git a/webapi/CryptoProvider/AesService.cs b/src/CryptoProvider/AesService.cs similarity index 100% rename from webapi/CryptoProvider/AesService.cs rename to src/CryptoProvider/AesService.cs diff --git a/webapi/CryptoProvider/CryptoProvider.csproj b/src/CryptoProvider/CryptoProvider.csproj similarity index 80% rename from webapi/CryptoProvider/CryptoProvider.csproj rename to src/CryptoProvider/CryptoProvider.csproj index f30dff6..5115f29 100644 --- a/webapi/CryptoProvider/CryptoProvider.csproj +++ b/src/CryptoProvider/CryptoProvider.csproj @@ -8,6 +8,7 @@ + diff --git a/webapi/CryptoProvider/HashService.cs b/src/CryptoProvider/HashService.cs similarity index 100% rename from webapi/CryptoProvider/HashService.cs rename to src/CryptoProvider/HashService.cs diff --git a/src/CryptoProvider/JwtService.cs b/src/CryptoProvider/JwtService.cs new file mode 100644 index 0000000..e9abe36 --- /dev/null +++ b/src/CryptoProvider/JwtService.cs @@ -0,0 +1,33 @@ +using System.IdentityModel.Tokens.Jwt; +using System.Security.Claims; +using Microsoft.IdentityModel.Tokens; + +namespace CryptoProvider { + + public static class JwtService { + + public static string CreateJwtToken(string secret, DateTime expires) => + CreateJwtTokenCore(secret, expires, null); + + public static string CreateJwtToken(string secret, DateTime expires, List> claims) => + CreateJwtTokenCore(secret, expires, claims); + + public static string CreateJwtTokenCore(string secret, DateTime expires, List>? claims) { + var tokenHandler = new JwtSecurityTokenHandler(); + + var securityToken = tokenHandler.CreateToken(new SecurityTokenDescriptor { + IssuedAt = DateTime.UtcNow, + Subject = new ClaimsIdentity(claims?.Select(x => new Claim(x.Key, x.Value)).ToList()), + Expires = expires, + SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Convert.FromBase64String(secret)), SecurityAlgorithms.HmacSha512Signature), + }); + + return tokenHandler.WriteToken(securityToken); + } + + public static List>? JwtTokenClaims(string token) { + var securityToken = new JwtSecurityTokenHandler().ReadToken(token) as JwtSecurityToken; + return securityToken?.Claims?.Select(x => new KeyValuePair(x.Type, x.Value)).ToList(); + } + } +} diff --git a/src/CryptoProvider/RandomService.cs b/src/CryptoProvider/RandomService.cs new file mode 100644 index 0000000..76adbe5 --- /dev/null +++ b/src/CryptoProvider/RandomService.cs @@ -0,0 +1,17 @@ +using System.Drawing; +using System.Security.Cryptography; + +namespace CryptoProvider { + public static class RandomService { + + public static string SecureRandomString(uint size) { + + using var generator = RandomNumberGenerator.Create(); + + var salt = new byte[size]; + generator.GetBytes(salt); + + return Convert.ToBase64String(salt); + } + } +} diff --git a/webapi/DataProviders/Abstractions/BucketDataProviderBase.cs b/src/DataProviders/Abstractions/BucketDataProviderBase.cs similarity index 99% rename from webapi/DataProviders/Abstractions/BucketDataProviderBase.cs rename to src/DataProviders/Abstractions/BucketDataProviderBase.cs index 2bd33db..9a15c26 100644 --- a/webapi/DataProviders/Abstractions/BucketDataProviderBase.cs +++ b/src/DataProviders/Abstractions/BucketDataProviderBase.cs @@ -5,7 +5,7 @@ using MongoDB.Driver; using MongoDB.Driver.GridFS; using DomainResults.Common; -using ExtensionMethods; +using Extensions; namespace DataProviders.Abstractions { diff --git a/webapi/DataProviders/Abstractions/CollectionDataProviderBase.cs b/src/DataProviders/Abstractions/CollectionDataProviderBase.cs similarity index 100% rename from webapi/DataProviders/Abstractions/CollectionDataProviderBase.cs rename to src/DataProviders/Abstractions/CollectionDataProviderBase.cs diff --git a/webapi/DataProviders/Abstractions/DataProviderBase.cs b/src/DataProviders/Abstractions/DataProviderBase.cs similarity index 100% rename from webapi/DataProviders/Abstractions/DataProviderBase.cs rename to src/DataProviders/Abstractions/DataProviderBase.cs diff --git a/webapi/DataProviders/BucketFile.cs b/src/DataProviders/BucketFile.cs similarity index 100% rename from webapi/DataProviders/BucketFile.cs rename to src/DataProviders/BucketFile.cs diff --git a/webapi/DataProviders/Buckets/ImageBucketDataProvider.cs b/src/DataProviders/Buckets/ImageBucketDataProvider.cs similarity index 100% rename from webapi/DataProviders/Buckets/ImageBucketDataProvider.cs rename to src/DataProviders/Buckets/ImageBucketDataProvider.cs diff --git a/webapi/DataProviders/Collections/BlogCatalogDataProvider.cs b/src/DataProviders/Collections/BlogCatalogDataProvider.cs similarity index 100% rename from webapi/DataProviders/Collections/BlogCatalogDataProvider.cs rename to src/DataProviders/Collections/BlogCatalogDataProvider.cs diff --git a/webapi/DataProviders/Collections/CategoryDataProvider.cs b/src/DataProviders/Collections/CategoryDataProvider.cs similarity index 100% rename from webapi/DataProviders/Collections/CategoryDataProvider.cs rename to src/DataProviders/Collections/CategoryDataProvider.cs diff --git a/webapi/DataProviders/Collections/ContentDataProvider.cs b/src/DataProviders/Collections/ContentDataProvider.cs similarity index 100% rename from webapi/DataProviders/Collections/ContentDataProvider.cs rename to src/DataProviders/Collections/ContentDataProvider.cs diff --git a/webapi/DataProviders/Collections/ShopCartDataProvider.cs b/src/DataProviders/Collections/ShopCartDataProvider.cs similarity index 100% rename from webapi/DataProviders/Collections/ShopCartDataProvider.cs rename to src/DataProviders/Collections/ShopCartDataProvider.cs diff --git a/webapi/DataProviders/Collections/ShopCatalogDataProvider.cs b/src/DataProviders/Collections/ShopCatalogDataProvider.cs similarity index 100% rename from webapi/DataProviders/Collections/ShopCatalogDataProvider.cs rename to src/DataProviders/Collections/ShopCatalogDataProvider.cs diff --git a/webapi/DataProviders/Collections/UserDataProvider.cs b/src/DataProviders/Collections/UserDataProvider.cs similarity index 58% rename from webapi/DataProviders/Collections/UserDataProvider.cs rename to src/DataProviders/Collections/UserDataProvider.cs index 13055e3..9ae4f81 100644 --- a/webapi/DataProviders/Collections/UserDataProvider.cs +++ b/src/DataProviders/Collections/UserDataProvider.cs @@ -1,22 +1,27 @@ using Microsoft.Extensions.Logging; using DataProviders.Abstractions; -using DomainObjects.Documents; using DomainResults.Common; using MongoDB.Bson.Serialization; using MongoDB.Driver; +using DomainObjects.Documents.User; +using System.Runtime.CompilerServices; +namespace DataProviders.Collections +{ -namespace DataProviders.Collections { - - public interface IUserDataProvider { + public interface IUserDataProvider { (UserDocument?, IDomainResult) Get(Guid userId); + (UserDocument?, IDomainResult) GetByUserIdAndHost(Guid userId, string host); + (UserDocument?, IDomainResult) GetByUsername(string nickName); + (UserDocument?, IDomainResult) GetByRecoveryToken(string recoveryToken); + (Guid?, IDomainResult) Update(UserDocument user); } @@ -41,6 +46,15 @@ namespace DataProviders.Collections { return (list.First(), result); } + public (UserDocument?, IDomainResult) GetByUserIdAndHost(Guid userId, string host) { + var (list, result) = GetWithPredicate(x => x.Id == userId && x.Sites.Any(x => x.Hosts.Contains(host))); + + if (!result.IsSuccess || list == null) + return (null, result); + + return (list.First(), result); + } + public (UserDocument?, IDomainResult) GetByUsername(string username) { var (list, result) = GetWithPredicate(x => x.Username == username); @@ -50,6 +64,15 @@ namespace DataProviders.Collections { return (list.First(), result); } + public (UserDocument?, IDomainResult) GetByRecoveryToken(string recoveryToken) { + var (list, result) = GetWithPredicate(x => x.Authentication.Password != null && x.Authentication.Password.RecoveryTokens.Any(y => !(DateTime.UtcNow > y.Expires) && y.Value == recoveryToken)); + + if (!result.IsSuccess || list == null) + return (null, result); + + return (list.First(), result); + } + public (Guid?, IDomainResult) Update(UserDocument user) => UpdateWithPredicate(user, x => x.Id == user.Id); diff --git a/webapi/DataProviders/Converters/EnumerationListSerializer.cs b/src/DataProviders/Converters/EnumerationListSerializer.cs similarity index 100% rename from webapi/DataProviders/Converters/EnumerationListSerializer.cs rename to src/DataProviders/Converters/EnumerationListSerializer.cs diff --git a/webapi/DataProviders/Converters/EnumerationSerializer.cs b/src/DataProviders/Converters/EnumerationSerializer.cs similarity index 100% rename from webapi/DataProviders/Converters/EnumerationSerializer.cs rename to src/DataProviders/Converters/EnumerationSerializer.cs diff --git a/webapi/DataProviders/DataProviders.csproj b/src/DataProviders/DataProviders.csproj similarity index 100% rename from webapi/DataProviders/DataProviders.csproj rename to src/DataProviders/DataProviders.csproj diff --git a/webapi/DataProviders/Extensions/ServiceCollectionExtensions.cs b/src/DataProviders/Extensions/ServiceCollectionExtensions.cs similarity index 100% rename from webapi/DataProviders/Extensions/ServiceCollectionExtensions.cs rename to src/DataProviders/Extensions/ServiceCollectionExtensions.cs diff --git a/webapi/DataProviders/IDataProvidersConfig.cs b/src/DataProviders/IDataProvidersConfig.cs similarity index 100% rename from webapi/DataProviders/IDataProvidersConfig.cs rename to src/DataProviders/IDataProvidersConfig.cs diff --git a/webapi/DataProviders/Mappings.cs b/src/DataProviders/Mappings.cs similarity index 93% rename from webapi/DataProviders/Mappings.cs rename to src/DataProviders/Mappings.cs index c2bda95..fc273d2 100644 --- a/webapi/DataProviders/Mappings.cs +++ b/src/DataProviders/Mappings.cs @@ -10,9 +10,11 @@ using DomainObjects.L10n; using DomainObjects.Enumerations; using DomainObjects.Pages; using DomainObjects.Documents; +using DomainObjects.Documents.User; -namespace DataProviders { - public class Mappings { +namespace DataProviders +{ + public class Mappings { public static void RegisterClassMap() { ConventionRegistry.Register("MyConventions", @@ -59,11 +61,7 @@ namespace DataProviders { #endregion #region Primitives - if (!BsonClassMap.IsClassMapRegistered(typeof(Address))) { - BsonClassMap.RegisterClassMap
(cm => { - cm.AutoMap(); - }); - } + if (!BsonClassMap.IsClassMapRegistered(typeof(Author))) { BsonClassMap.RegisterClassMap(cm => { @@ -83,14 +81,7 @@ namespace DataProviders { }); } - if (!BsonClassMap.IsClassMapRegistered(typeof(Contact))) { - BsonClassMap.RegisterClassMap(cm => { - cm.AutoMap(); - cm.GetMemberMap(c => c.Type) - .SetSerializer(new EnumerationSerializer()); - }); - } if (!BsonClassMap.IsClassMapRegistered(typeof(Feature))) { BsonClassMap.RegisterClassMap(cm => { @@ -143,11 +134,7 @@ namespace DataProviders { }); } - if (!BsonClassMap.IsClassMapRegistered(typeof(Passwords))) { - BsonClassMap.RegisterClassMap(cm => { - cm.AutoMap(); - }); - } + if (!BsonClassMap.IsClassMapRegistered(typeof(Route))) { @@ -348,14 +335,53 @@ namespace DataProviders { #endregion #region User - if (!BsonClassMap.IsClassMapRegistered(typeof(UserDocument))) { - BsonClassMap.RegisterClassMap(cm => { + if (!BsonClassMap.IsClassMapRegistered(typeof(Site))) { + BsonClassMap.RegisterClassMap(cm => { cm.AutoMap(); cm.GetMemberMap(c => c.Role) .SetSerializer(new EnumerationSerializer()); }); } + + if (!BsonClassMap.IsClassMapRegistered(typeof(Password))) { + BsonClassMap.RegisterClassMap(cm => { + cm.AutoMap(); + }); + } + + if (!BsonClassMap.IsClassMapRegistered(typeof(Authentication))) { + BsonClassMap.RegisterClassMap(cm => { + cm.AutoMap(); + }); + } + + if (!BsonClassMap.IsClassMapRegistered(typeof(Contact))) { + BsonClassMap.RegisterClassMap(cm => { + cm.AutoMap(); + + cm.GetMemberMap(c => c.Type) + .SetSerializer(new EnumerationSerializer()); + }); + } + + if (!BsonClassMap.IsClassMapRegistered(typeof(Address))) { + BsonClassMap.RegisterClassMap
(cm => { + cm.AutoMap(); + }); + } + + if (!BsonClassMap.IsClassMapRegistered(typeof(AuthenticationToken))) { + BsonClassMap.RegisterClassMap(cm => { + cm.AutoMap(); + }); + } + + if (!BsonClassMap.IsClassMapRegistered(typeof(UserDocument))) { + BsonClassMap.RegisterClassMap(cm => { + cm.AutoMap(); + }); + } #endregion } } diff --git a/webapi/DataProviders/SessionService.cs b/src/DataProviders/SessionService.cs similarity index 100% rename from webapi/DataProviders/SessionService.cs rename to src/DataProviders/SessionService.cs diff --git a/src/DomainObjects/Abstractions/AddressSectionBase.cs b/src/DomainObjects/Abstractions/AddressSectionBase.cs index 0926a92..7d82b3d 100644 --- a/src/DomainObjects/Abstractions/AddressSectionBase.cs +++ b/src/DomainObjects/Abstractions/AddressSectionBase.cs @@ -13,5 +13,4 @@ public abstract class AddressSectionBase : PageSectionBase { public FormItem City { get; set; } public FormItem Zip { get; set; } - } diff --git a/src/DomainObjects/Address.cs b/src/DomainObjects/Address.cs deleted file mode 100644 index c0f5a18..0000000 --- a/src/DomainObjects/Address.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace DomainObjects; - -public class Address { - public string Street { get; set; } - public string City { get; set; } - public string PostCode { get; set; } - public string Country { get; set; } -} diff --git a/src/DomainObjects/Contact.cs b/src/DomainObjects/Contact.cs index 2ffaae5..c01ca1a 100644 --- a/src/DomainObjects/Contact.cs +++ b/src/DomainObjects/Contact.cs @@ -7,6 +7,7 @@ public class Contact : DomainObjectBase { public ContactTypes Type { get; set; } public string Value { get; set; } public bool Confirmed { get; set; } + public bool? Primary { get; set; } public override int GetHashCode() { throw new NotImplementedException(); diff --git a/src/DomainObjects/Documents/User/Address.cs b/src/DomainObjects/Documents/User/Address.cs new file mode 100644 index 0000000..999afb1 --- /dev/null +++ b/src/DomainObjects/Documents/User/Address.cs @@ -0,0 +1,9 @@ +namespace DomainObjects.Documents.User; + +public class Address +{ + public string Street { get; set; } + public string City { get; set; } + public string PostCode { get; set; } + public string Country { get; set; } +} diff --git a/src/DomainObjects/Documents/User/Authentication.cs b/src/DomainObjects/Documents/User/Authentication.cs new file mode 100644 index 0000000..614acec --- /dev/null +++ b/src/DomainObjects/Documents/User/Authentication.cs @@ -0,0 +1,79 @@ +using DomainObjects.Abstractions; + +namespace DomainObjects.Documents.User; + +public class Authentication : DomainObjectBase { + + /// + /// Password object + /// + public Password? Password { get; set; } + + /// + /// Password expiration optons + /// + public PasswordExpiration Expiration { get; set; } + + /// + /// List of expired passwords + /// + public List Expired { get; set; } + + + + + /// + /// Generates recovery token and saves it in database + /// + /// + public string? PasswordRecovery() => Password?.Recovery(); + + /// + /// Verify if password recovery token exists and sets new password + /// + /// + /// + public void PasswordReset(string token, string password) { + if (Password != null) { + var oldPassword = Password.Prototype(); + if (Password.Reset(token, password)) + Expired.Add(oldPassword); + } + } + + + public void PasswordChange(string oldPassword, string newPassword) { + if (Password != null && Password.Validate(oldPassword)) { + Expired.Add(Password.Prototype()); + Password = new Password(newPassword); + } + } + + + + + /// + /// By providing password, system checks if its hash is same with the stored one + /// + /// + /// + public bool ValidatePassword(string password) { + + // Check password expiration if enabled + if (Expiration.Enabled && DateTime.UtcNow > Password?.Created.AddDays(Expiration.Days)) { + Expired.Add(Password.Prototype()); + Password = null; + + return false; + } + else + return Password?.Validate(password) ?? false; + } + + + + + public override int GetHashCode() { + throw new NotImplementedException(); + } +} diff --git a/src/DomainObjects/Token.cs b/src/DomainObjects/Documents/User/AuthenticationToken.cs similarity index 56% rename from src/DomainObjects/Token.cs rename to src/DomainObjects/Documents/User/AuthenticationToken.cs index 6154102..9745d01 100644 --- a/src/DomainObjects/Token.cs +++ b/src/DomainObjects/Documents/User/AuthenticationToken.cs @@ -1,13 +1,13 @@ using DomainObjects.Abstractions; -namespace DomainObjects; +namespace DomainObjects.Documents.User; -public class Token : DomainObjectBase { +public class AuthenticationToken : DomainObjectBase { public string Value { get; set; } public DateTime Created { get; set; } public DateTime Expires { get; set; } - public override int GetHashCode() { +public override int GetHashCode() { throw new NotImplementedException(); - } +} } diff --git a/src/DomainObjects/Documents/User/Password.cs b/src/DomainObjects/Documents/User/Password.cs new file mode 100644 index 0000000..3627019 --- /dev/null +++ b/src/DomainObjects/Documents/User/Password.cs @@ -0,0 +1,126 @@ +using DomainObjects.Abstractions; + +using CryptoProvider; + +namespace DomainObjects.Documents.User; + +public class Password : DomainObjectBase { + + public string Hash { get; set; } + + public string Salt { get; set; } + + public DateTime Created { get; set; } + + /// + /// null if never + /// + public DateTime? Expires { get; set; } + + public List? RecoveryTokens { get; set; } + + /// + /// + /// + /// + public Password(string password) => Set(password); + + /// + /// + /// + /// + /// + public Password(string password, DateTime expires) => Set(password, expires); + + + /// + /// + /// + /// + /// + /// + private Password(string salt, string hash, DateTime created, DateTime? expires) { + Hash = hash; + Salt = salt; + Created = created; + Expires = expires; + } + + /// + /// Generates recovery token and saves it in database + /// + /// + public string Recovery() { + var recoveryToken = new PasswordRecoveryToken(); + RecoveryTokens.Add(recoveryToken); + + return recoveryToken.Value; + } + + /// + /// Sets new password if recovery token exists in database and is not expired + /// + /// + /// + /// + public bool Reset(string token, string password) { + if (RecoveryTokens.Any(x => x.Value == token && !(DateTime.UtcNow > x.Expires))) { + Set(password); + RecoveryTokens.Clear(); + + return true; + } + + return false; + } + + + + /// + /// Sets new password + /// + /// + private void Set(string password) => + Set(password, null); + + + /// + /// Sets new password + /// + /// + private void Set(string password, DateTime expires) => + Set(password, expires); + + /// + /// + /// + /// + /// + private void Set(string password, DateTime? expires) { + var (salt, hash) = HashService.CreateSaltedHash(password); + + Hash = hash; + Salt = salt; + Created = DateTime.UtcNow; + Expires = expires; + + RecoveryTokens = new List(); + } + + /// + /// Password hash validation + /// + /// + /// + public bool Validate(string password) => HashService.ValidateHash(password, Salt, Hash); + + /// + /// Password object clone method + /// + /// + public Password Prototype() => new(Hash, Salt, Created, Expires); + + public override int GetHashCode() { + throw new NotImplementedException(); + } +} diff --git a/src/DomainObjects/PasswordExpiration.cs b/src/DomainObjects/Documents/User/PasswordExpiration.cs similarity index 86% rename from src/DomainObjects/PasswordExpiration.cs rename to src/DomainObjects/Documents/User/PasswordExpiration.cs index da3175e..5fbe914 100644 --- a/src/DomainObjects/PasswordExpiration.cs +++ b/src/DomainObjects/Documents/User/PasswordExpiration.cs @@ -1,6 +1,6 @@ using DomainObjects.Abstractions; -namespace DomainObjects; +namespace DomainObjects.Documents.User; public class PasswordExpiration : DomainObjectBase { public bool Enabled { get; set; } diff --git a/src/DomainObjects/Documents/User/PasswordRecoveryToken.cs b/src/DomainObjects/Documents/User/PasswordRecoveryToken.cs new file mode 100644 index 0000000..30d3186 --- /dev/null +++ b/src/DomainObjects/Documents/User/PasswordRecoveryToken.cs @@ -0,0 +1,20 @@ +using CryptoProvider; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DomainObjects.Documents.User; +public class PasswordRecoveryToken { + public string Value { get; set; } + + public DateTime Created { get; set; } + public DateTime Expires { get; set; } + + public PasswordRecoveryToken() { + Value = RandomService.SecureRandomString(20); + Created = DateTime.UtcNow; + Expires = Created.AddMinutes(5); + } +} \ No newline at end of file diff --git a/src/DomainObjects/Documents/User/Roles.cs b/src/DomainObjects/Documents/User/Roles.cs new file mode 100644 index 0000000..96437a9 --- /dev/null +++ b/src/DomainObjects/Documents/User/Roles.cs @@ -0,0 +1,45 @@ +using Core.Abstractions; + +namespace DomainObjects.Documents.User; + +public class Roles : Enumeration +{ + + /// + /// The most powerful user role because it gives you access to everything. As the website owner, this should be your role + /// + public static readonly Roles Admin = new(0, "Admin"); + + /// + /// This user is typically responsible for managing content. Editors can add, edit, publish, and delete any posts and media, including those written by other users. Editors can also moderate, edit, and delete comments, and add and edit categories and tags + /// + public static readonly Roles Editor = new(1, "Editor"); + + /// + /// Typically responsible for tasks related to writing content. They can create, edit, and publish their own posts. They can also delete their own posts (even when they’re already published), but cannot edit or delete posts written by other user + /// + public static readonly Roles Author = new(2, "Author"); + + /// + /// The contributor is a more basic version of the author role. Contributors can perform three tasks on your site: read all posts, create and edit their own posts, and delete their own posts. However, this role stops short of allowing them to directly publish their posts on your site. This gives you a chance to review and have final control over any content they create before it goes live + /// + public static readonly Roles Contributor = new(3, "Contributor"); + + /// + /// Assigned to new users if you enable registrations on your site. This role has the least number of permissions. Users are only able to update their own profile, read the content on your site, and leave comments + /// + public static readonly Roles Subscriber = new(4, "Subscriber"); + + /// + /// Assigned to new customers when they create an account on your website. This role is basically equivalent to that of a normal blog subscriber, but customers can edit their own account information and view past or current orders + /// + public static readonly Roles Customer = new(5, "Customer"); + + /// + /// This allows the user to run the operations side of your store without the ability to edit back-end functionality like files and code. A manager has the same permissions as a customer, plus they’re also granted the ability to manage all settings within eCommerce, create/edit products, and access all eCommerce reports. Important: They ALSO have access to the site editor capabilities mentioned above + /// + public static readonly Roles ShopManager = new(6, "Shop manager"); + + private Roles(int id, string displayName) : base(id, displayName) { } + +} diff --git a/src/DomainObjects/Documents/User/Site.cs b/src/DomainObjects/Documents/User/Site.cs new file mode 100644 index 0000000..b9c1fae --- /dev/null +++ b/src/DomainObjects/Documents/User/Site.cs @@ -0,0 +1,16 @@ +using DomainObjects.Abstractions; + +namespace DomainObjects.Documents.User +{ + public class Site : DomainObjectBase { + public Guid SiteId { get; set; } + + public List Hosts { get; set; } + + public Roles Role { get; set; } + + public override int GetHashCode() { + throw new NotImplementedException(); + } + } +} diff --git a/src/DomainObjects/Documents/User/UserDocument.cs b/src/DomainObjects/Documents/User/UserDocument.cs new file mode 100644 index 0000000..780c0ad --- /dev/null +++ b/src/DomainObjects/Documents/User/UserDocument.cs @@ -0,0 +1,75 @@ +using CryptoProvider; +using DomainObjects.Abstractions; + +namespace DomainObjects.Documents.User; + +public class UserDocument : DomainObjectDocumentBase { + + public List Sites { get; set; } + + public DateTime Created { get; set; } + + public string Username { get; set; } + + public Authentication Authentication { get; set; } + + public string Name { get; set; } + + public string LastName { get; set; } + + public List Contacts { get; set; } + + public Address BillingAddress { get; set; } + + public Address ShippingAddress { get; set; } + + public List Tokens { get; set; } + + /// + /// By providing encryption parameters and token, system checks if this token is whitelisted + /// + /// + /// + /// + /// + public bool ValidateToken(string iv, string key, string token) => + !Tokens.Select(x => AesService.DecryptString(iv, key, x.Value)).Any(x => string.Compare(x, token) == 0); + + /// + /// + /// + /// + /// + /// + /// + /// + public string AddToken(string iv, string key, string secret, int daysExpires) { + + // Clean up old tokens + Tokens = Tokens.Where(x => x.Expires > DateTime.UtcNow).OrderByDescending(x => x.Expires).Take(9).ToList(); + + // Creating JWT token + var claims = new List> { + new KeyValuePair("unique_name", $"{Id}"), + + // (JWT ID): Unique identifier; can be used to prevent the JWT from being replayed (allows a token to be used only once) + new KeyValuePair("jti", $"{Guid.NewGuid()}") + }; + + var created = DateTime.UtcNow; + var expires = created.AddDays(daysExpires); + var token = JwtService.CreateJwtToken(secret, expires, claims); + + Tokens.Add(new AuthenticationToken { + Created = created, + Expires = expires, + Value = AesService.EncryptString(iv, key, token) + }); + + return token; + } + + public override int GetHashCode() { + throw new NotImplementedException(); + } +} diff --git a/src/DomainObjects/Documents/UserDocument.cs b/src/DomainObjects/Documents/UserDocument.cs deleted file mode 100644 index f8154ec..0000000 --- a/src/DomainObjects/Documents/UserDocument.cs +++ /dev/null @@ -1,40 +0,0 @@ -using DomainObjects.Abstractions; -using DomainObjects.Enumerations; - -namespace DomainObjects.Documents; - -public class UserDocument : DomainObjectDocumentBase { - - public List Sites { get; set; } - - public DateTime Created { get; set; } - - public string Username { get; set; } - - public Passwords Passwords { get; set; } - - public string Name { get; set; } - - public string LastName { get; set; } - - public List Contacts { get; set; } - - public Address BillingAddress { get; set; } - - public Address ShippingAddress { get; set; } - - public List Tokens { get; set; } - - public Roles Role { get; set; } - - public void SetPassword (string password) { - if (Passwords.Password != null) - Passwords.Expired.Add(Passwords.Password.Prototype()); - - Passwords.Password = new Password(password); - } - - public override int GetHashCode() { - throw new NotImplementedException(); - } -} diff --git a/src/DomainObjects/DomainObjects.csproj b/src/DomainObjects/DomainObjects.csproj index 535d503..10fbe79 100644 --- a/src/DomainObjects/DomainObjects.csproj +++ b/src/DomainObjects/DomainObjects.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/DomainObjects/Enumerations/Roles.cs b/src/DomainObjects/Enumerations/Roles.cs deleted file mode 100644 index 6bcfec0..0000000 --- a/src/DomainObjects/Enumerations/Roles.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Core.Abstractions; - -namespace DomainObjects.Enumerations; - -public class Roles : Enumeration { - - /// - /// The most powerful user role because it gives you access to everything. As the website owner, this should be your role - /// - public static readonly Roles Admin = new(0, "Admin"); - - /// - /// This user is typically responsible for managing content. Editors can add, edit, publish, and delete any posts and media, including those written by other users. Editors can also moderate, edit, and delete comments, and add and edit categories and tags - /// - public static readonly Roles Editor = new(1, "Editor"); - - /// - /// Typically responsible for tasks related to writing content. They can create, edit, and publish their own posts. They can also delete their own posts (even when they’re already published), but cannot edit or delete posts written by other user - /// - public static readonly Roles Author = new(2, "Author"); - - /// - /// The contributor is a more basic version of the author role. Contributors can perform three tasks on your site: read all posts, create and edit their own posts, and delete their own posts. However, this role stops short of allowing them to directly publish their posts on your site. This gives you a chance to review and have final control over any content they create before it goes live - /// - public static readonly Roles Contributor = new(3, "Contributor"); - - /// - /// Assigned to new users if you enable registrations on your site. This role has the least number of permissions. Users are only able to update their own profile, read the content on your site, and leave comments - /// - public static readonly Roles Subscriber = new(4, "Subscriber"); - - /// - /// Assigned to new customers when they create an account on your website. This role is basically equivalent to that of a normal blog subscriber, but customers can edit their own account information and view past or current orders - /// - public static readonly Roles Customer = new(5, "Customer"); - - /// - /// This allows the user to run the operations side of your store without the ability to edit back-end functionality like files and code. A manager has the same permissions as a customer, plus they’re also granted the ability to manage all settings within eCommerce, create/edit products, and access all eCommerce reports. Important: They ALSO have access to the site editor capabilities mentioned above - /// - public static readonly Roles ShopManager = new(6, "Shop manager"); - - private Roles(int id, string displayName) : base(id, displayName) { } - -} diff --git a/src/DomainObjects/Password.cs b/src/DomainObjects/Password.cs deleted file mode 100644 index dd55949..0000000 --- a/src/DomainObjects/Password.cs +++ /dev/null @@ -1,35 +0,0 @@ -using DomainObjects.Abstractions; - -using CryptoProvider; - -namespace DomainObjects; - -public class Password : DomainObjectBase { - - public string Hash { get; } - - public string Salt { get; } - - public DateTime Created { get; } - - - public Password(string password) { - var (salt, hash) = HashService.CreateSaltedHash(password); - - Hash = hash; - Salt = salt; - Created = DateTime.UtcNow; - } - - private Password(string salt, string hash, DateTime created) { - Hash = hash; - Salt = salt; - Created = created; - } - - public Password Prototype() => new (Hash, Salt, Created); - - public override int GetHashCode() { - throw new NotImplementedException(); - } -} diff --git a/src/DomainObjects/Passwords.cs b/src/DomainObjects/Passwords.cs deleted file mode 100644 index f850d52..0000000 --- a/src/DomainObjects/Passwords.cs +++ /dev/null @@ -1,16 +0,0 @@ -using DomainObjects.Abstractions; - -namespace DomainObjects; - -public class Passwords : DomainObjectBase { - - public Password? Password { get; set; } - - public PasswordExpiration Expiration { get; set; } - - public List Expired { get; set; } - - public override int GetHashCode() { - throw new NotImplementedException(); - } -} diff --git a/src/EmailProvider/EmailMessageBuilder.cs b/src/EmailProvider/EmailMessageBuilder.cs index 5a16b01..a8eb2fb 100644 --- a/src/EmailProvider/EmailMessageBuilder.cs +++ b/src/EmailProvider/EmailMessageBuilder.cs @@ -1,27 +1,52 @@ using MimeKit; +using MimeKit.Cryptography; using System.Diagnostics.CodeAnalysis; + + + namespace EmailProvider { public interface IEmailMessageBuilder { } + + /// + /// openssl genrsa -out maks-it.com 2048 + /// openssl rsa -in maks-it.com -pubout > maks-it.com.pub + /// openssl rsa -in maks-it.com -pubout -outform der 2>/dev/null | openssl base64 -A + /// public class EmailMessageBuilder : IEmailMessageBuilder { private MimeMessage _mimeMessage; - public EmailMessageBuilder() => Initialize(); + + + public EmailMessageBuilder() => Initialize(null); public EmailMessageBuilder(byte[] bytes) => Initialize(bytes); - public void Initialize() => _mimeMessage = new MimeMessage(); + public void Initialize(byte[]? bytes) { - public void Initialize(byte[] bytes) { - using var stream = new MemoryStream(bytes); - _mimeMessage = new MimeMessage(stream); + if (bytes != null) { + using var stream = new MemoryStream(bytes); + _mimeMessage = MimeMessage.Load(stream); + } + else { + _mimeMessage = new MimeMessage(); + } } + //public void AddHeaders() => + // _mimeMessage.Headers.Add(new Header("", "")) + + public void AddFrom(string name, string address) => + _mimeMessage.From.Add(new MailboxAddress(name, address)); + + public void AddTo(string name, string address) => + _mimeMessage.To.Add(new MailboxAddress(name, address)); + public void AddTos(Dictionary tos) { foreach (var address in tos) _mimeMessage.To.Add(new MailboxAddress(address.Value, address.Key)); @@ -51,7 +76,21 @@ namespace EmailProvider { _mimeMessage.Body = bodyBuilder.ToMessageBody(); } + public void DkimSign(string domain, string selector, string privateKeyPath) { + new DkimSigner( + privateKeyPath, + domain, + selector + ) { + HeaderCanonicalizationAlgorithm = DkimCanonicalizationAlgorithm.Simple, + BodyCanonicalizationAlgorithm = DkimCanonicalizationAlgorithm.Simple, + AgentOrUserIdentifier = $"@{domain}", // your domain name + QueryMethod = "dns/txt", + }.Sign(_mimeMessage, new HeaderId[] { HeaderId.From, HeaderId.Subject, HeaderId.To }); + } + public byte [] Build() { + using var stream = new MemoryStream(); _mimeMessage.WriteTo(stream); return stream.ToArray(); diff --git a/src/EmailProvider/SMTPService.cs b/src/EmailProvider/SMTPService.cs index ad402ca..b4b24dd 100644 --- a/src/EmailProvider/SMTPService.cs +++ b/src/EmailProvider/SMTPService.cs @@ -10,9 +10,16 @@ namespace EmailProvider { _client = new SmtpClient(); } + public void Authenticate(string userName, string password) => + _client.Authenticate(userName, password); + + public void Connect(string host, uint port, bool useSsl) => + _client.Connect(host, (int)port, useSsl); + + public void Send(byte[] message) { using var ms = new MemoryStream(message); - var mimeMessage = new MimeMessage(ms); + var mimeMessage = MimeMessage.Load(ms); _client.Send(mimeMessage); } diff --git a/webapi/Extensions/BytesExtensions.cs b/src/Extensions/BytesExtensions.cs similarity index 100% rename from webapi/Extensions/BytesExtensions.cs rename to src/Extensions/BytesExtensions.cs diff --git a/webapi/Extensions/Extensions.csproj b/src/Extensions/Extensions.csproj similarity index 100% rename from webapi/Extensions/Extensions.csproj rename to src/Extensions/Extensions.csproj diff --git a/webapi/Extensions/IEnumerableExtensions.cs b/src/Extensions/IEnumerableExtensions.cs similarity index 100% rename from webapi/Extensions/IEnumerableExtensions.cs rename to src/Extensions/IEnumerableExtensions.cs diff --git a/webapi/Extensions/IEquatableExtensions.cs b/src/Extensions/IEquatableExtensions.cs similarity index 98% rename from webapi/Extensions/IEquatableExtensions.cs rename to src/Extensions/IEquatableExtensions.cs index 2a79c0d..a54e4ce 100644 --- a/webapi/Extensions/IEquatableExtensions.cs +++ b/src/Extensions/IEquatableExtensions.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace ExtensionMethods { +namespace Extensions { public static class IEquatableExtensions { /// /// diff --git a/webapi/Extensions/ObjectExtensions.cs b/src/Extensions/ObjectExtensions.cs similarity index 95% rename from webapi/Extensions/ObjectExtensions.cs rename to src/Extensions/ObjectExtensions.cs index 0ef0c34..c45ebef 100644 --- a/webapi/Extensions/ObjectExtensions.cs +++ b/src/Extensions/ObjectExtensions.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace ExtensionMethods { +namespace Extensions { public static class ObjectExtensions { /// diff --git a/webapi/Extensions/StringExtensions.cs b/src/Extensions/StringExtensions.cs similarity index 99% rename from webapi/Extensions/StringExtensions.cs rename to src/Extensions/StringExtensions.cs index 274e39b..e4e193f 100644 --- a/webapi/Extensions/StringExtensions.cs +++ b/src/Extensions/StringExtensions.cs @@ -1,14 +1,11 @@ -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; +using System.Text; using System.Text.RegularExpressions; using System.Globalization; using System.Security.Cryptography; using System.ComponentModel.DataAnnotations; using System.Text.Json; -namespace ExtensionMethods { +namespace Extensions { public static class StringExtensions { /// diff --git a/webapi/Services/FileSecurityService/Extensions/ServiceCollectionExtensions.cs b/src/FileSecurityService/Extensions/ServiceCollectionExtensions.cs similarity index 100% rename from webapi/Services/FileSecurityService/Extensions/ServiceCollectionExtensions.cs rename to src/FileSecurityService/Extensions/ServiceCollectionExtensions.cs diff --git a/webapi/Services/FileSecurityService/FileSecurityService.cs b/src/FileSecurityService/FileSecurityService.cs similarity index 99% rename from webapi/Services/FileSecurityService/FileSecurityService.cs rename to src/FileSecurityService/FileSecurityService.cs index 21b00ae..d06df4d 100644 --- a/webapi/Services/FileSecurityService/FileSecurityService.cs +++ b/src/FileSecurityService/FileSecurityService.cs @@ -1,6 +1,6 @@ using Core.Enumerations; using DomainResults.Common; -using ExtensionMethods; +using Extensions; using Extensions; namespace FileSecurityService { diff --git a/webapi/Services/FileSecurityService/FileSecurityService.csproj b/src/FileSecurityService/FileSecurityService.csproj similarity index 79% rename from webapi/Services/FileSecurityService/FileSecurityService.csproj rename to src/FileSecurityService/FileSecurityService.csproj index 5c219bf..b1fa739 100644 --- a/webapi/Services/FileSecurityService/FileSecurityService.csproj +++ b/src/FileSecurityService/FileSecurityService.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/webapi/Services/FileSecurityService/FileSignature.cs b/src/FileSecurityService/FileSignature.cs similarity index 100% rename from webapi/Services/FileSecurityService/FileSignature.cs rename to src/FileSecurityService/FileSignature.cs diff --git a/webapi/ImageProvider/Extensions/IImageProcessingContextExtensions.cs b/src/ImageProvider/Extensions/IImageProcessingContextExtensions.cs similarity index 100% rename from webapi/ImageProvider/Extensions/IImageProcessingContextExtensions.cs rename to src/ImageProvider/Extensions/IImageProcessingContextExtensions.cs diff --git a/webapi/ImageProvider/Extensions/ServiceCollectionExtensions.cs b/src/ImageProvider/Extensions/ServiceCollectionExtensions.cs similarity index 100% rename from webapi/ImageProvider/Extensions/ServiceCollectionExtensions.cs rename to src/ImageProvider/Extensions/ServiceCollectionExtensions.cs diff --git a/webapi/ImageProvider/Fonts/FontStylesEnum.cs b/src/ImageProvider/Fonts/FontStylesEnum.cs similarity index 100% rename from webapi/ImageProvider/Fonts/FontStylesEnum.cs rename to src/ImageProvider/Fonts/FontStylesEnum.cs diff --git a/webapi/ImageProvider/Fonts/FontsEnum.cs b/src/ImageProvider/Fonts/FontsEnum.cs similarity index 100% rename from webapi/ImageProvider/Fonts/FontsEnum.cs rename to src/ImageProvider/Fonts/FontsEnum.cs diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-Black.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-Black.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-Black.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-Black.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-BlackItalic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-BlackItalic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-BlackItalic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-BlackItalic.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-Bold.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-Bold.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-Bold.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-Bold.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-BoldItalic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-BoldItalic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-BoldItalic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-BoldItalic.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-ExtraBold.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-ExtraBold.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-ExtraBold.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-ExtraBold.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-ExtraBoldItalic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-ExtraBoldItalic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-ExtraBoldItalic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-ExtraBoldItalic.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-ExtraLight.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-ExtraLight.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-ExtraLight.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-ExtraLight.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-ExtraLightItalic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-ExtraLightItalic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-ExtraLightItalic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-ExtraLightItalic.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-Italic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-Italic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-Italic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-Italic.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-Light.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-Light.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-Light.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-Light.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-LightItalic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-LightItalic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-LightItalic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-LightItalic.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-Medium.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-Medium.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-Medium.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-Medium.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-MediumItalic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-MediumItalic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-MediumItalic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-MediumItalic.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-Regular.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-Regular.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-Regular.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-Regular.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-SemiBold.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-SemiBold.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-SemiBold.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-SemiBold.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-SemiBoldItalic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-SemiBoldItalic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-SemiBoldItalic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-SemiBoldItalic.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-Thin.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-Thin.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-Thin.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-Thin.ttf diff --git a/webapi/ImageProvider/Fonts/Montserrat/Montserrat-ThinItalic.ttf b/src/ImageProvider/Fonts/Montserrat/Montserrat-ThinItalic.ttf similarity index 100% rename from webapi/ImageProvider/Fonts/Montserrat/Montserrat-ThinItalic.ttf rename to src/ImageProvider/Fonts/Montserrat/Montserrat-ThinItalic.ttf diff --git a/webapi/ImageProvider/ImageBuilder.cs b/src/ImageProvider/ImageBuilder.cs similarity index 100% rename from webapi/ImageProvider/ImageBuilder.cs rename to src/ImageProvider/ImageBuilder.cs diff --git a/webapi/ImageProvider/ImageProvider.cs b/src/ImageProvider/ImageProvider.cs similarity index 100% rename from webapi/ImageProvider/ImageProvider.cs rename to src/ImageProvider/ImageProvider.cs diff --git a/webapi/ImageProvider/ImageProvider.csproj b/src/ImageProvider/ImageProvider.csproj similarity index 100% rename from webapi/ImageProvider/ImageProvider.csproj rename to src/ImageProvider/ImageProvider.csproj diff --git a/webapi/ReverseProxy/Dockerfile b/src/ReverseProxy/Dockerfile similarity index 86% rename from webapi/ReverseProxy/Dockerfile rename to src/ReverseProxy/Dockerfile index 016862f..c859d7c 100644 --- a/webapi/ReverseProxy/Dockerfile +++ b/src/ReverseProxy/Dockerfile @@ -1,11 +1,11 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src COPY ["ReverseProxy/ReverseProxy.csproj", "ReverseProxy/"] RUN dotnet restore "ReverseProxy/ReverseProxy.csproj" diff --git a/webapi/ReverseProxy/Program.cs b/src/ReverseProxy/Program.cs similarity index 100% rename from webapi/ReverseProxy/Program.cs rename to src/ReverseProxy/Program.cs diff --git a/webapi/ReverseProxy/Properties/launchSettings.json b/src/ReverseProxy/Properties/launchSettings.json similarity index 100% rename from webapi/ReverseProxy/Properties/launchSettings.json rename to src/ReverseProxy/Properties/launchSettings.json diff --git a/webapi/ReverseProxy/ReverseProxy.csproj b/src/ReverseProxy/ReverseProxy.csproj similarity index 100% rename from webapi/ReverseProxy/ReverseProxy.csproj rename to src/ReverseProxy/ReverseProxy.csproj diff --git a/webapi/ReverseProxy/appsettings.Development.json b/src/ReverseProxy/appsettings.Development.json similarity index 100% rename from webapi/ReverseProxy/appsettings.Development.json rename to src/ReverseProxy/appsettings.Development.json diff --git a/webapi/ReverseProxy/appsettings.json b/src/ReverseProxy/appsettings.json similarity index 100% rename from webapi/ReverseProxy/appsettings.json rename to src/ReverseProxy/appsettings.json diff --git a/webapi/Tests/Core/Abstractions/ConfigurationBase.cs b/src/Tests/Core/Abstractions/ConfigurationBase.cs similarity index 100% rename from webapi/Tests/Core/Abstractions/ConfigurationBase.cs rename to src/Tests/Core/Abstractions/ConfigurationBase.cs diff --git a/webapi/Tests/Core/Attributes/DefaultPriorityAttribute.cs b/src/Tests/Core/Attributes/DefaultPriorityAttribute.cs similarity index 100% rename from webapi/Tests/Core/Attributes/DefaultPriorityAttribute.cs rename to src/Tests/Core/Attributes/DefaultPriorityAttribute.cs diff --git a/webapi/Tests/Core/Attributes/PriorityAttribute.cs b/src/Tests/Core/Attributes/PriorityAttribute.cs similarity index 100% rename from webapi/Tests/Core/Attributes/PriorityAttribute.cs rename to src/Tests/Core/Attributes/PriorityAttribute.cs diff --git a/webapi/Tests/Core/CoreTests.csproj b/src/Tests/Core/CoreTests.csproj similarity index 100% rename from webapi/Tests/Core/CoreTests.csproj rename to src/Tests/Core/CoreTests.csproj diff --git a/webapi/Tests/Core/FakeServices/MessageFakeService.cs b/src/Tests/Core/FakeServices/MessageFakeService.cs similarity index 100% rename from webapi/Tests/Core/FakeServices/MessageFakeService.cs rename to src/Tests/Core/FakeServices/MessageFakeService.cs diff --git a/webapi/Tests/Core/FakeServices/ObjectStorageFakeService.cs b/src/Tests/Core/FakeServices/ObjectStorageFakeService.cs similarity index 100% rename from webapi/Tests/Core/FakeServices/ObjectStorageFakeService.cs rename to src/Tests/Core/FakeServices/ObjectStorageFakeService.cs diff --git a/webapi/Tests/Core/FakeServices/SessionFakeService.cs b/src/Tests/Core/FakeServices/SessionFakeService.cs similarity index 100% rename from webapi/Tests/Core/FakeServices/SessionFakeService.cs rename to src/Tests/Core/FakeServices/SessionFakeService.cs diff --git a/webapi/Tests/Core/FakeServices/VaultFakeService.cs b/src/Tests/Core/FakeServices/VaultFakeService.cs similarity index 100% rename from webapi/Tests/Core/FakeServices/VaultFakeService.cs rename to src/Tests/Core/FakeServices/VaultFakeService.cs diff --git a/webapi/Tests/Core/PriorityOrderer.cs b/src/Tests/Core/PriorityOrderer.cs similarity index 100% rename from webapi/Tests/Core/PriorityOrderer.cs rename to src/Tests/Core/PriorityOrderer.cs diff --git a/webapi/Tests/Extensions/Abstractions/ServiceBase.cs b/src/Tests/Extensions/Abstractions/ServiceBase.cs similarity index 100% rename from webapi/Tests/Extensions/Abstractions/ServiceBase.cs rename to src/Tests/Extensions/Abstractions/ServiceBase.cs diff --git a/webapi/Tests/Extensions/Configuration.cs b/src/Tests/Extensions/Configuration.cs similarity index 100% rename from webapi/Tests/Extensions/Configuration.cs rename to src/Tests/Extensions/Configuration.cs diff --git a/webapi/Tests/Extensions/ExtensionsTests.csproj b/src/Tests/Extensions/ExtensionsTests.csproj similarity index 100% rename from webapi/Tests/Extensions/ExtensionsTests.csproj rename to src/Tests/Extensions/ExtensionsTests.csproj diff --git a/webapi/Tests/Extensions/IEquatableExtensionsTests.cs b/src/Tests/Extensions/IEquatableExtensionsTests.cs similarity index 99% rename from webapi/Tests/Extensions/IEquatableExtensionsTests.cs rename to src/Tests/Extensions/IEquatableExtensionsTests.cs index edac496..dfa9951 100644 --- a/webapi/Tests/Extensions/IEquatableExtensionsTests.cs +++ b/src/Tests/Extensions/IEquatableExtensionsTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using ExtensionMethods; +using Extensions; using Xunit; diff --git a/webapi/Tests/Extensions/ObjectExtensionsTests.cs b/src/Tests/Extensions/ObjectExtensionsTests.cs similarity index 92% rename from webapi/Tests/Extensions/ObjectExtensionsTests.cs rename to src/Tests/Extensions/ObjectExtensionsTests.cs index bec3ef4..9df36a9 100644 --- a/webapi/Tests/Extensions/ObjectExtensionsTests.cs +++ b/src/Tests/Extensions/ObjectExtensionsTests.cs @@ -1,4 +1,4 @@ -using ExtensionMethods; +using Extensions; using Xunit; diff --git a/webapi/Tests/Extensions/StringExtensionsTests.cs b/src/Tests/Extensions/StringExtensionsTests.cs similarity index 99% rename from webapi/Tests/Extensions/StringExtensionsTests.cs rename to src/Tests/Extensions/StringExtensionsTests.cs index a1ed30d..69725d4 100644 --- a/webapi/Tests/Extensions/StringExtensionsTests.cs +++ b/src/Tests/Extensions/StringExtensionsTests.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.DependencyInjection; using Xunit; -using ExtensionMethods; +using Extensions; using ExtensionsTests.Abstractions; using System.IO; using System.Threading.Tasks; diff --git a/webapi/Tests/Extensions/appsettings.json b/src/Tests/Extensions/appsettings.json similarity index 100% rename from webapi/Tests/Extensions/appsettings.json rename to src/Tests/Extensions/appsettings.json diff --git a/webapi/WeatherForecast.sln b/src/WeatherForecast.sln similarity index 83% rename from webapi/WeatherForecast.sln rename to src/WeatherForecast.sln index 2adac89..e76c5c7 100644 --- a/webapi/WeatherForecast.sln +++ b/src/WeatherForecast.sln @@ -5,10 +5,6 @@ VisualStudioVersion = 17.0.31912.275 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WeatherForecast", "WeatherForecast\WeatherForecast.csproj", "{065AC673-3C4D-4C08-B1A9-3C3A1467B3A7}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{113EE574-E047-4727-AA36-841F845504D5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JWTService", "Services\JWTService\JWTService.csproj", "{B717D8BD-BCCA-4515-9A62-CA3BE802D0F7}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{BCDED8EB-97B0-4067-BB0A-23F94D1A1288}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataProviders", "DataProviders\DataProviders.csproj", "{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}" @@ -25,17 +21,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreTests", "Tests\Core\Cor EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageProvider", "ImageProvider\ImageProvider.csproj", "{16552644-D7EE-4B4A-A725-79909A8103DE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileSecurityService", "Services\FileSecurityService\FileSecurityService.csproj", "{AD515653-9145-4894-9017-0ABA5A5892F4}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReverseProxy", "ReverseProxy\ReverseProxy.csproj", "{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}" EndProject Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CryptoProvider", "CryptoProvider\CryptoProvider.csproj", "{E90379CB-BC2D-452F-9F92-24A7B46195D4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmailProvider", "..\src\EmailProvider\EmailProvider.csproj", "{12FFF647-FD61-465C-8B80-C0C3E40DCA21}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmailProvider", "EmailProvider\EmailProvider.csproj", "{12FFF647-FD61-465C-8B80-C0C3E40DCA21}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainObjects", "..\src\DomainObjects\DomainObjects.csproj", "{DB3E493A-ABCC-472A-9E6E-40A5C7C5B33D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DomainObjects", "DomainObjects\DomainObjects.csproj", "{DB3E493A-ABCC-472A-9E6E-40A5C7C5B33D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileSecurityService", "FileSecurityService\FileSecurityService.csproj", "{0973A77C-14FF-49F1-85E7-E451E2B0FE08}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -47,10 +43,6 @@ Global {065AC673-3C4D-4C08-B1A9-3C3A1467B3A7}.Debug|Any CPU.Build.0 = Debug|Any CPU {065AC673-3C4D-4C08-B1A9-3C3A1467B3A7}.Release|Any CPU.ActiveCfg = Release|Any CPU {065AC673-3C4D-4C08-B1A9-3C3A1467B3A7}.Release|Any CPU.Build.0 = Release|Any CPU - {B717D8BD-BCCA-4515-9A62-CA3BE802D0F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B717D8BD-BCCA-4515-9A62-CA3BE802D0F7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B717D8BD-BCCA-4515-9A62-CA3BE802D0F7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B717D8BD-BCCA-4515-9A62-CA3BE802D0F7}.Release|Any CPU.Build.0 = Release|Any CPU {BCDED8EB-97B0-4067-BB0A-23F94D1A1288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BCDED8EB-97B0-4067-BB0A-23F94D1A1288}.Debug|Any CPU.Build.0 = Debug|Any CPU {BCDED8EB-97B0-4067-BB0A-23F94D1A1288}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -79,10 +71,6 @@ Global {16552644-D7EE-4B4A-A725-79909A8103DE}.Debug|Any CPU.Build.0 = Debug|Any CPU {16552644-D7EE-4B4A-A725-79909A8103DE}.Release|Any CPU.ActiveCfg = Release|Any CPU {16552644-D7EE-4B4A-A725-79909A8103DE}.Release|Any CPU.Build.0 = Release|Any CPU - {AD515653-9145-4894-9017-0ABA5A5892F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD515653-9145-4894-9017-0ABA5A5892F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD515653-9145-4894-9017-0ABA5A5892F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD515653-9145-4894-9017-0ABA5A5892F4}.Release|Any CPU.Build.0 = Release|Any CPU {281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU {281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -103,15 +91,17 @@ Global {DB3E493A-ABCC-472A-9E6E-40A5C7C5B33D}.Debug|Any CPU.Build.0 = Debug|Any CPU {DB3E493A-ABCC-472A-9E6E-40A5C7C5B33D}.Release|Any CPU.ActiveCfg = Release|Any CPU {DB3E493A-ABCC-472A-9E6E-40A5C7C5B33D}.Release|Any CPU.Build.0 = Release|Any CPU + {0973A77C-14FF-49F1-85E7-E451E2B0FE08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0973A77C-14FF-49F1-85E7-E451E2B0FE08}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0973A77C-14FF-49F1-85E7-E451E2B0FE08}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0973A77C-14FF-49F1-85E7-E451E2B0FE08}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {B717D8BD-BCCA-4515-9A62-CA3BE802D0F7} = {113EE574-E047-4727-AA36-841F845504D5} {43315A1D-9E09-4398-84B9-A9D9D623AE5A} = {216302C2-64DE-4AE7-BC14-BDAC5B732472} {04CB9827-AA6D-4708-A26D-8420C842506D} = {216302C2-64DE-4AE7-BC14-BDAC5B732472} - {AD515653-9145-4894-9017-0ABA5A5892F4} = {113EE574-E047-4727-AA36-841F845504D5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E2805D02-2425-424C-921D-D97341B76F73} diff --git a/webapi/WeatherForecast/Configuration.cs b/src/WeatherForecast/Configuration.cs similarity index 58% rename from webapi/WeatherForecast/Configuration.cs rename to src/WeatherForecast/Configuration.cs index 688c861..c5d34ec 100644 --- a/webapi/WeatherForecast/Configuration.cs +++ b/src/WeatherForecast/Configuration.cs @@ -1,13 +1,23 @@ using CryptoProvider; using DataProviders; -using JWTService; namespace WeatherForecast { + public interface IJwtConfig { + + public string? Secret { get; set; } + public int? Expires { get; set; } + } + + public class JwtConfig : IJwtConfig { + public string? Secret { get; set; } + public int? Expires { get; set; } + } + /// /// /// - public class Configuration : IDataProvidersConfig, IJWTServiceConfig { + public class Configuration : IDataProvidersConfig { /// /// diff --git a/webapi/WeatherForecast/Controllers/AccountController.cs b/src/WeatherForecast/Controllers/AccountController.cs similarity index 87% rename from webapi/WeatherForecast/Controllers/AccountController.cs rename to src/WeatherForecast/Controllers/AccountController.cs index 72e7911..8eb83cf 100644 --- a/webapi/WeatherForecast/Controllers/AccountController.cs +++ b/src/WeatherForecast/Controllers/AccountController.cs @@ -6,7 +6,8 @@ using Microsoft.AspNetCore.Mvc; using WeatherForecast.Models.Account.Requests; using WeatherForecast.Policies; using WeatherForecast.Services; -using DomainObjects.Documents; +using DomainObjects.Documents.User; +using Microsoft.AspNetCore.Identity; namespace WeatherForecast.Controllers; @@ -61,26 +62,21 @@ public class AccountController : ControllerBase { /// [HttpPut($"{_password}/[action]")] public IActionResult Recovery([FromBody] PasswordRecoveryRequestModel requestData) { - return BadRequest(); + var result = _accountService.PasswordRecovery(requestData); + return result.ToActionResult(); } /// /// When the form is submitted with the new password and the token as inputs the reset password process will take place. - /// The form data will be sent with a PUT request again but this time including the token and we will replace the resource password with a new value + /// The form data will be sent with a PUT request again, but this time including the token and we will replace the resource password with a new value /// /// /// /// [HttpPut($"{_password}/[action]")] public IActionResult Reset([FromBody] PasswordResetRequestModel requestData) { - - /// here we find user by token provided in requestData - /// if ok we continue - /// - - - - return Unauthorized(); + var result = _accountService.PasswordReset(requestData); + return result.ToActionResult(); } #endregion @@ -101,7 +97,7 @@ public class AccountController : ControllerBase { if ((await _authorizationService.AuthorizeAsync(User, new List { user }, new PasswordChangeRequirement { OldPassword = requestData.OldPassword })).Succeeded) { - var result = _accountService.PasswordChange(user, requestData.NewPassword); + var result = _accountService.PasswordChange(user, requestData.OldPassword, requestData.NewPassword); return result.ToActionResult(); } diff --git a/webapi/WeatherForecast/Controllers/BlogItemController.cs b/src/WeatherForecast/Controllers/BlogItemController.cs similarity index 99% rename from webapi/WeatherForecast/Controllers/BlogItemController.cs rename to src/WeatherForecast/Controllers/BlogItemController.cs index 5acfa36..0dc2d9e 100644 --- a/webapi/WeatherForecast/Controllers/BlogItemController.cs +++ b/src/WeatherForecast/Controllers/BlogItemController.cs @@ -8,7 +8,7 @@ using WeatherForecast.Models.Blog.Requests; using WeatherForecast.Policies; using Core.Enumerations; using DataProviders.Collections; -using ExtensionMethods; +using Extensions; using DomainResults.Common; using DomainObjects.Documents; diff --git a/webapi/WeatherForecast/Controllers/BlogItemsController.cs b/src/WeatherForecast/Controllers/BlogItemsController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/BlogItemsController.cs rename to src/WeatherForecast/Controllers/BlogItemsController.cs diff --git a/webapi/WeatherForecast/Controllers/CategoryItemController.cs b/src/WeatherForecast/Controllers/CategoryItemController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/CategoryItemController.cs rename to src/WeatherForecast/Controllers/CategoryItemController.cs diff --git a/webapi/WeatherForecast/Controllers/CategoryItemsController.cs b/src/WeatherForecast/Controllers/CategoryItemsController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/CategoryItemsController.cs rename to src/WeatherForecast/Controllers/CategoryItemsController.cs diff --git a/webapi/WeatherForecast/Controllers/ContentController.cs b/src/WeatherForecast/Controllers/ContentController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/ContentController.cs rename to src/WeatherForecast/Controllers/ContentController.cs diff --git a/webapi/WeatherForecast/Controllers/FileController.cs b/src/WeatherForecast/Controllers/FileController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/FileController.cs rename to src/WeatherForecast/Controllers/FileController.cs diff --git a/webapi/WeatherForecast/Controllers/FilesController.cs b/src/WeatherForecast/Controllers/FilesController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/FilesController.cs rename to src/WeatherForecast/Controllers/FilesController.cs diff --git a/webapi/WeatherForecast/Controllers/ImageController.cs b/src/WeatherForecast/Controllers/ImageController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/ImageController.cs rename to src/WeatherForecast/Controllers/ImageController.cs diff --git a/webapi/WeatherForecast/Controllers/ShopCartItemController.cs b/src/WeatherForecast/Controllers/ShopCartItemController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/ShopCartItemController.cs rename to src/WeatherForecast/Controllers/ShopCartItemController.cs diff --git a/webapi/WeatherForecast/Controllers/ShopCartItemsController.cs b/src/WeatherForecast/Controllers/ShopCartItemsController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/ShopCartItemsController.cs rename to src/WeatherForecast/Controllers/ShopCartItemsController.cs diff --git a/webapi/WeatherForecast/Controllers/ShopItemController.cs b/src/WeatherForecast/Controllers/ShopItemController.cs similarity index 99% rename from webapi/WeatherForecast/Controllers/ShopItemController.cs rename to src/WeatherForecast/Controllers/ShopItemController.cs index 5961017..9398d56 100644 --- a/webapi/WeatherForecast/Controllers/ShopItemController.cs +++ b/src/WeatherForecast/Controllers/ShopItemController.cs @@ -10,7 +10,7 @@ using Core.Enumerations; using DataProviders.Collections; using DomainObjects.Documents; using DomainResults.Common; -using ExtensionMethods; +using Extensions; namespace WeatherForecast.Controllers; diff --git a/webapi/WeatherForecast/Controllers/ShopItemsController.cs b/src/WeatherForecast/Controllers/ShopItemsController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/ShopItemsController.cs rename to src/WeatherForecast/Controllers/ShopItemsController.cs diff --git a/webapi/WeatherForecast/Controllers/WeatherForecastController.cs b/src/WeatherForecast/Controllers/WeatherForecastController.cs similarity index 100% rename from webapi/WeatherForecast/Controllers/WeatherForecastController.cs rename to src/WeatherForecast/Controllers/WeatherForecastController.cs diff --git a/webapi/WeatherForecast/Dockerfile b/src/WeatherForecast/Dockerfile similarity index 91% rename from webapi/WeatherForecast/Dockerfile rename to src/WeatherForecast/Dockerfile index f0864d2..97c0d5d 100644 --- a/webapi/WeatherForecast/Dockerfile +++ b/src/WeatherForecast/Dockerfile @@ -1,11 +1,11 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src COPY ["WeatherForecast/WeatherForecast.csproj", "WeatherForecast/"] COPY ["Services/FileSecurityService/FileSecurityService.csproj", "Services/FileSecurityService/"] diff --git a/webapi/WeatherForecast/Models/Abstractions/AddressSectionModelBase.cs b/src/WeatherForecast/Models/Abstractions/AddressSectionModelBase.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/AddressSectionModelBase.cs rename to src/WeatherForecast/Models/Abstractions/AddressSectionModelBase.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PageModelBase.cs b/src/WeatherForecast/Models/Abstractions/PageModelBase.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PageModelBase.cs rename to src/WeatherForecast/Models/Abstractions/PageModelBase.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PageSectionModelBase.cs b/src/WeatherForecast/Models/Abstractions/PageSectionModelBase.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PageSectionModelBase.cs rename to src/WeatherForecast/Models/Abstractions/PageSectionModelBase.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PersonModelBase.cs b/src/WeatherForecast/Models/Abstractions/PersonModelBase.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PersonModelBase.cs rename to src/WeatherForecast/Models/Abstractions/PersonModelBase.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItem/Requests/MediaAttachmentL10nModel.cs b/src/WeatherForecast/Models/Abstractions/PostItem/Requests/MediaAttachmentL10nModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PostItem/Requests/MediaAttachmentL10nModel.cs rename to src/WeatherForecast/Models/Abstractions/PostItem/Requests/MediaAttachmentL10nModel.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItem/Requests/MediaAttachmentRequestModel.cs b/src/WeatherForecast/Models/Abstractions/PostItem/Requests/MediaAttachmentRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PostItem/Requests/MediaAttachmentRequestModel.cs rename to src/WeatherForecast/Models/Abstractions/PostItem/Requests/MediaAttachmentRequestModel.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItem/Requests/PostItemL10nModel.cs b/src/WeatherForecast/Models/Abstractions/PostItem/Requests/PostItemL10nModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PostItem/Requests/PostItemL10nModel.cs rename to src/WeatherForecast/Models/Abstractions/PostItem/Requests/PostItemL10nModel.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItem/Requests/PostItemRequestModelBase.cs b/src/WeatherForecast/Models/Abstractions/PostItem/Requests/PostItemRequestModelBase.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PostItem/Requests/PostItemRequestModelBase.cs rename to src/WeatherForecast/Models/Abstractions/PostItem/Requests/PostItemRequestModelBase.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItem/Responsens/MediaAttachmentL10nModel.cs b/src/WeatherForecast/Models/Abstractions/PostItem/Responsens/MediaAttachmentL10nModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PostItem/Responsens/MediaAttachmentL10nModel.cs rename to src/WeatherForecast/Models/Abstractions/PostItem/Responsens/MediaAttachmentL10nModel.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItem/Responsens/MediaAttachmentResponseModel.cs b/src/WeatherForecast/Models/Abstractions/PostItem/Responsens/MediaAttachmentResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PostItem/Responsens/MediaAttachmentResponseModel.cs rename to src/WeatherForecast/Models/Abstractions/PostItem/Responsens/MediaAttachmentResponseModel.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItem/Responsens/PostItemL10nModel.cs b/src/WeatherForecast/Models/Abstractions/PostItem/Responsens/PostItemL10nModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PostItem/Responsens/PostItemL10nModel.cs rename to src/WeatherForecast/Models/Abstractions/PostItem/Responsens/PostItemL10nModel.cs diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItem/Responsens/PostItemResponseModelBase.cs b/src/WeatherForecast/Models/Abstractions/PostItem/Responsens/PostItemResponseModelBase.cs similarity index 100% rename from webapi/WeatherForecast/Models/Abstractions/PostItem/Responsens/PostItemResponseModelBase.cs rename to src/WeatherForecast/Models/Abstractions/PostItem/Responsens/PostItemResponseModelBase.cs diff --git a/webapi/WeatherForecast/Models/Account/Requests/AuthenticationRequestModel.cs b/src/WeatherForecast/Models/Account/Requests/AuthenticationRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Account/Requests/AuthenticationRequestModel.cs rename to src/WeatherForecast/Models/Account/Requests/AuthenticationRequestModel.cs diff --git a/webapi/WeatherForecast/Models/Account/Requests/CreateAccountRequestModel.cs b/src/WeatherForecast/Models/Account/Requests/CreateAccountRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Account/Requests/CreateAccountRequestModel.cs rename to src/WeatherForecast/Models/Account/Requests/CreateAccountRequestModel.cs diff --git a/webapi/WeatherForecast/Models/Account/Requests/PasswordChangeRequestModel.cs b/src/WeatherForecast/Models/Account/Requests/PasswordChangeRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Account/Requests/PasswordChangeRequestModel.cs rename to src/WeatherForecast/Models/Account/Requests/PasswordChangeRequestModel.cs diff --git a/webapi/WeatherForecast/Models/Account/Requests/PasswordRecoveryRequestModel.cs b/src/WeatherForecast/Models/Account/Requests/PasswordRecoveryRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Account/Requests/PasswordRecoveryRequestModel.cs rename to src/WeatherForecast/Models/Account/Requests/PasswordRecoveryRequestModel.cs diff --git a/webapi/WeatherForecast/Models/Account/Requests/PasswordResetRequestModel.cs b/src/WeatherForecast/Models/Account/Requests/PasswordResetRequestModel.cs similarity index 66% rename from webapi/WeatherForecast/Models/Account/Requests/PasswordResetRequestModel.cs rename to src/WeatherForecast/Models/Account/Requests/PasswordResetRequestModel.cs index fd77a52..3a292a0 100644 --- a/webapi/WeatherForecast/Models/Account/Requests/PasswordResetRequestModel.cs +++ b/src/WeatherForecast/Models/Account/Requests/PasswordResetRequestModel.cs @@ -6,8 +6,10 @@ namespace WeatherForecast.Models.Account.Requests { public class PasswordResetRequestModel : RequestModelBase { public string Token { get; set; } + public string Password { get; set; } - + + public string RePassword { get; set; } public override IEnumerable Validate(ValidationContext validationContext) { @@ -16,6 +18,12 @@ namespace WeatherForecast.Models.Account.Requests { if (string.IsNullOrWhiteSpace(Password)) yield return new ValidationResult($"{nameof(Password)} ${Errors.NullOrEmpty}"); + + if (string.IsNullOrWhiteSpace(RePassword)) + yield return new ValidationResult($"{nameof(RePassword)} ${Errors.NullOrEmpty}"); + + if(string.Compare(Password, RePassword) != 0) + yield return new ValidationResult($"{nameof(Password)} and {nameof(RePassword)} ${Errors.NotMatched}"); } } } diff --git a/webapi/WeatherForecast/Models/AuthorModel.cs b/src/WeatherForecast/Models/AuthorModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/AuthorModel.cs rename to src/WeatherForecast/Models/AuthorModel.cs diff --git a/webapi/WeatherForecast/Models/BlogItem/Requests/BlogItemRequestModel.cs b/src/WeatherForecast/Models/BlogItem/Requests/BlogItemRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/BlogItem/Requests/BlogItemRequestModel.cs rename to src/WeatherForecast/Models/BlogItem/Requests/BlogItemRequestModel.cs diff --git a/webapi/WeatherForecast/Models/BlogItem/Responses/BlogItemResponseModel.cs b/src/WeatherForecast/Models/BlogItem/Responses/BlogItemResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/BlogItem/Responses/BlogItemResponseModel.cs rename to src/WeatherForecast/Models/BlogItem/Responses/BlogItemResponseModel.cs diff --git a/webapi/WeatherForecast/Models/BlogItem/Responses/BlogItemsResponseModel.cs b/src/WeatherForecast/Models/BlogItem/Responses/BlogItemsResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/BlogItem/Responses/BlogItemsResponseModel.cs rename to src/WeatherForecast/Models/BlogItem/Responses/BlogItemsResponseModel.cs diff --git a/webapi/WeatherForecast/Models/CategoryItem/Requests/CategoryItemRequestModel.cs b/src/WeatherForecast/Models/CategoryItem/Requests/CategoryItemRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/CategoryItem/Requests/CategoryItemRequestModel.cs rename to src/WeatherForecast/Models/CategoryItem/Requests/CategoryItemRequestModel.cs diff --git a/webapi/WeatherForecast/Models/CategoryItem/Requests/CategoryL10nModel.cs b/src/WeatherForecast/Models/CategoryItem/Requests/CategoryL10nModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/CategoryItem/Requests/CategoryL10nModel.cs rename to src/WeatherForecast/Models/CategoryItem/Requests/CategoryL10nModel.cs diff --git a/webapi/WeatherForecast/Models/CategoryItem/Responses/CategoryItemResponseModel.cs b/src/WeatherForecast/Models/CategoryItem/Responses/CategoryItemResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/CategoryItem/Responses/CategoryItemResponseModel.cs rename to src/WeatherForecast/Models/CategoryItem/Responses/CategoryItemResponseModel.cs diff --git a/webapi/WeatherForecast/Models/CategoryItem/Responses/CategoryL10nModel.cs b/src/WeatherForecast/Models/CategoryItem/Responses/CategoryL10nModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/CategoryItem/Responses/CategoryL10nModel.cs rename to src/WeatherForecast/Models/CategoryItem/Responses/CategoryL10nModel.cs diff --git a/webapi/WeatherForecast/Models/CommentModel.cs b/src/WeatherForecast/Models/CommentModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/CommentModel.cs rename to src/WeatherForecast/Models/CommentModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/ContentResponseModel.cs b/src/WeatherForecast/Models/Content/Responses/ContentResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/ContentResponseModel.cs rename to src/WeatherForecast/Models/Content/Responses/ContentResponseModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/BillingAddressSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/BillingAddressSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/BillingAddressSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/BillingAddressSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/CallToActionSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/CallToActionSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/CallToActionSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/CallToActionSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/CartProductsSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/CartProductsSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/CartProductsSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/CartProductsSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/CheckoutSettingsSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/CheckoutSettingsSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/CheckoutSettingsSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/CheckoutSettingsSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/CheckoutSummarySectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/CheckoutSummarySectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/CheckoutSummarySectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/CheckoutSummarySectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/CommentsSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/CommentsSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/CommentsSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/CommentsSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/FeaturedBlogSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/FeaturedBlogSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/FeaturedBlogSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/FeaturedBlogSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/FeaturedBologsSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/FeaturedBologsSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/FeaturedBologsSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/FeaturedBologsSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/FeaturesSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/FeaturesSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/FeaturesSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/FeaturesSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/PaymentSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/PaymentSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/PaymentSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/PaymentSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/ProductSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/ProductSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/ProductSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/ProductSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/RelatedProductsSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/RelatedProductsSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/RelatedProductsSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/RelatedProductsSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/ShippingAddressSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/ShippingAddressSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/ShippingAddressSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/ShippingAddressSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/ShopItemsSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/ShopItemsSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/ShopItemsSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/ShopItemsSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/TestimonialsSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/TestimonialsSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/TestimonialsSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/TestimonialsSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/PageSections/TitleSectionModel.cs b/src/WeatherForecast/Models/Content/Responses/PageSections/TitleSectionModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/PageSections/TitleSectionModel.cs rename to src/WeatherForecast/Models/Content/Responses/PageSections/TitleSectionModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/BlogCatalogPageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/BlogCatalogPageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/BlogCatalogPageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/BlogCatalogPageModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/BlogItemPageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/BlogItemPageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/BlogItemPageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/BlogItemPageModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/HomePageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/HomePageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/HomePageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/HomePageModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/ShopCartPageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/ShopCartPageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/ShopCartPageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/ShopCartPageModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/ShopCatalogPageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/ShopCatalogPageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/ShopCatalogPageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/ShopCatalogPageModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/ShopCheckoutPageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/ShopCheckoutPageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/ShopCheckoutPageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/ShopCheckoutPageModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/ShopItemPageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/ShopItemPageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/ShopItemPageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/ShopItemPageModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/SignInPageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/SignInPageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/SignInPageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/SignInPageModel.cs diff --git a/webapi/WeatherForecast/Models/Content/Responses/Pages/SignUpPageModel.cs b/src/WeatherForecast/Models/Content/Responses/Pages/SignUpPageModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Content/Responses/Pages/SignUpPageModel.cs rename to src/WeatherForecast/Models/Content/Responses/Pages/SignUpPageModel.cs diff --git a/webapi/WeatherForecast/Models/FeatureModel.cs b/src/WeatherForecast/Models/FeatureModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/FeatureModel.cs rename to src/WeatherForecast/Models/FeatureModel.cs diff --git a/webapi/WeatherForecast/Models/File/Responses/FileResponseModel.cs b/src/WeatherForecast/Models/File/Responses/FileResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/File/Responses/FileResponseModel.cs rename to src/WeatherForecast/Models/File/Responses/FileResponseModel.cs diff --git a/webapi/WeatherForecast/Models/FormItemModel.cs b/src/WeatherForecast/Models/FormItemModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/FormItemModel.cs rename to src/WeatherForecast/Models/FormItemModel.cs diff --git a/webapi/WeatherForecast/Models/HeaderModel.cs b/src/WeatherForecast/Models/HeaderModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/HeaderModel.cs rename to src/WeatherForecast/Models/HeaderModel.cs diff --git a/webapi/WeatherForecast/Models/LinkModel.cs b/src/WeatherForecast/Models/LinkModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/LinkModel.cs rename to src/WeatherForecast/Models/LinkModel.cs diff --git a/webapi/WeatherForecast/Models/LocalizationModel.cs b/src/WeatherForecast/Models/LocalizationModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/LocalizationModel.cs rename to src/WeatherForecast/Models/LocalizationModel.cs diff --git a/webapi/WeatherForecast/Models/MenuItemModel.cs b/src/WeatherForecast/Models/MenuItemModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/MenuItemModel.cs rename to src/WeatherForecast/Models/MenuItemModel.cs diff --git a/webapi/WeatherForecast/Models/ReviewerModel.cs b/src/WeatherForecast/Models/ReviewerModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/ReviewerModel.cs rename to src/WeatherForecast/Models/ReviewerModel.cs diff --git a/webapi/WeatherForecast/Models/RouteModel.cs b/src/WeatherForecast/Models/RouteModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/RouteModel.cs rename to src/WeatherForecast/Models/RouteModel.cs diff --git a/webapi/WeatherForecast/Models/Shop/Requests/ShopCartItemRequestModel.cs b/src/WeatherForecast/Models/Shop/Requests/ShopCartItemRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Shop/Requests/ShopCartItemRequestModel.cs rename to src/WeatherForecast/Models/Shop/Requests/ShopCartItemRequestModel.cs diff --git a/webapi/WeatherForecast/Models/Shop/Requests/ShopItemRequestModel.cs b/src/WeatherForecast/Models/Shop/Requests/ShopItemRequestModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Shop/Requests/ShopItemRequestModel.cs rename to src/WeatherForecast/Models/Shop/Requests/ShopItemRequestModel.cs diff --git a/webapi/WeatherForecast/Models/Shop/Responses/ShopCartItemResponseModel.cs b/src/WeatherForecast/Models/Shop/Responses/ShopCartItemResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Shop/Responses/ShopCartItemResponseModel.cs rename to src/WeatherForecast/Models/Shop/Responses/ShopCartItemResponseModel.cs diff --git a/webapi/WeatherForecast/Models/Shop/Responses/ShopItemResponseModel.cs b/src/WeatherForecast/Models/Shop/Responses/ShopItemResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Shop/Responses/ShopItemResponseModel.cs rename to src/WeatherForecast/Models/Shop/Responses/ShopItemResponseModel.cs diff --git a/webapi/WeatherForecast/Models/Shop/Responses/ShopItemsResponseModel.cs b/src/WeatherForecast/Models/Shop/Responses/ShopItemsResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/Shop/Responses/ShopItemsResponseModel.cs rename to src/WeatherForecast/Models/Shop/Responses/ShopItemsResponseModel.cs diff --git a/webapi/WeatherForecast/Models/TestimonialModel.cs b/src/WeatherForecast/Models/TestimonialModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/TestimonialModel.cs rename to src/WeatherForecast/Models/TestimonialModel.cs diff --git a/webapi/WeatherForecast/Models/WeatherForecast/Responses/WeatherForecastResponseModel.cs b/src/WeatherForecast/Models/WeatherForecast/Responses/WeatherForecastResponseModel.cs similarity index 100% rename from webapi/WeatherForecast/Models/WeatherForecast/Responses/WeatherForecastResponseModel.cs rename to src/WeatherForecast/Models/WeatherForecast/Responses/WeatherForecastResponseModel.cs diff --git a/src/WeatherForecast/Policies/Abstractions/AuthorizationHandlerBase.cs b/src/WeatherForecast/Policies/Abstractions/AuthorizationHandlerBase.cs new file mode 100644 index 0000000..327d441 --- /dev/null +++ b/src/WeatherForecast/Policies/Abstractions/AuthorizationHandlerBase.cs @@ -0,0 +1,141 @@ +using Microsoft.Extensions.Options; +using Microsoft.AspNetCore.Authorization; + +using DataProviders.Collections; + +using DomainObjects.Documents.User; + + +using CryptoProvider; +using Extensions; + +namespace WeatherForecast.Policies.Abstractions; + +/// +/// +/// +public static class AuthorisationHandlerHelper { + + /// + /// + /// + /// + /// + /// + /// + /// + public static UserDocument? GetUser(AuthorizationHandlerContext context, IAesKey? aesKey, IHttpContextAccessor contextAccessor, IUserDataProvider userDataProvider) { + + if (context == null || aesKey?.IV == null || aesKey?.Key == null) + return null; + + var userId = context.User?.Identity?.Name?.ToNullableGuid(); + + var request = contextAccessor.HttpContext?.Request; + var host = request?.Headers["X-Forwarded-Host"].FirstOrDefault(); + var bearerToken = request?.Headers.Authorization.FirstOrDefault(); + + if (userId == null || host == null || bearerToken == null) + return null; + + var (user, getUserResult) = userDataProvider.GetByUserIdAndHost(userId.Value, host); + if (!getUserResult.IsSuccess || user == null) + return null; + + if (!user.ValidateToken(aesKey.IV, aesKey.Key, bearerToken)) + return null; + + return user; + } + + /// + /// + /// + /// + /// + /// + public static Roles? GetRole(IHttpContextAccessor contextAccessor, UserDocument user) { + var request = contextAccessor.HttpContext?.Request; + var host = request?.Headers["X-Forwarded-Host"].FirstOrDefault(); + var bearerToken = request?.Headers.Authorization.FirstOrDefault(); + return user.Sites.Single(x => x.Hosts.Any(x => x == host)).Role; + } +} + + +/// +/// +/// +/// +public abstract class AuthorizationHandlerBase : AuthorizationHandler where TRequirement : IAuthorizationRequirement { + + private readonly IAesKey? _aesKey; + private readonly IHttpContextAccessor _contextAccessor; + private readonly IUserDataProvider _userDataProvider; + + /// + /// + /// + /// + /// + /// + public AuthorizationHandlerBase( + IOptions configuration, + IHttpContextAccessor contextAccessor, + IUserDataProvider userDataProvider + ) { + _aesKey = configuration.Value.JwtTokenEncryption; + _contextAccessor = contextAccessor; + _userDataProvider = userDataProvider; + } + + /// + /// + /// + /// + /// + protected UserDocument? GetUser(AuthorizationHandlerContext context) => + AuthorisationHandlerHelper.GetUser(context, _aesKey, _contextAccessor, _userDataProvider); + + protected Roles? GetRole(UserDocument user) => + AuthorisationHandlerHelper.GetRole(_contextAccessor, user); +} + +/// +/// +/// +/// +/// +public abstract class AuthorizationHandlerBase : AuthorizationHandler where TRequirement : IAuthorizationRequirement { + + private readonly IAesKey? _aesKey; + private readonly IHttpContextAccessor _contextAccessor; + private readonly IUserDataProvider _userDataProvider; + + /// + /// + /// + /// + /// + /// + public AuthorizationHandlerBase( + IOptions configuration, + IHttpContextAccessor contextAccessor, + IUserDataProvider userDataProvider + ) { + _aesKey = configuration.Value.JwtTokenEncryption; + _contextAccessor = contextAccessor; + _userDataProvider = userDataProvider; + } + + /// + /// + /// + /// + /// + protected UserDocument? GetUser(AuthorizationHandlerContext context) => + AuthorisationHandlerHelper.GetUser(context, _aesKey, _contextAccessor, _userDataProvider); + + protected Roles? GetRole(UserDocument user) => + AuthorisationHandlerHelper.GetRole(_contextAccessor, user); +} diff --git a/webapi/WeatherForecast/Policies/Abstractions/AuthorizationRequirementBase.cs b/src/WeatherForecast/Policies/Abstractions/AuthorizationRequirementBase.cs similarity index 100% rename from webapi/WeatherForecast/Policies/Abstractions/AuthorizationRequirementBase.cs rename to src/WeatherForecast/Policies/Abstractions/AuthorizationRequirementBase.cs diff --git a/webapi/WeatherForecast/Policies/BlogAuthorizationHandler.cs b/src/WeatherForecast/Policies/BlogAuthorizationHandler.cs similarity index 62% rename from webapi/WeatherForecast/Policies/BlogAuthorizationHandler.cs rename to src/WeatherForecast/Policies/BlogAuthorizationHandler.cs index 21b6e9e..fd63bd3 100644 --- a/webapi/WeatherForecast/Policies/BlogAuthorizationHandler.cs +++ b/src/WeatherForecast/Policies/BlogAuthorizationHandler.cs @@ -6,8 +6,8 @@ using Core.Enumerations; using DataProviders.Collections; using WeatherForecast.Policies.Abstractions; -using WeatherForecast.Services; -using DomainObjects.Enumerations; +using Microsoft.Extensions.Options; +using DomainObjects.Documents.User; namespace WeatherForecast.Policies; @@ -19,14 +19,14 @@ public class BlogAuthorizationHandler : AuthorizationHandlerBase /// /// + /// /// /// - /// public BlogAuthorizationHandler( + IOptions configuration, IHttpContextAccessor contextAccessor, - IUserDataProvider userDataProvider, - IAccountPolicyService accountService - ) : base(contextAccessor, userDataProvider, accountService) { } + IUserDataProvider userDataProvider + ) : base(configuration, contextAccessor, userDataProvider) { } /// /// @@ -41,31 +41,33 @@ public class BlogAuthorizationHandler : AuthorizationHandlerBase x.Published != null)))) + && (userRole != Roles.Admin + && userRole != Roles.Editor + && userRole != Roles.Author + && userRole != Roles.Contributor + && (userRole == Roles.Contributor && resource.Any(x => x.Published != null)))) return Task.CompletedTask; // Can only Admin, Editor, Author, Contributor if (requirement.Action == CrudActions.Read - && (user.Role != Roles.Admin - && user.Role != Roles.Editor - && user.Role != Roles.Author - && user.Role != Roles.Contributor)) + && (userRole != Roles.Admin + && userRole != Roles.Editor + && userRole != Roles.Author + && userRole != Roles.Contributor)) return Task.CompletedTask; // Can only Admin, Editor, Author (own), Contributor (own, not yet pubblished) if ((requirement.Action == CrudActions.Update || requirement.Action == CrudActions.Delete) - && (user.Role != Roles.Admin - && user.Role != Roles.Editor - && user.Role != Roles.Author - && user.Role != Roles.Contributor - && ((user.Role == Roles.Author || user.Role == Roles.Contributor) && resource.Any(x => x.Author != user.Id)) - && (user.Role == Roles.Contributor && resource.Any(x => x.Published != null)))) + && (userRole != Roles.Admin + && userRole != Roles.Editor + && userRole != Roles.Author + && userRole != Roles.Contributor + && ((userRole == Roles.Author || userRole == Roles.Contributor) && resource.Any(x => x.Author != user.Id)) + && (userRole == Roles.Contributor && resource.Any(x => x.Published != null)))) return Task.CompletedTask; context.Succeed(requirement); diff --git a/webapi/WeatherForecast/Policies/CategoryAuthorizationHandler.cs b/src/WeatherForecast/Policies/CategoryAuthorizationHandler.cs similarity index 70% rename from webapi/WeatherForecast/Policies/CategoryAuthorizationHandler.cs rename to src/WeatherForecast/Policies/CategoryAuthorizationHandler.cs index 5916616..0caf7e0 100644 --- a/webapi/WeatherForecast/Policies/CategoryAuthorizationHandler.cs +++ b/src/WeatherForecast/Policies/CategoryAuthorizationHandler.cs @@ -1,7 +1,8 @@ using Core.Enumerations; using DataProviders.Collections; -using DomainObjects.Enumerations; +using DomainObjects.Documents.User; using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Options; using WeatherForecast.Policies.Abstractions; using WeatherForecast.Services; @@ -17,12 +18,11 @@ public class CategoryAuthorizationHandler : AuthorizationHandlerBase /// /// - /// public CategoryAuthorizationHandler( - IHttpContextAccessor contextAccessor, - IUserDataProvider userDataProvider, - IAccountPolicyService accountService -) : base(contextAccessor, userDataProvider, accountService) { } + IOptions configuration, + IHttpContextAccessor contextAccessor, + IUserDataProvider userDataProvider + ) : base(configuration, contextAccessor, userDataProvider) { } /// /// @@ -36,25 +36,27 @@ public class CategoryAuthorizationHandler : AuthorizationHandlerBase /// /// - /// /// public FileAuthorisationHandler( + IOptions configuration, IHttpContextAccessor contextAccessor, IUserDataProvider userDataProvider, - IAccountPolicyService accountService, IFileSecurityService fileSecurityService - ) : base(contextAccessor, userDataProvider, accountService) { + ) : base(configuration, contextAccessor, userDataProvider) { _fileSecurityService = fileSecurityService; } @@ -47,6 +46,8 @@ public class FileAuthorisationHandler : AuthorizationHandlerBase { var (fileCategory, signatureResult) = _fileSecurityService.CheckFileSignature(x.Name, x.Bytes, x.ContentType); return !signatureResult.IsSuccess || fileCategory == null; @@ -55,33 +56,33 @@ public class FileAuthorisationHandler : AuthorizationHandlerBase x.UserId != user.Id)))) + && (userRole != Roles.Admin + && userRole != Roles.Editor + && userRole != Roles.Author + && userRole != Roles.Contributor + && userRole != Roles.ShopManager + && ((userRole == Roles.Author || userRole == Roles.Contributor) && resource.Any(x => x.UserId != user.Id)))) return Task.CompletedTask; // Can Admin, Editor, Author (own), Contributor (own, not yet pubblished), Shop manager if ((requirement.Action == CrudActions.Update || requirement.Action == CrudActions.Delete) - && (user.Role != Roles.Admin - && user.Role != Roles.Editor - && user.Role != Roles.Author - && user.Role != Roles.Contributor - && user.Role != Roles.ShopManager - && ((user.Role == Roles.Author || user.Role == Roles.Contributor) && resource.Any(x => x.UserId != user.Id)) - && (user.Role == Roles.Contributor && resource.Any(x => x.Published != null)))) + && (userRole != Roles.Admin + && userRole != Roles.Editor + && userRole != Roles.Author + && userRole != Roles.Contributor + && userRole != Roles.ShopManager + && ((userRole == Roles.Author || userRole == Roles.Contributor) && resource.Any(x => x.UserId != user.Id)) + && (userRole == Roles.Contributor && resource.Any(x => x.Published != null)))) return Task.CompletedTask; context.Succeed(requirement); diff --git a/webapi/WeatherForecast/Policies/PasswordChangeAuthorizationHandler.cs b/src/WeatherForecast/Policies/PasswordChangeAuthorizationHandler.cs similarity index 77% rename from webapi/WeatherForecast/Policies/PasswordChangeAuthorizationHandler.cs rename to src/WeatherForecast/Policies/PasswordChangeAuthorizationHandler.cs index f54eeaa..9745f7a 100644 --- a/webapi/WeatherForecast/Policies/PasswordChangeAuthorizationHandler.cs +++ b/src/WeatherForecast/Policies/PasswordChangeAuthorizationHandler.cs @@ -1,8 +1,8 @@ using CryptoProvider; using DataProviders.Collections; -using DomainObjects.Documents; -using DomainObjects.Enumerations; +using DomainObjects.Documents.User; using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Options; using WeatherForecast.Policies.Abstractions; using WeatherForecast.Services; @@ -18,12 +18,11 @@ public class PasswordChangeAuthorizationHandler : AuthorizationHandlerBase /// /// - /// public PasswordChangeAuthorizationHandler( + IOptions configuration, IHttpContextAccessor contextAccessor, - IUserDataProvider userDataProvider, - IAccountPolicyService accountService - ) : base(contextAccessor, userDataProvider, accountService) { } + IUserDataProvider userDataProvider + ) : base(configuration, contextAccessor, userDataProvider) { } /// /// @@ -39,7 +38,9 @@ public class PasswordChangeAuthorizationHandler : AuthorizationHandlerBase x.Id != user.Id)) + var userRole = GetRole(user); + + if (userRole != Roles.Admin && resource.Any(x => x.Id != user.Id)) return Task.CompletedTask; if (resource.Count() > 0 && resource.Any(x => x.Id == user.Id)) @@ -47,22 +48,22 @@ public class PasswordChangeAuthorizationHandler : AuthorizationHandlerBase x.Id == user.Id)) { - if (user.Passwords.Password == null) + if (user.Authentication.Password == null) return Task.CompletedTask; - if (!HashService.ValidateHash(requirement.OldPassword, user.Passwords.Password.Salt, user.Passwords.Password.Hash)) + if (!HashService.ValidateHash(requirement.OldPassword, user.Authentication.Password.Salt, user.Authentication.Password.Hash)) return Task.CompletedTask; } - - - context.Succeed(requirement); return Task.CompletedTask; } - } + +/// +/// +/// public class PasswordChangeRequirement : AuthorizationRequirementBase { public string OldPassword { get; init; } } diff --git a/webapi/WeatherForecast/Policies/ShopAuthorizationHandler.cs b/src/WeatherForecast/Policies/ShopAuthorizationHandler.cs similarity index 52% rename from webapi/WeatherForecast/Policies/ShopAuthorizationHandler.cs rename to src/WeatherForecast/Policies/ShopAuthorizationHandler.cs index 4906cc1..4985fb1 100644 --- a/webapi/WeatherForecast/Policies/ShopAuthorizationHandler.cs +++ b/src/WeatherForecast/Policies/ShopAuthorizationHandler.cs @@ -1,47 +1,66 @@ using Core.Enumerations; using DataProviders.Collections; using DomainObjects.Documents; -using DomainObjects.Enumerations; +using DomainObjects.Documents.User; using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Options; using WeatherForecast.Policies.Abstractions; -using WeatherForecast.Services; namespace WeatherForecast.Policies { - public class ShopAuthorizationHandler : AuthorizationHandlerBase> { + /// + /// + /// + public class ShopAuthorizationHandler : AuthorizationHandlerBase> { + + /// + /// + /// + /// + /// + /// public ShopAuthorizationHandler( + IOptions configuration, IHttpContextAccessor contextAccessor, - IUserDataProvider userDataProvider, - IAccountPolicyService accountService - ) : base(contextAccessor, userDataProvider, accountService) { } + IUserDataProvider userDataProvider + ) : base(configuration, contextAccessor, userDataProvider) { } + /// + /// + /// + /// + /// + /// + /// protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ShopAuthorizationRequirement requirement, List resource) { var user = GetUser(context); if (user == null) return Task.CompletedTask; + var userRole = GetRole(user); + // Can Admin, Shop manager if (requirement.Action == CrudActions.Create - && user.Role != Roles.Admin - && user.Role != Roles.ShopManager) + && userRole != Roles.Admin + && userRole != Roles.ShopManager) return Task.CompletedTask; // Can Admin, Shop manager if (requirement.Action == CrudActions.Read - && user.Role != Roles.Admin - && user.Role != Roles.ShopManager) + && userRole != Roles.Admin + && userRole != Roles.ShopManager) return Task.CompletedTask; // Can Admin, Shop manager if (requirement.Action == CrudActions.Update - && user.Role != Roles.Admin - && user.Role != Roles.ShopManager) + && userRole != Roles.Admin + && userRole != Roles.ShopManager) return Task.CompletedTask; // Can Admin, Shop manager if (requirement.Action == CrudActions.Delete - && user.Role != Roles.Admin - && user.Role != Roles.ShopManager) + && userRole != Roles.Admin + && userRole != Roles.ShopManager) return Task.CompletedTask; diff --git a/webapi/WeatherForecast/Policies/ShopCartAuthorizationHandler.cs b/src/WeatherForecast/Policies/ShopCartAuthorizationHandler.cs similarity index 75% rename from webapi/WeatherForecast/Policies/ShopCartAuthorizationHandler.cs rename to src/WeatherForecast/Policies/ShopCartAuthorizationHandler.cs index 383f17d..7d9d464 100644 --- a/webapi/WeatherForecast/Policies/ShopCartAuthorizationHandler.cs +++ b/src/WeatherForecast/Policies/ShopCartAuthorizationHandler.cs @@ -1,8 +1,9 @@ using DataProviders.Collections; using DomainObjects.Documents; +using DomainObjects.Documents.User; using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Options; using WeatherForecast.Policies.Abstractions; -using WeatherForecast.Services; namespace WeatherForecast.Policies { @@ -18,10 +19,10 @@ namespace WeatherForecast.Policies { /// /// public ShopCartAuthorizationHandler( + IOptions configuration, IHttpContextAccessor contextAccessor, - IUserDataProvider userDataProvider, - IAccountPolicyService accountService - ) : base(contextAccessor, userDataProvider, accountService) { } + IUserDataProvider userDataProvider + ) : base(configuration, contextAccessor, userDataProvider) { } /// /// @@ -35,7 +36,11 @@ namespace WeatherForecast.Policies { if (user == null) return Task.CompletedTask; - // any authenticated user except + var userRole = GetRole(user); + + // Leave only admin to manage others carts + if (userRole != Roles.Admin && resource.Any(x => x.UserId != user.Id)) + return Task.CompletedTask; context.Succeed(requirement); diff --git a/webapi/WeatherForecast/Program.cs b/src/WeatherForecast/Program.cs similarity index 100% rename from webapi/WeatherForecast/Program.cs rename to src/WeatherForecast/Program.cs diff --git a/webapi/WeatherForecast/Properties/launchSettings.json b/src/WeatherForecast/Properties/launchSettings.json similarity index 100% rename from webapi/WeatherForecast/Properties/launchSettings.json rename to src/WeatherForecast/Properties/launchSettings.json diff --git a/webapi/WeatherForecast/Services/Abstractions/PostItemServiceBase.cs b/src/WeatherForecast/Services/Abstractions/PostItemServiceBase.cs similarity index 100% rename from webapi/WeatherForecast/Services/Abstractions/PostItemServiceBase.cs rename to src/WeatherForecast/Services/Abstractions/PostItemServiceBase.cs diff --git a/webapi/WeatherForecast/Services/AccountService.cs b/src/WeatherForecast/Services/AccountService.cs similarity index 50% rename from webapi/WeatherForecast/Services/AccountService.cs rename to src/WeatherForecast/Services/AccountService.cs index 743ec2e..a0b5f28 100644 --- a/webapi/WeatherForecast/Services/AccountService.cs +++ b/src/WeatherForecast/Services/AccountService.cs @@ -2,30 +2,22 @@ using DomainObjects; using CryptoProvider; using DataProviders.Collections; -using DomainObjects.Documents; using DomainResults.Common; -using JWTService; using Microsoft.Extensions.Options; using WeatherForecast.Models.Account.Requests; +using DomainObjects.Documents.User; +using EmailProvider; +using DomainObjects.Enumerations; +using Org.BouncyCastle.Crypto; +using Microsoft.AspNetCore.Identity; -namespace WeatherForecast.Services { +namespace WeatherForecast.Services +{ - - public interface IAccountPolicyService { /// /// /// - /// - /// - /// - IDomainResult Authenticate(UserDocument user, string token); - } - - - /// - /// - /// - public interface IAccountService { + public interface IAccountService { /// /// /// @@ -33,17 +25,41 @@ namespace WeatherForecast.Services { /// (string?, IDomainResult) Authenticate(AuthenticationRequestModel requestData); - (Guid?, IDomainResult) PasswordChange(UserDocument user, string newPassword); + /// + /// + /// + /// + /// + IDomainResult PasswordRecovery(PasswordRecoveryRequestModel requestData); + + + /// + /// + /// + /// + /// + IDomainResult PasswordReset(PasswordResetRequestModel requestData); + + + /// + /// + /// + /// + /// + /// + /// + (Guid?, IDomainResult) PasswordChange(UserDocument user, string oldPassword, string newPassword); } /// /// /// - public class AccountService : ServiceBase, IAccountService, IAccountPolicyService { + public class AccountService : ServiceBase, IAccountService { private readonly IAesKey? _aesKey; + private readonly IJwtConfig? _jwtConfig; + private readonly IUserDataProvider _userDataProvider; - private readonly IJWTService _jwtService; /// /// @@ -51,19 +67,16 @@ namespace WeatherForecast.Services { /// /// /// - /// public AccountService( ILogger logger, IOptions options, - IUserDataProvider userDataProvider, - IJWTService jwtService + IUserDataProvider userDataProvider ) : base(logger) { _aesKey = options.Value.JwtTokenEncryption; + _jwtConfig = options.Value.JwtConfig; _userDataProvider = userDataProvider; - _jwtService = jwtService; } - /// /// /// @@ -74,47 +87,19 @@ namespace WeatherForecast.Services { if (_aesKey?.IV == null || _aesKey?.Key == null) return IDomainResult.Failed("IV or Key are not set"); + if (_jwtConfig?.Secret == null || _jwtConfig?.Expires == null) + return IDomainResult.Failed("Secret or Expires are not set"); + // Retrieve user from database by userName var (user, getUserResult) = _userDataProvider.GetByUsername(requestData.Username); if (!getUserResult.IsSuccess || user == null) return (null, getUserResult); - if (user.Passwords.Password == null) - return IDomainResult.Failed("Password is not set, create new password."); - // Check provided password hash with the stored one - var (salt, hash) = HashService.CreateSaltedHash(requestData.Password); - if (!HashService.ValidateHash(requestData.Password, salt, hash)) + if (!user.Authentication.ValidatePassword(requestData.Password)) return IDomainResult.Unauthorized(); - // Check password expiration if enabled - if (user.Passwords.Expiration.Enabled && DateTime.UtcNow > user.Passwords.Password.Created.AddDays(user.Passwords.Expiration.Days)) { - user.Passwords.Expired.Add(user.Passwords.Password.Prototype()); - - user.Passwords.Password = null; - user.Tokens = new List(); - - return IDomainResult.Failed("Password is expired, create new password."); - } - - // Creating JWT token - var claims = new List> { - new KeyValuePair("unique_name", $"{user.Id}"), - - // (JWT ID): Unique identifier; can be used to prevent the JWT from being replayed (allows a token to be used only once) - new KeyValuePair("jti", $"{Guid.NewGuid()}") - }; - - var created = DateTime.UtcNow; - var expires = created.AddDays(365); - - var token = _jwtService.CreateJwtToken(expires, claims); - - user.Tokens.Add(new Token { - Value = AesService.EncryptString(_aesKey.IV, _aesKey.Key, token), - Created = created, - Expires = expires, - }); + var token = user.AddToken(_aesKey.IV, _aesKey.Key, _jwtConfig.Secret, _jwtConfig.Expires.Value); var (_, usdateUserResult) = _userDataProvider.Update(user); if (!usdateUserResult.IsSuccess) @@ -123,32 +108,6 @@ namespace WeatherForecast.Services { return IDomainResult.Success(token); } - /// - /// - /// - /// - /// - /// - public IDomainResult Authenticate(UserDocument user, string token) { - if (_aesKey?.IV == null || _aesKey?.Key == null) - return IDomainResult.Failed("IV or Key are not set"); - - #region Tokens cleanup - var userTokens = user.Tokens.Where(x => x.Expires > DateTime.UtcNow).OrderByDescending(x => x.Expires).Take(10).ToList(); - - if (user.Tokens.Count != userTokens.Count) { - user.Tokens = userTokens; - _userDataProvider.Update(user); - } - #endregion - - // Check if whitelisted - if (!userTokens.Select(x => AesService.DecryptString(_aesKey.IV, _aesKey.Key, x.Value)).Any(x => string.Compare(x, token) == 0)) - return IDomainResult.Unauthorized(); - - return IDomainResult.Success(); - } - /// /// Passing the Username in the request body is a more secure alternative to passing it as a GET param /// @@ -160,35 +119,71 @@ namespace WeatherForecast.Services { if (!getUserResult.IsSuccess || user == null) return getUserResult; - // - // send an email + var email = user.Contacts.FirstOrDefault(x => x.Type == ContactTypes.Email && (x.Primary ?? false)); + if (email == null) + return IDomainResult.Failed(); - throw new NotImplementedException(); + var template = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "templates", "email-inlined.html")) + .Replace("{{content}}", $"Your recovery token: {user.Authentication.PasswordRecovery()}"); + + _userDataProvider.Update(user); + + var emailBuilder = new EmailMessageBuilder(); + emailBuilder.AddFrom("commercial", "commercial@maks-it.com"); + emailBuilder.AddTo(user.Username, email.Value); + emailBuilder.AddSubject("Password recovery"); + + + emailBuilder.AddHtmlBody(template); + + emailBuilder.DkimSign("maks-it.com", "default", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "dkim", "maks-it.com")); + + using var smtpService = new SMTPService(); + + smtpService.Connect("smtp.ionos.it", 465, true); + smtpService.Authenticate("commercial@maks-it.com", "E23{R# /// When the form is submitted with the new password and the token as inputs the reset password process will take place. - /// The form data will be sent with a PUT request again but this time including the token and we will replace the resource password with a new value + /// User is found by password recovery token and new password is set /// /// /// public IDomainResult PasswordReset(PasswordResetRequestModel requestData) { + var (user, getUserResult) = _userDataProvider.GetByRecoveryToken(requestData.Token); + if(!getUserResult.IsSuccess || user == null) + return IDomainResult.Failed(); - var (salt, hash) = HashService.CreateSaltedHash(requestData.Password); + user.Authentication.PasswordReset(requestData.Token, requestData.Password); + _userDataProvider.Update(user); return IDomainResult.Success(); } - - public (Guid?, IDomainResult) PasswordChange(UserDocument user, string newPassword) { + /// + /// Only if user is authenticated, do not expose this methods as anonymous + /// + /// + /// + /// + public (Guid?, IDomainResult) PasswordChange(UserDocument user, string oldPassword, string newPassword) { - user.SetPassword(newPassword); + user.Authentication.PasswordChange(oldPassword, newPassword); - return IDomainResult.Success(user.Id); + var (userId, userUpdateResult) = _userDataProvider.Update(user); + if (!userUpdateResult.IsSuccess || userId == null) + return IDomainResult.Failed(); + + return IDomainResult.Success(userId); } } } diff --git a/webapi/WeatherForecast/Services/BlogItemService.cs b/src/WeatherForecast/Services/BlogItemService.cs similarity index 100% rename from webapi/WeatherForecast/Services/BlogItemService.cs rename to src/WeatherForecast/Services/BlogItemService.cs diff --git a/webapi/WeatherForecast/Services/BlogItemsService.cs b/src/WeatherForecast/Services/BlogItemsService.cs similarity index 100% rename from webapi/WeatherForecast/Services/BlogItemsService.cs rename to src/WeatherForecast/Services/BlogItemsService.cs diff --git a/webapi/WeatherForecast/Services/CategoryItemService.cs b/src/WeatherForecast/Services/CategoryItemService.cs similarity index 100% rename from webapi/WeatherForecast/Services/CategoryItemService.cs rename to src/WeatherForecast/Services/CategoryItemService.cs diff --git a/webapi/WeatherForecast/Services/CategoryItemsService.cs b/src/WeatherForecast/Services/CategoryItemsService.cs similarity index 100% rename from webapi/WeatherForecast/Services/CategoryItemsService.cs rename to src/WeatherForecast/Services/CategoryItemsService.cs diff --git a/webapi/WeatherForecast/Services/ContentService.cs b/src/WeatherForecast/Services/ContentService.cs similarity index 100% rename from webapi/WeatherForecast/Services/ContentService.cs rename to src/WeatherForecast/Services/ContentService.cs diff --git a/webapi/WeatherForecast/Services/ImageService.cs b/src/WeatherForecast/Services/ImageService.cs similarity index 100% rename from webapi/WeatherForecast/Services/ImageService.cs rename to src/WeatherForecast/Services/ImageService.cs diff --git a/webapi/WeatherForecast/Services/ShopCartItemService.cs b/src/WeatherForecast/Services/ShopCartItemService.cs similarity index 100% rename from webapi/WeatherForecast/Services/ShopCartItemService.cs rename to src/WeatherForecast/Services/ShopCartItemService.cs diff --git a/webapi/WeatherForecast/Services/ShopCartItemsService.cs b/src/WeatherForecast/Services/ShopCartItemsService.cs similarity index 100% rename from webapi/WeatherForecast/Services/ShopCartItemsService.cs rename to src/WeatherForecast/Services/ShopCartItemsService.cs diff --git a/webapi/WeatherForecast/Services/ShopItemService.cs b/src/WeatherForecast/Services/ShopItemService.cs similarity index 100% rename from webapi/WeatherForecast/Services/ShopItemService.cs rename to src/WeatherForecast/Services/ShopItemService.cs diff --git a/webapi/WeatherForecast/Services/ShopItemsService.cs b/src/WeatherForecast/Services/ShopItemsService.cs similarity index 100% rename from webapi/WeatherForecast/Services/ShopItemsService.cs rename to src/WeatherForecast/Services/ShopItemsService.cs diff --git a/webapi/WeatherForecast/Startup.cs b/src/WeatherForecast/Startup.cs similarity index 97% rename from webapi/WeatherForecast/Startup.cs rename to src/WeatherForecast/Startup.cs index f594311..815fb99 100644 --- a/webapi/WeatherForecast/Startup.cs +++ b/src/WeatherForecast/Startup.cs @@ -1,18 +1,19 @@ using System.Reflection; +using System.Text.Json.Serialization; using Microsoft.OpenApi.Models; using Microsoft.IdentityModel.Tokens; using Microsoft.AspNetCore.Authentication.JwtBearer; + using WeatherForecast.Services; using DataProviders.Extensions; -using System.Text.Json.Serialization; + using FileSecurityService.Extensions; using ImageProvider.Extensions; -using JWTService.Extensions; using Core.Middlewares; using Microsoft.AspNetCore.Authorization; using WeatherForecast.Policies; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Identity; namespace WeatherForecast { @@ -87,7 +88,6 @@ namespace WeatherForecast { #region Internal services services.AddScoped(); - services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -103,7 +103,6 @@ namespace WeatherForecast { services.RegisterDataproviders(appSettings); services.RegisterFileSecurityService(); services.RegisterImageProvider(); - services.RegisterJWTService(appSettings); #region Swagger services.ConfigureSwaggerGen(options => { @@ -219,4 +218,3 @@ namespace WeatherForecast { } } } - diff --git a/webapi/WeatherForecast/WeatherForecast.csproj b/src/WeatherForecast/WeatherForecast.csproj similarity index 74% rename from webapi/WeatherForecast/WeatherForecast.csproj rename to src/WeatherForecast/WeatherForecast.csproj index 7f06b96..ec66207 100644 --- a/webapi/WeatherForecast/WeatherForecast.csproj +++ b/src/WeatherForecast/WeatherForecast.csproj @@ -29,10 +29,26 @@ + + - - + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/webapi/WeatherForecast/appsettings.Development.json b/src/WeatherForecast/appsettings.Development.json similarity index 100% rename from webapi/WeatherForecast/appsettings.Development.json rename to src/WeatherForecast/appsettings.Development.json diff --git a/webapi/WeatherForecast/appsettings.json b/src/WeatherForecast/appsettings.json similarity index 100% rename from webapi/WeatherForecast/appsettings.json rename to src/WeatherForecast/appsettings.json diff --git a/src/WeatherForecast/dkim/maks-it.com b/src/WeatherForecast/dkim/maks-it.com new file mode 100644 index 0000000..bb21946 --- /dev/null +++ b/src/WeatherForecast/dkim/maks-it.com @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEAvtffuQ06X7AtfVban4a6xVX9tVGhCuN+OPkPmEln8ryeCr6Z +oGKfRz8vSGdVAcuHCf6fbRAA01DDRMAScTlGW8XSvJ+Kv6D53Xvi3CpCPUB+JDs5 +1MiXmBiKHlBeVF4AX6dj4HcqZugsiGljGT6HdVwiRxIRpy0qHXydVkDcgauew2xx +ukz0f3SGPUxBMaeKBxeGIQ5FxufWgwkURy0rVoQrqCLlbRm3abhprUttWzMnMx0l +x+h6hRzTgGTrSJuG14Usi9OoFuLyAHeQEo869n6RgSSAPzcIw1rbCqVFeLu3h7bW +p60OltIhVl4gD96JphomVJqM8NFJiwsvh4hp8QIDAQABAoIBABPz9gwe+e9vOBJW +tlzfdT+UkgYXFsNQra2/PIYrhpa2ab+t1doS9Zw5WvQy+YxKfz/oQzrf5XYyh3f0 +rPjxiA2oTTQzagpHBljFzx49vNcymv2mw5Eft9nLFwW8WWBww5E8qxCY5PIFbEKG +4jmNdBQtIdhUZ0wXSMP0d27BMUzNOlLPruIocBIDXgV2PoWzS+47smeo3zcEovWA +lvE8U3nAshEgXDPA5onjNcqElC+EMlbQzZKeEZZdK9wVr/2kB9G8sALi7QgurUE7 +Wvh62l1kkqc+Su6flBE2kWJJCmiYXBe2wQsL7NrJg9+fFcZFIZz4ycBk3BMp+Kwq +/9FNP8ECgYEA8TS3j1IfKkdx1IZXztOPg6OHU7GPaHgqG6e3FRxjXdfP6+TI7Lly +WRTpuBknIWSmNHpxOeVJwmMIbAPab5QMfmPlt31/BIE++L639CS5OWL14KFvUT1V +jBlCN01jJ+zUIkYmjU69v+bemqvUP8BSpzbnKCrBuNnehM8X7CXc1V0CgYEAyoxj +0lj19ql16lLRB13gXs2u9Xxf+KkC/6vQQvJ5hiG+HoSkpQISSSfCTTx6bPyp3wgP +I4AmG/JNtUz1of0J+NfhvuXe4Qo4BTdDthaRAWrsqw1nF4Kb5PKg1jhPiiHYKhna +rpqnk8d5oO0UqKqZfQgkPtREQyBvtgIzrLqzKaUCgYAWlzNh7vUQRqS4nOR4cIQO +djBkfErMJAT9lhWlmoUL8vx8QW84DJ5TDYxeO6zYic6vN5CHNZxU4mWViD7bGGib +JcwMBWryBxDYxzP/X7khUM1qfnQojbAHcQ4sk8jnolyz4RIXRfqrkHnkzpcQaXjU +RGYd8vM11uHqWmMJMPqf2QKBgBYsBAlUn6geqL+7zRHnXtZB4bMRqFfJ+IAQSL3r +WQ4rx2oDzxoY/fNwHL7jrescRWQat72FG6bXgVYlVIYk8uCAkT+aXil4OuWnRQw7 +sCfdkoau8ugJ7hLD1INeqqZOSiFhrySJ3Wo53cCV8zr7Yc3kBEO0bLyEYnYkC5AO +5+nZAoGAArWVHpZY8VuU/Z2cK12xxuy0fxagw+VFXQ+zgQz9CLQbYMiwEnDyLJoQ +iEjfikuEv7L+H/dGiygibJEy1SpkDDCekhVlQrRr2IPPNYx9msCg4u0vrss/ZKl2 +4oG1hLZMICbqaexBfT+1OqqNofqDE7cAm4Ul6n4ANBwPViBcwiI= +-----END RSA PRIVATE KEY----- diff --git a/src/WeatherForecast/templates/email-inlined.html b/src/WeatherForecast/templates/email-inlined.html new file mode 100644 index 0000000..a37eac8 --- /dev/null +++ b/src/WeatherForecast/templates/email-inlined.html @@ -0,0 +1,171 @@ + + + + + + Simple Transactional Email + + + + + + + + + + + + + diff --git a/src/WeatherForecast/templates/email.html b/src/WeatherForecast/templates/email.html new file mode 100644 index 0000000..0f063ec --- /dev/null +++ b/src/WeatherForecast/templates/email.html @@ -0,0 +1,405 @@ + + + + + + Simple Transactional Email + + + + This is preheader text. Some clients will show this text as a preview. + + + + + + + + + diff --git a/webapi/docker-compose.dcproj b/src/docker-compose.dcproj similarity index 100% rename from webapi/docker-compose.dcproj rename to src/docker-compose.dcproj diff --git a/webapi/docker-compose.override.yml b/src/docker-compose.override.yml similarity index 100% rename from webapi/docker-compose.override.yml rename to src/docker-compose.override.yml diff --git a/webapi/docker-compose.yml b/src/docker-compose.yml similarity index 100% rename from webapi/docker-compose.yml rename to src/docker-compose.yml diff --git a/src/docker-compose/mongo/data/db/.mongodb/mongosh/63275c642fdd229b1b3bdbd6_log b/src/docker-compose/mongo/data/db/.mongodb/mongosh/63275c642fdd229b1b3bdbd6_log new file mode 100644 index 0000000..4d26802 --- /dev/null +++ b/src/docker-compose/mongo/data/db/.mongodb/mongosh/63275c642fdd229b1b3bdbd6_log @@ -0,0 +1,8 @@ +{"t":{"$date":"2022-09-18T17:59:00.148Z"},"s":"I","c":"MONGOSH","id":1000000000,"ctx":"log","msg":"Starting log","attr":{"execPath":"/usr/bin/mongosh","envInfo":{"EDITOR":null,"NODE_OPTIONS":null,"TERM":null},"version":"1.5.4","distributionKind":"compiled","buildArch":"x64","buildPlatform":"linux","buildTarget":"linux-x64","buildTime":"2022-07-29T21:35:08.241Z","gitVersion":"92fc4d6ce4b4eed4d8d29bc0d38a9eb50831d14e","nodeVersion":"v16.16.0","opensslVersion":"1.1.1q+quic","sharedOpenssl":false}} +{"t":{"$date":"2022-09-18T17:59:00.164Z"},"s":"I","c":"MONGOSH","id":1000000048,"ctx":"config","msg":"Loading global configuration file","attr":{"filename":"/etc/mongosh.conf","found":false}} +{"t":{"$date":"2022-09-18T17:59:00.280Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000042,"ctx":"mongosh-connect","msg":"Initiating connection attempt","attr":{"uri":"mongodb://127.0.0.1:27017/admin?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.5.4","driver":{"name":"nodejs|mongosh","version":"4.8.1"},"devtoolsConnectVersion":"1.4.3","host":"127.0.0.1:27017"}} +{"t":{"$date":"2022-09-18T17:59:00.308Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000035,"ctx":"mongosh-connect","msg":"Server heartbeat succeeded","attr":{"connectionId":"127.0.0.1:27017"}} +{"t":{"$date":"2022-09-18T17:59:00.348Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000037,"ctx":"mongosh-connect","msg":"Connection attempt finished"} +{"t":{"$date":"2022-09-18T17:59:00.401Z"},"s":"I","c":"MONGOSH","id":1000000004,"ctx":"connect","msg":"Connecting to server","attr":{"session_id":"63275c642fdd229b1b3bdbd6","userId":null,"telemetryAnonymousId":"63275c6420613b38fdce9c66","connectionUri":"mongodb://:27017/admin?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.5.4","is_atlas":false,"is_localhost":true,"is_do":false,"server_version":"6.0.1","node_version":"v16.16.0","mongosh_version":"1.5.4","server_os":"linux","server_arch":"x86_64","is_enterprise":false,"auth_type":null,"is_data_federation":false,"dl_version":null,"atlas_version":null,"is_genuine":true,"non_genuine_server_name":"mongodb","fcv":"6.0","api_version":null,"api_strict":null,"api_deprecation_errors":null}} +{"t":{"$date":"2022-09-18T17:59:00.539Z"},"s":"I","c":"MONGOSH","id":1000000010,"ctx":"shell-api","msg":"Initialized context","attr":{"method":"setCtx","arguments":{}}} +{"t":{"$date":"2022-09-18T17:59:01.297Z"},"s":"I","c":"MONGOSH-SNIPPETS","id":1000000019,"ctx":"snippets","msg":"Loaded snippets","attr":{"installdir":"/data/db/.mongodb/mongosh/snippets"}} diff --git a/src/docker-compose/mongo/data/db/.mongodb/mongosh/63275c67e64a28dade72fd79_log b/src/docker-compose/mongo/data/db/.mongodb/mongosh/63275c67e64a28dade72fd79_log new file mode 100644 index 0000000..7d3c11e --- /dev/null +++ b/src/docker-compose/mongo/data/db/.mongodb/mongosh/63275c67e64a28dade72fd79_log @@ -0,0 +1,15 @@ +{"t":{"$date":"2022-09-18T17:59:03.765Z"},"s":"I","c":"MONGOSH","id":1000000000,"ctx":"log","msg":"Starting log","attr":{"execPath":"/usr/bin/mongosh","envInfo":{"EDITOR":null,"NODE_OPTIONS":null,"TERM":null},"version":"1.5.4","distributionKind":"compiled","buildArch":"x64","buildPlatform":"linux","buildTarget":"linux-x64","buildTime":"2022-07-29T21:35:08.241Z","gitVersion":"92fc4d6ce4b4eed4d8d29bc0d38a9eb50831d14e","nodeVersion":"v16.16.0","opensslVersion":"1.1.1q+quic","sharedOpenssl":false}} +{"t":{"$date":"2022-09-18T17:59:03.796Z"},"s":"I","c":"MONGOSH","id":1000000005,"ctx":"config","msg":"User updated"} +{"t":{"$date":"2022-09-18T17:59:03.803Z"},"s":"I","c":"MONGOSH","id":1000000048,"ctx":"config","msg":"Loading global configuration file","attr":{"filename":"/etc/mongosh.conf","found":false}} +{"t":{"$date":"2022-09-18T17:59:03.948Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000042,"ctx":"mongosh-connect","msg":"Initiating connection attempt","attr":{"uri":"mongodb://127.0.0.1:27017/admin?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.5.4","driver":{"name":"nodejs|mongosh","version":"4.8.1"},"devtoolsConnectVersion":"1.4.3","host":"127.0.0.1:27017"}} +{"t":{"$date":"2022-09-18T17:59:03.984Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000035,"ctx":"mongosh-connect","msg":"Server heartbeat succeeded","attr":{"connectionId":"127.0.0.1:27017"}} +{"t":{"$date":"2022-09-18T17:59:04.046Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000037,"ctx":"mongosh-connect","msg":"Connection attempt finished"} +{"t":{"$date":"2022-09-18T17:59:04.156Z"},"s":"I","c":"MONGOSH","id":1000000004,"ctx":"connect","msg":"Connecting to server","attr":{"session_id":"63275c67e64a28dade72fd79","userId":null,"telemetryAnonymousId":"63275c6420613b38fdce9c66","connectionUri":"mongodb://:27017/admin?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.5.4","is_atlas":false,"is_localhost":true,"is_do":false,"server_version":"6.0.1","node_version":"v16.16.0","mongosh_version":"1.5.4","server_os":"linux","server_arch":"x86_64","is_enterprise":false,"auth_type":null,"is_data_federation":false,"dl_version":null,"atlas_version":null,"is_genuine":true,"non_genuine_server_name":"mongodb","fcv":"6.0","api_version":null,"api_strict":null,"api_deprecation_errors":null}} +{"t":{"$date":"2022-09-18T17:59:04.323Z"},"s":"I","c":"MONGOSH","id":1000000010,"ctx":"shell-api","msg":"Initialized context","attr":{"method":"setCtx","arguments":{}}} +{"t":{"$date":"2022-09-18T17:59:04.334Z"},"s":"I","c":"MONGOSH-SNIPPETS","id":1000000024,"ctx":"snippets","msg":"Fetching snippet index","attr":{"refreshMode":"allow-cached"}} +{"t":{"$date":"2022-09-18T17:59:04.347Z"},"s":"I","c":"MONGOSH-SNIPPETS","id":1000000019,"ctx":"snippets","msg":"Loaded snippets","attr":{"installdir":"/data/db/.mongodb/mongosh/snippets"}} +{"t":{"$date":"2022-09-18T17:59:04.348Z"},"s":"I","c":"MONGOSH-SNIPPETS","id":1000000028,"ctx":"snippets","msg":"Modifying snippets package.json failed","attr":{"error":"ENOENT: no such file or directory, open '/data/db/.mongodb/mongosh/snippets/package.json'"}} +{"t":{"$date":"2022-09-18T17:59:04.408Z"},"s":"I","c":"MONGOSH","id":1000000002,"ctx":"repl","msg":"Started REPL","attr":{"version":"1.5.4"}} +{"t":{"$date":"2022-09-18T17:59:05.153Z"},"s":"I","c":"MONGOSH","id":1000000011,"ctx":"shell-api","msg":"Performed API call","attr":{"method":"createUser","class":"Database","db":"admin","arguments":{}}} +{"t":{"$date":"2022-09-18T17:59:06.118Z"},"s":"I","c":"MONGOSH-SNIPPETS","id":1000000027,"ctx":"snippets","msg":"Fetching snippet index done"} +{"t":{"$date":"2022-09-18T17:59:06.646Z"},"s":"I","c":"MONGOSH","id":1000000045,"ctx":"analytics","msg":"Flushed outstanding data","attr":{"flushError":"timeout of 1000ms exceeded","flushDuration":1005}} diff --git a/src/docker-compose/mongo/data/db/.mongodb/mongosh/config b/src/docker-compose/mongo/data/db/.mongodb/mongosh/config new file mode 100644 index 0000000..5a405b7 --- /dev/null +++ b/src/docker-compose/mongo/data/db/.mongodb/mongosh/config @@ -0,0 +1 @@ +{"userId":"63275c6420613b38fdce9c66","telemetryAnonymousId":"63275c6420613b38fdce9c66","enableTelemetry":true} \ No newline at end of file diff --git a/src/docker-compose/mongo/data/db/.mongodb/mongosh/mongosh_repl_history b/src/docker-compose/mongo/data/db/.mongodb/mongosh/mongosh_repl_history new file mode 100644 index 0000000..e69de29 diff --git a/src/docker-compose/mongo/data/db/.mongodb/mongosh/snippets/index.bson.br b/src/docker-compose/mongo/data/db/.mongodb/mongosh/snippets/index.bson.br new file mode 100644 index 0000000..3917bdd Binary files /dev/null and b/src/docker-compose/mongo/data/db/.mongodb/mongosh/snippets/index.bson.br differ diff --git a/src/docker-compose/mongo/data/db/.mongodb/mongosh/snippets/package.json b/src/docker-compose/mongo/data/db/.mongodb/mongosh/snippets/package.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/docker-compose/mongo/data/db/.mongodb/mongosh/snippets/package.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/docker-compose/mongo/data/db/WiredTiger b/src/docker-compose/mongo/data/db/WiredTiger new file mode 100644 index 0000000..94fbc2b --- /dev/null +++ b/src/docker-compose/mongo/data/db/WiredTiger @@ -0,0 +1,2 @@ +WiredTiger +WiredTiger 10.0.2: (December 21, 2021) diff --git a/src/docker-compose/mongo/data/db/WiredTiger.lock b/src/docker-compose/mongo/data/db/WiredTiger.lock new file mode 100644 index 0000000..3d84206 --- /dev/null +++ b/src/docker-compose/mongo/data/db/WiredTiger.lock @@ -0,0 +1 @@ +WiredTiger lock file diff --git a/src/docker-compose/mongo/data/db/WiredTiger.turtle b/src/docker-compose/mongo/data/db/WiredTiger.turtle new file mode 100644 index 0000000..9629c06 --- /dev/null +++ b/src/docker-compose/mongo/data/db/WiredTiger.turtle @@ -0,0 +1,6 @@ +WiredTiger version string +WiredTiger 10.0.2: (December 21, 2021) +WiredTiger version +major=10,minor=0,patch=2 +file:WiredTiger.wt +access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=,cache_resident=false,checksum=on,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,readonly=false,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,tiered_object=false,tiered_storage=(auth_token=,bucket=,bucket_prefix=,cache_directory=,local_retention=300,name=,object_target_size=0),value_format=S,verbose=[],version=(major=1,minor=1),write_timestamp_usage=none,checkpoint=(WiredTigerCheckpoint.78531=(addr="018781e4a527c68d8881e43cd827ac8981e4935a7dbb808080e3022fc0e2dfc0",order=78531,time=1670018018,size=69632,newest_start_durable_ts=0,oldest_start_ts=0,newest_txn=3,newest_stop_durable_ts=0,newest_stop_ts=-1,newest_stop_txn=-11,prepare=0,write_gen=235943,run_write_gen=235628)),checkpoint_backup_info=,checkpoint_lsn=(29,118272) diff --git a/src/docker-compose/mongo/data/db/WiredTiger.wt b/src/docker-compose/mongo/data/db/WiredTiger.wt new file mode 100644 index 0000000..29ca413 Binary files /dev/null and b/src/docker-compose/mongo/data/db/WiredTiger.wt differ diff --git a/src/docker-compose/mongo/data/db/WiredTigerHS.wt b/src/docker-compose/mongo/data/db/WiredTigerHS.wt new file mode 100644 index 0000000..3f019cb Binary files /dev/null and b/src/docker-compose/mongo/data/db/WiredTigerHS.wt differ diff --git a/src/docker-compose/mongo/data/db/_mdb_catalog.wt b/src/docker-compose/mongo/data/db/_mdb_catalog.wt new file mode 100644 index 0000000..e6a751a Binary files /dev/null and b/src/docker-compose/mongo/data/db/_mdb_catalog.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-0--4715807334585891142.wt b/src/docker-compose/mongo/data/db/collection-0--4715807334585891142.wt new file mode 100644 index 0000000..8f974ad Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-0--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-0-462957234524615243.wt b/src/docker-compose/mongo/data/db/collection-0-462957234524615243.wt new file mode 100644 index 0000000..f4c8d17 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-0-462957234524615243.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-10--4748285384625290805.wt b/src/docker-compose/mongo/data/db/collection-10--4748285384625290805.wt new file mode 100644 index 0000000..967911c Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-10--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-12--4748285384625290805.wt b/src/docker-compose/mongo/data/db/collection-12--4748285384625290805.wt new file mode 100644 index 0000000..47c60f4 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-12--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-2--4715807334585891142.wt b/src/docker-compose/mongo/data/db/collection-2--4715807334585891142.wt new file mode 100644 index 0000000..d11d232 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-2--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-2--4748285384625290805.wt b/src/docker-compose/mongo/data/db/collection-2--4748285384625290805.wt new file mode 100644 index 0000000..0c21068 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-2--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-3-462957234524615243.wt b/src/docker-compose/mongo/data/db/collection-3-462957234524615243.wt new file mode 100644 index 0000000..1b2af88 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-3-462957234524615243.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-4--4715807334585891142.wt b/src/docker-compose/mongo/data/db/collection-4--4715807334585891142.wt new file mode 100644 index 0000000..95f35e9 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-4--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-4--4748285384625290805.wt b/src/docker-compose/mongo/data/db/collection-4--4748285384625290805.wt new file mode 100644 index 0000000..231f253 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-4--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-6--4748285384625290805.wt b/src/docker-compose/mongo/data/db/collection-6--4748285384625290805.wt new file mode 100644 index 0000000..fdc3728 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-6--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-7--4715807334585891142.wt b/src/docker-compose/mongo/data/db/collection-7--4715807334585891142.wt new file mode 100644 index 0000000..2576e77 Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-7--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-8--4748285384625290805.wt b/src/docker-compose/mongo/data/db/collection-8--4748285384625290805.wt new file mode 100644 index 0000000..3f019cb Binary files /dev/null and b/src/docker-compose/mongo/data/db/collection-8--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-17T15-46-52Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-17T15-46-52Z-00000 new file mode 100644 index 0000000..ddb97b8 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-17T15-46-52Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-19T08-21-56Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-19T08-21-56Z-00000 new file mode 100644 index 0000000..33c2af9 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-19T08-21-56Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-21T01-06-56Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-21T01-06-56Z-00000 new file mode 100644 index 0000000..819b817 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-21T01-06-56Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-22T17-46-56Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-22T17-46-56Z-00000 new file mode 100644 index 0000000..576b86a Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-22T17-46-56Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-24T19-44-08Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-24T19-44-08Z-00000 new file mode 100644 index 0000000..50ba368 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-24T19-44-08Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T10-04-53Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T10-04-53Z-00000 new file mode 100644 index 0000000..e16776a Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T10-04-53Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T10-06-47Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T10-06-47Z-00000 new file mode 100644 index 0000000..9b411bd Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T10-06-47Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T21-56-17Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T21-56-17Z-00000 new file mode 100644 index 0000000..01d92c3 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-26T21-56-17Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-28T10-58-26Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-28T10-58-26Z-00000 new file mode 100644 index 0000000..dd09983 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-28T10-58-26Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-28T14-12-29Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-28T14-12-29Z-00000 new file mode 100644 index 0000000..941e642 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-28T14-12-29Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-29T07-25-47Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-29T07-25-47Z-00000 new file mode 100644 index 0000000..fde5f2f Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-29T07-25-47Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-31T07-55-57Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-31T07-55-57Z-00000 new file mode 100644 index 0000000..273b13f Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-10-31T07-55-57Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-03T11-14-27Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-03T11-14-27Z-00000 new file mode 100644 index 0000000..e864614 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-03T11-14-27Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-09T13-34-12Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-09T13-34-12Z-00000 new file mode 100644 index 0000000..f712f40 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-09T13-34-12Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-10T20-40-05Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-10T20-40-05Z-00000 new file mode 100644 index 0000000..0164e42 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-10T20-40-05Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-12T13-10-06Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-12T13-10-06Z-00000 new file mode 100644 index 0000000..d696527 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-12T13-10-06Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-14T06-15-06Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-14T06-15-06Z-00000 new file mode 100644 index 0000000..1495feb Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-14T06-15-06Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-15T22-33-03Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-15T22-33-03Z-00000 new file mode 100644 index 0000000..a859f62 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-15T22-33-03Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-16T21-43-08Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-16T21-43-08Z-00000 new file mode 100644 index 0000000..e6ab6a2 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-16T21-43-08Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-18T14-10-54Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-18T14-10-54Z-00000 new file mode 100644 index 0000000..8a47228 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-18T14-10-54Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-20T05-35-56Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-20T05-35-56Z-00000 new file mode 100644 index 0000000..96d2ee4 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-20T05-35-56Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-21T20-55-57Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-21T20-55-57Z-00000 new file mode 100644 index 0000000..ea6789f Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-21T20-55-57Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-23T12-35-58Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-23T12-35-58Z-00000 new file mode 100644 index 0000000..c7909d9 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-23T12-35-58Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-24T23-01-28Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-24T23-01-28Z-00000 new file mode 100644 index 0000000..10d13b0 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-24T23-01-28Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-25T18-07-03Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-25T18-07-03Z-00000 new file mode 100644 index 0000000..fe447f3 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-25T18-07-03Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-26T10-30-35Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-26T10-30-35Z-00000 new file mode 100644 index 0000000..a57e498 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-26T10-30-35Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-28T02-00-19Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-28T02-00-19Z-00000 new file mode 100644 index 0000000..334801d Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-28T02-00-19Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-29T17-35-19Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-29T17-35-19Z-00000 new file mode 100644 index 0000000..a98e90c Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-11-29T17-35-19Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-12-01T18-13-51Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-12-01T18-13-51Z-00000 new file mode 100644 index 0000000..a866c22 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-12-01T18-13-51Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-12-02T20-13-36Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-12-02T20-13-36Z-00000 new file mode 100644 index 0000000..6a38e9a Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2022-12-02T20-13-36Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.interim b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.interim new file mode 100644 index 0000000..2ace470 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.interim differ diff --git a/src/docker-compose/mongo/data/db/index-1--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-1--4715807334585891142.wt new file mode 100644 index 0000000..aafd4ae Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-1--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/index-1-462957234524615243.wt b/src/docker-compose/mongo/data/db/index-1-462957234524615243.wt new file mode 100644 index 0000000..a9c81f9 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-1-462957234524615243.wt differ diff --git a/src/docker-compose/mongo/data/db/index-11--4748285384625290805.wt b/src/docker-compose/mongo/data/db/index-11--4748285384625290805.wt new file mode 100644 index 0000000..d21cf65 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-11--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/index-13--4748285384625290805.wt b/src/docker-compose/mongo/data/db/index-13--4748285384625290805.wt new file mode 100644 index 0000000..33de4be Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-13--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/index-2-462957234524615243.wt b/src/docker-compose/mongo/data/db/index-2-462957234524615243.wt new file mode 100644 index 0000000..b56642f Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-2-462957234524615243.wt differ diff --git a/src/docker-compose/mongo/data/db/index-3--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-3--4715807334585891142.wt new file mode 100644 index 0000000..54da707 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-3--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/index-3--4748285384625290805.wt b/src/docker-compose/mongo/data/db/index-3--4748285384625290805.wt new file mode 100644 index 0000000..c9feda3 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-3--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/index-4-462957234524615243.wt b/src/docker-compose/mongo/data/db/index-4-462957234524615243.wt new file mode 100644 index 0000000..f3ec013 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-4-462957234524615243.wt differ diff --git a/src/docker-compose/mongo/data/db/index-5--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-5--4715807334585891142.wt new file mode 100644 index 0000000..058fd74 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-5--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/index-5--4748285384625290805.wt b/src/docker-compose/mongo/data/db/index-5--4748285384625290805.wt new file mode 100644 index 0000000..11d7e89 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-5--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/index-5-462957234524615243.wt b/src/docker-compose/mongo/data/db/index-5-462957234524615243.wt new file mode 100644 index 0000000..2d4ab6e Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-5-462957234524615243.wt differ diff --git a/src/docker-compose/mongo/data/db/index-6--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-6--4715807334585891142.wt new file mode 100644 index 0000000..c5b4d57 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-6--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/index-7--4748285384625290805.wt b/src/docker-compose/mongo/data/db/index-7--4748285384625290805.wt new file mode 100644 index 0000000..d9506f3 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-7--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/index-8--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-8--4715807334585891142.wt new file mode 100644 index 0000000..3e1d45e Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-8--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/index-9--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-9--4715807334585891142.wt new file mode 100644 index 0000000..07f8123 Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-9--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/index-9--4748285384625290805.wt b/src/docker-compose/mongo/data/db/index-9--4748285384625290805.wt new file mode 100644 index 0000000..3f019cb Binary files /dev/null and b/src/docker-compose/mongo/data/db/index-9--4748285384625290805.wt differ diff --git a/src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000029 b/src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000029 new file mode 100644 index 0000000..b3ccc7f Binary files /dev/null and b/src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000029 differ diff --git a/src/docker-compose/mongo/data/db/journal/WiredTigerPreplog.0000000001 b/src/docker-compose/mongo/data/db/journal/WiredTigerPreplog.0000000001 new file mode 100644 index 0000000..aa52a21 Binary files /dev/null and b/src/docker-compose/mongo/data/db/journal/WiredTigerPreplog.0000000001 differ diff --git a/src/docker-compose/mongo/data/db/journal/WiredTigerPreplog.0000000002 b/src/docker-compose/mongo/data/db/journal/WiredTigerPreplog.0000000002 new file mode 100644 index 0000000..aa52a21 Binary files /dev/null and b/src/docker-compose/mongo/data/db/journal/WiredTigerPreplog.0000000002 differ diff --git a/src/docker-compose/mongo/data/db/mongod.lock b/src/docker-compose/mongo/data/db/mongod.lock new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/src/docker-compose/mongo/data/db/mongod.lock @@ -0,0 +1 @@ +1 diff --git a/src/docker-compose/mongo/data/db/sizeStorer.wt b/src/docker-compose/mongo/data/db/sizeStorer.wt new file mode 100644 index 0000000..e16c209 Binary files /dev/null and b/src/docker-compose/mongo/data/db/sizeStorer.wt differ diff --git a/src/docker-compose/mongo/data/db/storage.bson b/src/docker-compose/mongo/data/db/storage.bson new file mode 100644 index 0000000..276b694 Binary files /dev/null and b/src/docker-compose/mongo/data/db/storage.bson differ diff --git a/webapi/launchSettings.json b/src/launchSettings.json similarity index 100% rename from webapi/launchSettings.json rename to src/launchSettings.json diff --git a/webapi/Extensions/HttpRequestExtensions.cs b/webapi/Extensions/HttpRequestExtensions.cs deleted file mode 100644 index 0feb33b..0000000 --- a/webapi/Extensions/HttpRequestExtensions.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Extensions { - public static class HttpRequestExtensions { - - - /// - /// - /// - /// - /// - /// - public static List GetHeader(this HttpRequest request, string name) { - var headers = request.Headers[name].ToList(); - return headers != null ? headers : new List(); - } - - /// - /// Return clean JWT Bearer token from Authorisation Header - /// - public static string? GeBearerToken(this HttpRequest request) { - var header = request.GetHeader("Authorization").FirstOrDefault(); - return header !=null - ? header.Replace("Bearer ", "") - : default; - } - } -} diff --git a/webapi/Services/JWTService/Extensions/ServiceCollectionExtensions.cs b/webapi/Services/JWTService/Extensions/ServiceCollectionExtensions.cs deleted file mode 100644 index 0eb0447..0000000 --- a/webapi/Services/JWTService/Extensions/ServiceCollectionExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; - -namespace JWTService.Extensions { - public static class ServiceCollectionExtensions { - public static void RegisterJWTService(this IServiceCollection services, IJWTServiceConfig appSettings) { - var config = appSettings.JwtConfig; - - if(config == null) throw new NullReferenceException(); - - services.AddSingleton(x => config); - services.AddSingleton(); - } - } -} diff --git a/webapi/Services/JWTService/IJWTServiceConfig.cs b/webapi/Services/JWTService/IJWTServiceConfig.cs deleted file mode 100644 index a61d041..0000000 --- a/webapi/Services/JWTService/IJWTServiceConfig.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.IO; - -namespace JWTService { - public interface IJWTServiceConfig { - public JwtConfig? JwtConfig { get; set; } - } - - public interface IJwtConfig { - public string? Secret { get; set; } - public int? Expires { get; set; } - } - - public class JwtConfig : IJwtConfig { - public string? Secret { get; set; } - public int? Expires { get; set; } - } -} diff --git a/webapi/Services/JWTService/JWTService.cs b/webapi/Services/JWTService/JWTService.cs deleted file mode 100644 index 099885d..0000000 --- a/webapi/Services/JWTService/JWTService.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System.IdentityModel.Tokens.Jwt; -using System.Security.Claims; -using DomainResults.Common; -using Microsoft.Extensions.Logging; -using Microsoft.IdentityModel.Tokens; - -namespace JWTService { - - public interface IJWTService { - - string CreateJwtToken(DateTime expires, List>? claims); - (List>?, IDomainResult) JwtTokenClaims(string token); - } - - public class JWTService : IJWTService { - - private readonly ILogger _logger; - private readonly IJwtConfig _configuration; - - public JWTService( - ILogger logger, - IJwtConfig configuration - ) { - _logger = logger; - _configuration = configuration; - } - - public string CreateJwtToken(DateTime expires, List>? claims) => - CreateJwtToken(_configuration.Secret, expires, claims); - - public string CreateJwtToken(string secret, DateTime expires, List>? claims) { - - // add roles to claims identity from database - var tokenClaims = new List(); - - if (claims != null) - foreach (var claim in claims) - tokenClaims.Add(new Claim(claim.Key, claim.Value)); - - var tokenHandler = new JwtSecurityTokenHandler(); - - var securityToken = tokenHandler.CreateToken(new SecurityTokenDescriptor { - IssuedAt = DateTime.UtcNow, - Subject = new ClaimsIdentity(tokenClaims), - Expires = expires, - SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Convert.FromBase64String(secret)), SecurityAlgorithms.HmacSha512Signature), - }); - _logger.LogInformation($"Creted new JWT {securityToken}"); - - return tokenHandler.WriteToken(securityToken); - } - - public (List>?, IDomainResult) JwtTokenClaims(string token) { - - var securityToken = new JwtSecurityTokenHandler().ReadToken(token) as JwtSecurityToken; - var claims = securityToken?.Claims?.Select(x => new KeyValuePair(x.Type, x.Value)); - - if (claims == null) - return IDomainResult.Failed>?>(); - - return claims.Count() > 0 - ? IDomainResult.Success(claims.ToList()) - : IDomainResult.NotFound>?>(); - } - } -} diff --git a/webapi/Services/JWTService/JWTService.csproj b/webapi/Services/JWTService/JWTService.csproj deleted file mode 100644 index b4ec1a4..0000000 --- a/webapi/Services/JWTService/JWTService.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net7.0 - enable - enable - - - - - - - - - - diff --git a/webapi/WeatherForecast/Policies/Abstractions/AuthorizationHandlerBase.cs b/webapi/WeatherForecast/Policies/Abstractions/AuthorizationHandlerBase.cs deleted file mode 100644 index 4cd6141..0000000 --- a/webapi/WeatherForecast/Policies/Abstractions/AuthorizationHandlerBase.cs +++ /dev/null @@ -1,116 +0,0 @@ -using DomainObjects; -using DataProviders.Collections; -using DomainObjects.Documents; -using ExtensionMethods; -using Extensions; -using Microsoft.AspNetCore.Authorization; -using WeatherForecast.Services; - -namespace WeatherForecast.Policies.Abstractions; - -/// -/// -/// -/// -public abstract class AuthorizationHandlerBase : AuthorizationHandler where TRequirement : IAuthorizationRequirement { - - private readonly IHttpContextAccessor _contextAccessor; - private readonly IUserDataProvider _userDataProvider; - private readonly IAccountPolicyService _accountService; - - /// - /// - /// - /// - /// - /// - public AuthorizationHandlerBase( - IHttpContextAccessor contextAccessor, - IUserDataProvider userDataProvider, - IAccountPolicyService accountService - ) { - _contextAccessor = contextAccessor; - _userDataProvider = userDataProvider; - _accountService = accountService; - } - - /// - /// - /// - /// - /// - protected UserDocument? GetUser(AuthorizationHandlerContext context) { - - if (context == null) - return null; - - var userId = context.User?.Identity?.Name?.ToNullableGuid(); - var bearerToken = _contextAccessor.HttpContext?.Request?.GeBearerToken(); - - if (userId == null || bearerToken == null) - return null; - - var (user, getUserResult) = _userDataProvider.Get(userId.Value); - if (!getUserResult.IsSuccess || user == null) - return null; - - if (!_accountService.Authenticate(user, bearerToken).IsSuccess) - return null; - - return user; - } -} - -/// -/// -/// -/// -/// -public abstract class AuthorizationHandlerBase : AuthorizationHandler where TRequirement : IAuthorizationRequirement { - - private readonly IHttpContextAccessor _contextAccessor; - private readonly IUserDataProvider _userDataProvider; - private readonly IAccountPolicyService _accountService; - - /// - /// - /// - /// - /// - /// - public AuthorizationHandlerBase( - IHttpContextAccessor contextAccessor, - IUserDataProvider userDataProvider, - IAccountPolicyService accountService - ) { - _contextAccessor = contextAccessor; - _userDataProvider = userDataProvider; - _accountService = accountService; - } - - /// - /// - /// - /// - /// - protected UserDocument? GetUser(AuthorizationHandlerContext context) { - - if (context == null) - return null; - - var userId = context.User?.Identity?.Name?.ToNullableGuid(); - var bearerToken = _contextAccessor.HttpContext?.Request?.GeBearerToken(); - - if (userId == null || bearerToken == null) - return null; - - var (user, getUserResult) = _userDataProvider.Get(userId.Value); - if (!getUserResult.IsSuccess || user == null) - return null; - - if (!_accountService.Authenticate(user, bearerToken).IsSuccess) - return null; - - return user; - } -}