промежуточные итоги 💀
This commit is contained in:
parent
110ada147b
commit
2fa38e14ca
25
.idea/workspace.xml
generated
25
.idea/workspace.xml
generated
@ -4,14 +4,10 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="067ac1f0-be04-4fe4-85c6-f870334053b8" name="Changes" comment="migrate to postgres">
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/example/nto/controller/AuthController.java" afterDir="false" />
|
||||
<list default="true" id="067ac1f0-be04-4fe4-85c6-f870334053b8" name="Changes" comment="websecurity configs">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/nto/entity/Employee.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/nto/entity/Employee.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/nto/repository/EmployeeRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/nto/repository/EmployeeRepository.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/nto/websecurity/UserDetailsServiceImpl.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/nto/websecurity/WebSecurityConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/nto/websecurity/WebSecurityConfig.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.yml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/data.sql" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/data.sql" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -40,7 +36,7 @@
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Application.App.executor": "Run",
|
||||
"Application.App.executor": "Debug",
|
||||
"Maven.NTO-2024 [org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean].executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
@ -125,7 +121,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1739956546840</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="5" />
|
||||
<task id="LOCAL-00005" summary="websecurity configs">
|
||||
<option name="closed" value="true" />
|
||||
<created>1739967506973</created>
|
||||
<option name="number" value="00005" />
|
||||
<option name="presentableId" value="LOCAL-00005" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1739967506973</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="6" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
@ -133,7 +137,8 @@
|
||||
<MESSAGE value="bugfix and write last endpoint" />
|
||||
<MESSAGE value="setup web security" />
|
||||
<MESSAGE value="migrate to postgres" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="migrate to postgres" />
|
||||
<MESSAGE value="websecurity configs" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="websecurity configs" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
@ -156,8 +161,8 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/example/nto/websecurity/WebSecurityConfig.java</url>
|
||||
<line>30</line>
|
||||
<option name="timeStamp" value="8" />
|
||||
<line>39</line>
|
||||
<option name="timeStamp" value="13" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
|
@ -27,6 +27,7 @@ public class Employee {
|
||||
private String login;
|
||||
private String name;
|
||||
private String password;
|
||||
private String role;
|
||||
private String photo;
|
||||
private String position;
|
||||
private LocalDateTime lastVisit;
|
||||
@ -90,4 +91,12 @@ public class Employee {
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ import org.springframework.security.config.annotation.authentication.builders.Au
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
||||
@ -28,7 +30,14 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
List<Employee> employees = employeeRepository.findAll();
|
||||
InMemoryUserDetailsManager inMemoryUserDetailsManager = new InMemoryUserDetailsManager();
|
||||
for (int i = 0; i < employees.size(); i++) {
|
||||
inMemoryUserDetailsManager.createUser(new CustomUserDetails(employees.get(i)));
|
||||
Employee employee = employees.get(i);
|
||||
UserDetails user = User
|
||||
.withUserDetails(new CustomUserDetails(employee))
|
||||
.password(employee.getPassword())
|
||||
.username(employee.getLogin())
|
||||
.roles(employee.getRole())
|
||||
.build();
|
||||
inMemoryUserDetailsManager.createUser(user);
|
||||
}
|
||||
|
||||
return inMemoryUserDetailsManager;
|
||||
@ -38,6 +47,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
public BCryptPasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DaoAuthenticationProvider authenticationProvider() {
|
||||
DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
|
||||
|
@ -1,9 +1,9 @@
|
||||
INSERT INTO employee (id, login, password, name, photo, position, last_visit)
|
||||
INSERT INTO employee (id, login, password, role, name, photo, position, last_visit)
|
||||
VALUES
|
||||
(1, 'pivanov', '$2a$10$6ZWoYJApXdPQYMeUI0BTs.Lf8Tos9HSLESy5Xg4xmJpvCJwtHaKfC', 'Иванов Петр Федорович', 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', 'Разработчик', '2024-02-12T08:30'),
|
||||
(2, 'ipetrov', '$2a$10$PRWHGoiil0XIipjWzu0MK.vMAxkdyoZQQliLtGh1TUhik7MyN2mje', 'Петров Иван Константинович', 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', 'Аналитик', '2024-02-13T08:35'),
|
||||
(3, 'asemenov', '$2a$10$PRWHGoiil0XIipjWzu0MK.vMAxkdyoZQQliLtGh1TUhik7MyN2mje', 'Семенов Анатолий Анатольевич', 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', 'Разработчик', '2024-02-13T08:31'),
|
||||
(4, 'afedorov', '$2a$10$PRWHGoiil0XIipjWzu0MK.vMAxkdyoZQQliLtGh1TUhik7MyN2mje', 'Федоров Александр Сергеевич', 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', 'Тестировщик', '2024-02-12T08:36');
|
||||
(1, 'pivanov', '$2a$10$6ZWoYJApXdPQYMeUI0BTs.Lf8Tos9HSLESy5Xg4xmJpvCJwtHaKfC', 'ADMIN', 'Иванов Петр Федорович', 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', 'Разработчик', '2024-02-12T08:30'),
|
||||
(2, 'ipetrov', '$2a$10$PRWHGoiil0XIipjWzu0MK.vMAxkdyoZQQliLtGh1TUhik7MyN2mje', 'USER', 'Петров Иван Константинович', 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', 'Аналитик', '2024-02-13T08:35'),
|
||||
(3, 'asemenov', '$2a$10$PRWHGoiil0XIipjWzu0MK.vMAxkdyoZQQliLtGh1TUhik7MyN2mje', 'USER', 'Семенов Анатолий Анатольевич', 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', 'Разработчик', '2024-02-13T08:31'),
|
||||
(4, 'afedorov', '$2a$10$PRWHGoiil0XIipjWzu0MK.vMAxkdyoZQQliLtGh1TUhik7MyN2mje', 'USER', 'Федоров Александр Сергеевич', 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', 'Тестировщик', '2024-02-12T08:36');
|
||||
|
||||
INSERT INTO code (value)
|
||||
VALUES
|
||||
|
Loading…
x
Reference in New Issue
Block a user