From dbff5ad51ed673ec28b9588ee129d597211e60a7 Mon Sep 17 00:00:00 2001 From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:31:17 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=88=D0=B5=D0=BD=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20c=20Bean,=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=BF=D0=B0=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 - data.mv.db | Bin 2002944 -> 2027520 bytes data.trace.db | 4 ++++ .../entrysData/service/EntrysDataService.java | 19 +++++++++++++++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index b37dbc4..114ed19 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,6 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-validation' - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0' implementation 'org.modelmapper:modelmapper:3.2.0' developmentOnly 'org.springframework.boot:spring-boot-devtools' diff --git a/data.mv.db b/data.mv.db index 4abc35d391de4c5201eda8337046ba3922a7b085..2b029683706f09799f4ae0292e45d00d29f9498a 100644 GIT binary patch delta 9759 zcmeHNdu$u^9ltyKe755xjh)(#9~Y-Dx-?DC?*}VOn4n#OkhbHY(m~I6XIc`PHhr;8 zqVC$dYhi5)YQBsWND!jZ7>JI?X=Bn7(8SOt(Za+wRMBQbnl@=`=_V+TD*N7@eRnAi zq@nN!YNXTe&avOLMWdd~cu7lZ(b;2Wx#~{@}v-GxO25 zLa(%0SS$7C__UCZX9}Y8xv}v_>mQg=Lrv+6KZ=whWGOCbT8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Y3_E#Kahh6-_;IyC0WC@?L1w#>X^9N^demrGU>Fj?2-D(ei diff --git a/data.trace.db b/data.trace.db index 65e364f..3873d23 100644 --- a/data.trace.db +++ b/data.trace.db @@ -29734,3 +29734,7 @@ Column "KEY_SEQ" not found [42122-224] at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:5148) at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:115) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +2024-06-04 16:30:33.469322+04:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLDataException: Значение слишком длинное для поля "PASSWORD CHARACTER VARYING(25)": "'$2a$10$66PWaq98dEAxag2OS2RZ9ex.xe6a0Jd9zWiFoDQffg4TOukWp77bq' (60)" +Value too long for column "PASSWORD CHARACTER VARYING(25)": "'$2a$10$66PWaq98dEAxag2OS2RZ9ex.xe6a0Jd9zWiFoDQffg4TOukWp77bq' (60)"; SQL statement: +insert into entrys_data (department_id,login,password,role,id) values (?,?,?,?,?) [22001-224] diff --git a/src/main/java/com/example/demo/entrysData/service/EntrysDataService.java b/src/main/java/com/example/demo/entrysData/service/EntrysDataService.java index 8699693..14b9aa3 100644 --- a/src/main/java/com/example/demo/entrysData/service/EntrysDataService.java +++ b/src/main/java/com/example/demo/entrysData/service/EntrysDataService.java @@ -7,6 +7,9 @@ import java.util.stream.StreamSupport; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -14,6 +17,7 @@ import org.springframework.util.StringUtils; import com.example.demo.core.configuration.Constants; import com.example.demo.core.error.NotFoundException; +import com.example.demo.core.security.UserPrincipal; import com.example.demo.entrysData.model.EntrysDataEntity; import com.example.demo.entrysData.model.EntrysDataGrouped; import com.example.demo.entrysData.model.EntrysDataGroupedDepartment; @@ -21,7 +25,7 @@ import com.example.demo.entrysData.model.EntrysDataRole; import com.example.demo.entrysData.repository.EntrysDataRepository; @Service -public class EntrysDataService { +public class EntrysDataService implements UserDetailsService{ private final EntrysDataRepository repository; private final PasswordEncoder passwordEncoder; @@ -104,4 +108,17 @@ public class EntrysDataService { final Pageable pageRequest = PageRequest.of(page, size); return repository.findAllWithDepartment(pageRequest); } + + @Transactional(readOnly = true) + public EntrysDataEntity getByLogin(String login) { + return repository.findByloginIgnoreCase(login) + .orElseThrow(() -> new IllegalArgumentException("Invalid login")); + } + + @Override + @Transactional(readOnly = true) + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + final EntrysDataEntity existsUser = getByLogin(username); + return new UserPrincipal(existsUser); + } }