Reviewed-on: #10
This commit is contained in:
commit
0f500266bc
BIN
data/db.mv.db
BIN
data/db.mv.db
Binary file not shown.
@ -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)));
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user