From 8f9f0831c6d6a6c366829a53c422f0a0f7795d10 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Fri, 18 Mar 2022 11:23:57 +0400 Subject: [PATCH] #9 -- add config parameter --- data/db.mv.db | Bin 69632 -> 57344 bytes src/main/java/ru/ulstu/user/UserService.java | 4 +++- src/main/resources/application.properties | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/data/db.mv.db b/data/db.mv.db index 60c2a02c59086ff5d21a88e1721ec0fa4c810a01..52ce82b99f5670716827ca5ffb5182b47bb39a90 100644 GIT binary patch delta 3694 zcmcJSUu+ab9LIOsYnm3yaqZE61ZeqFyl`B0?{07RHegz+X^qf=NFdsXdponV&|XV> z*ART58lL=hmImck!3k*4d%0l3?+`p&tYU{ z4P|=6Q(>a)VU)85(YTS;Rj8|$HEYfU-(6n2?msSprykWb*{(V9=rAH%Mn}vsLs8(& z;YzTkL$iosvYe2UiD+(U1Q`iM)nz0nqmyWSVrZ0n5QjD%Y}<#w9IM%;NdQQJ&*vn` zI7ObFQvLOCOQbGqj-c337NR3DB_TfKD|A|-M`Z#R(&;HQRK|T>|gVC{}Z1-qBn=|B3{bdn8@%<*ioQ!CC zIVbbk`~-rY)6V)qh{W{~zCXUL@Z*D61!yan`Hi&^=pU$HhwWdYiS&f3rEENVcVCm| zA3c4QpT6T~M_E5b10X&8t8LY5x4udbzf+R*H|gO^Xj$|6P(>hAwMCMoOZD&I+ikO; zzwmy06#!L*vunE=KnMO+?ErO!n$!&d!uTg`H82W)YN254dM%I?DOB-1M7Eh9&Q%>G zi!`b?mjL0VLf(qYPkQsYOT+@Q;m)dl`o2}|*~1nIg!*3S-~R0Wu4i^U*GI-y zsss3JPiuT^FC7QPqb+L9K4&4}E!$|1n#Ff|UIc&OuHJCZ$(Kt`T5g;lpk{>FN2`o0 zuec{uyWu^0GE3LDHm`S1rFwqrY~f7r!)owB;ndEXOP0^?cc%s;-#Jt9YXb_nQn)y9 zEdZ_+#>`xxZxajhPAT+8BM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<#UQk$|JhNY?n z1sRhAu>NIrGAdA+fwXXeYOvD4q2;N+Fy~Np8mbJSmn!5Pz-NiWEX(*-0)kayS-e$2 ze0#0G+OmAw`&*%(vn+K$5HP`Q9(ef@1XA^l{slnb)XDCMX}g~s@9k5Ztel>lIBxGD zn-NA(PAm=d;Z&%#z#_lg3d4>IH}Cx5Or%i|8v1%A2$uhf3nY+%R&RQ-%UGHE*DDV*G$ilhz4U z6C`P2X<4zUq_TRRtQE52`1L%>T1$4gsk3C9weKaRg?ODKe@eSd7_iXM*Z6?|rZA}n&<_Nu>o3YmaHK`K3Q6158p>GN`+RVkn8UuG y)TFJy92F65iBb$1v6t}`x+zZm&(e0L0n#?b0hA|SfLkMP8k*{;?o9GFG4>Ulpz?wM diff --git a/src/main/java/ru/ulstu/user/UserService.java b/src/main/java/ru/ulstu/user/UserService.java index 752f234..c8c9f43 100644 --- a/src/main/java/ru/ulstu/user/UserService.java +++ b/src/main/java/ru/ulstu/user/UserService.java @@ -2,6 +2,7 @@ package ru.ulstu.user; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; @@ -24,6 +25,8 @@ public class UserService implements UserDetailsService { private final PasswordEncoder passwordEncoder; private final UserRepository userRepository; private final UserRoleRepository userRoleRepository; + @Value("${admin-password}") + private String adminPassword; public UserService(PasswordEncoder passwordEncoder, UserRepository userRepository, @@ -63,7 +66,6 @@ public class UserService implements UserDetailsService { public void initDefaultAdmin() { String adminLogin = "admin"; - String adminPassword = "adminadmin"; if (getUserByLogin(adminLogin) == null) { UserRole adminRole = userRoleRepository.save(new UserRole(UserRoleConstants.ADMIN)); createUser(new User(adminLogin, adminPassword, Set.of(adminRole))); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 89e854d..be8bc18 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,6 +3,7 @@ # You may use, distribute and modify this code, please write to: romanov73@gmail.com. # # +admin-password=admin spring.main.banner-mode=off logging.level.tech.athene=DEBUG server.port=8080 -- 2.34.1