From 4a6f146039d039111d1548c3c123bc34294437a2 Mon Sep 17 00:00:00 2001 From: abazov73 <92822431+abazov73@users.noreply.github.com> Date: Mon, 15 May 2023 22:32:53 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A8=D0=B5=D1=81=D1=82=D0=B0=D1=8F=20=D0=BB?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0.=20=D0=90=D1=83?= =?UTF-8?q?=D0=BD=D1=82=D0=B5=D1=84=D0=B8=D0=BA=D0=B0=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B2=20MVC=20+=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=82=D0=BE=D0=BA=D0=B5=D0=BD=D0=BE=D0=B2=20?= =?UTF-8?q?=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20JWT.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/ipLab/build.gradle | 6 ++ backend/ipLab/data.mv.db | Bin 94208 -> 106496 bytes .../PasswordEncoderConfiguration.java | 14 +++ .../Configurations/SecurityConfiguration.java | 87 ++++++++++++++++ .../Configurations/jwt/JwtException.java | 11 ++ .../Configurations/jwt/JwtFilter.java | 92 +++++++++++++++++ .../Configurations/jwt/JwtProperties.java | 27 +++++ .../Configurations/jwt/JwtsProvider.java | 47 +++++++++ .../Controllers/UserController.java | 24 +++++ .../ipLab/StoreDataBase/DTO/LoginDTO.java | 36 +++++++ .../ipLab/StoreDataBase/DTO/UserDTO.java | 49 +++++++++ .../Exceptions/UserNotFoundException.java | 7 ++ .../MVC/OrderedMVCController.java | 21 +++- .../MVC/ProductMVCController.java | 31 +++++- .../MVC/UserLoginMVCController.java | 51 +++++++++ .../StoreDataBase/MVC/UserMVCController.java | 33 ++++++ .../ipLab/StoreDataBase/Model/CustomUser.java | 26 +++++ .../ipLab/StoreDataBase/Model/User.java | 76 ++++++++++++++ .../ipLab/StoreDataBase/Model/UserRole.java | 20 ++++ .../Repositories/OrderedRepository.java | 6 ++ .../Repositories/UserRepository.java | 8 ++ .../StoreDataBase/Service/OrderService.java | 5 + .../StoreDataBase/Service/ProductService.java | 1 - .../StoreDataBase/Service/UserService.java | 97 ++++++++++++++++++ .../util/error/AdviceController.java | 9 ++ .../util/validation/ValidationException.java | 4 + .../com/example/ipLab/WebConfiguration.java | 7 ++ .../src/main/resources/application.properties | 3 + .../src/main/resources/static/img/logo.png | Bin 0 -> 9949 bytes .../main/resources/templates/addToStore.html | 2 +- .../main/resources/templates/customer.html | 4 +- .../src/main/resources/templates/default.html | 8 +- .../src/main/resources/templates/index.html | 2 +- .../src/main/resources/templates/login.html | 43 ++++++++ .../src/main/resources/templates/order.html | 2 +- .../src/main/resources/templates/product.html | 6 +- .../src/main/resources/templates/signup.html | 28 +++++ .../src/main/resources/templates/store.html | 6 +- .../src/main/resources/templates/users.html | 27 +++++ 39 files changed, 902 insertions(+), 24 deletions(-) create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Configurations/PasswordEncoderConfiguration.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Configurations/SecurityConfiguration.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Configurations/jwt/JwtException.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Configurations/jwt/JwtFilter.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Configurations/jwt/JwtProperties.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Configurations/jwt/JwtsProvider.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/UserController.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/LoginDTO.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/UserDTO.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Exceptions/UserNotFoundException.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/MVC/UserLoginMVCController.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/MVC/UserMVCController.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Model/CustomUser.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Model/User.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Model/UserRole.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Repositories/UserRepository.java create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Service/UserService.java create mode 100644 backend/ipLab/src/main/resources/static/img/logo.png create mode 100644 backend/ipLab/src/main/resources/templates/login.html create mode 100644 backend/ipLab/src/main/resources/templates/signup.html create mode 100644 backend/ipLab/src/main/resources/templates/users.html diff --git a/backend/ipLab/build.gradle b/backend/ipLab/build.gradle index 8e65326..7cea6c2 100644 --- a/backend/ipLab/build.gradle +++ b/backend/ipLab/build.gradle @@ -30,6 +30,12 @@ dependencies { implementation 'org.webjars:bootstrap:5.1.3' implementation 'org.webjars:jquery:3.6.0' implementation 'org.webjars:font-awesome:6.1.0' + + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' + implementation 'com.auth0:java-jwt:4.4.0' + implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1' + implementation 'javax.xml.bind:jaxb-api:2.3.1' } tasks.named('test') { diff --git a/backend/ipLab/data.mv.db b/backend/ipLab/data.mv.db index fcff4ed4c8b4fb24dcd34e5c5e41f1106c932e8d..cd412bd32bebea4c3e9a1cd17d35548755975f2c 100644 GIT binary patch delta 12157 zcmeHN4R9URb>7|gp5989WE%
qaxs33Xt`%`^twm(pp+o-rMhG%eF1K$8qEt(}fLr31lC8D^jp
z+_QIopDq7W(;ps#@4fr>?L9hs?m6H2&Y3uqnK)VTc%Ib{E?RoKt~WbF_9)q9?<*L(
zrP-qFR2{=lPj@d&Uv!mQN*5OLZ4Nxa92z0J3u^O_JzNl*_u#z+(I7A$C?K5(&BOMA
z(SqK*7k|axUyz&kjf{*IY*Fw&GLbE{d311(T|hF@CEb!q^F#K&{evUJ1qmKKIzkFa
zBdU9>d+m-YhGD*!dYa*QmSN7GWSIV6Fw8IEV*k%zJ;89bTj`iO-$2KTulXbY{Wt0T
z+}tPW_3Afa4Zmam;mM`>CCl!Z(=b2pRvcdO8(C9#Y*STv3+YIc9fP+O)wUc{XPC@|
zY>wsf3@-_aqKK9X6VGbjx9Ov@goc7h?b;DHZMt1QTfBapBfsi=ktqm|vFf)GrO@?`Pf|+?+7sJ#t%*>tZU~FS%
zj<13du0O&t%;J;G%*S7WHH