Update libraries
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id("org.springframework.boot") version "2.7.10"
|
||||
id("org.springframework.boot") version "3.0.6"
|
||||
id("java")
|
||||
id("io.spring.dependency-management") version "1.1.0"
|
||||
}
|
||||
@@ -28,22 +28,21 @@ dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||
implementation("org.springframework.boot:spring-boot-starter-websocket")
|
||||
implementation("org.springframework.session:spring-session-core")
|
||||
implementation("com.github.jmnarloch:modelmapper-spring-boot-starter:1.1.0")
|
||||
implementation(group = "org.apache.commons", name = "commons-lang3", version = "3.12.0")
|
||||
implementation(group = "commons-io", name = "commons-io", version = "2.11.0")
|
||||
implementation("org.pcap4j:pcap4j-core:1.8.2")
|
||||
implementation("org.pcap4j:pcap4j-packetfactory-static:1.8.2")
|
||||
implementation(group = "com.google.guava", name = "guava", version = "31.0.1-jre")
|
||||
implementation(group = "org.java-websocket", name = "Java-WebSocket", version = "1.5.1")
|
||||
implementation(group = "org.bouncycastle", name = "bcprov-jdk15on", version = "1.69")
|
||||
implementation(group = "com.google.guava", name = "guava", version = "31.1-jre")
|
||||
implementation(group = "org.java-websocket", name = "Java-WebSocket", version = "1.5.3")
|
||||
implementation(group = "org.bouncycastle", name = "bcprov-jdk15on", version = "1.70")
|
||||
implementation(group = "org.bouncycastle", name = "bctls-jdk15on", version = "1.70")
|
||||
implementation(group = "org.modelmapper", name = "modelmapper", version = "2.4.5")
|
||||
compileOnly("org.jetbrains:annotations:22.0.0")
|
||||
implementation(group = "org.modelmapper", name = "modelmapper", version = "3.1.1")
|
||||
compileOnly("org.jetbrains:annotations:24.0.1")
|
||||
compileOnly("org.projectlombok:lombok")
|
||||
runtimeOnly("org.springframework.boot:spring-boot-devtools")
|
||||
runtimeOnly("org.postgresql:postgresql")
|
||||
annotationProcessor("org.projectlombok:lombok")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
|
||||
}
|
||||
|
||||
tasks.getByName<Test>("test") {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.serega6531.packmate.configuration;
|
||||
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.pcap4j.core.PcapNativeException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -7,8 +8,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import ru.serega6531.packmate.model.enums.CaptureMode;
|
||||
import ru.serega6531.packmate.pcap.FilePcapWorker;
|
||||
import ru.serega6531.packmate.pcap.LivePcapWorker;
|
||||
@@ -42,8 +41,8 @@ public class ApplicationConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
public ModelMapper modelMapper() {
|
||||
return new ModelMapper();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package ru.serega6531.packmate.configuration;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
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.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@Slf4j
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
public class SecurityConfiguration {
|
||||
|
||||
@Value("${account-login}")
|
||||
private String login;
|
||||
@@ -23,35 +26,39 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
@Value("${account-password}")
|
||||
private String password;
|
||||
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
|
||||
@Autowired
|
||||
public SecurityConfiguration(PasswordEncoder passwordEncoder) {
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.inMemoryAuthentication()
|
||||
.withUser(login)
|
||||
@Bean
|
||||
public InMemoryUserDetailsManager userDetailsService(PasswordEncoder passwordEncoder) {
|
||||
UserDetails user = User.builder()
|
||||
.username(login)
|
||||
.password(passwordEncoder.encode(password))
|
||||
.authorities("ROLE_USER");
|
||||
.roles("USER")
|
||||
.build();
|
||||
|
||||
return new InMemoryUserDetailsManager(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf()
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
return http.csrf()
|
||||
.disable()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/site.webmanifest")
|
||||
.permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.authorizeHttpRequests((auth) ->
|
||||
auth.requestMatchers("/site.webmanifest")
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
.authenticated()
|
||||
)
|
||||
.httpBasic()
|
||||
.and()
|
||||
.headers()
|
||||
.frameOptions()
|
||||
.sameOrigin();
|
||||
.sameOrigin()
|
||||
.and()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
@EventListener
|
||||
|
||||
@@ -3,10 +3,10 @@ package ru.serega6531.packmate.model;
|
||||
import lombok.*;
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.hibernate.Hibernate;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.hibernate.Hibernate;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import ru.serega6531.packmate.model.enums.PatternActionType;
|
||||
import ru.serega6531.packmate.model.enums.PatternDirectionType;
|
||||
import ru.serega6531.packmate.model.enums.PatternSearchType;
|
||||
|
||||
import javax.persistence.*;
|
||||
import jakarta.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import ru.serega6531.packmate.model.enums.Protocol;
|
||||
|
||||
import javax.persistence.*;
|
||||
import jakarta.persistence.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package ru.serega6531.packmate.repository;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.*;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import ru.serega6531.packmate.model.Packet;
|
||||
import ru.serega6531.packmate.model.Stream;
|
||||
|
||||
import javax.persistence.QueryHint;
|
||||
import java.util.List;
|
||||
|
||||
public interface StreamRepository extends JpaRepository<Stream, Long>, JpaSpecificationExecutor<Stream> {
|
||||
@@ -22,7 +24,6 @@ public interface StreamRepository extends JpaRepository<Stream, Long>, JpaSpecif
|
||||
"AND (:startingFrom IS NULL OR p.id > :startingFrom) " +
|
||||
"ORDER BY p.id"
|
||||
)
|
||||
@QueryHints(@QueryHint(name = org.hibernate.jpa.QueryHints.HINT_PASS_DISTINCT_THROUGH, value = "false"))
|
||||
List<Packet> getPackets(long streamId, Long startingFrom, Pageable pageable);
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import ru.serega6531.packmate.model.pojo.PatternDto;
|
||||
import ru.serega6531.packmate.model.pojo.SubscriptionMessage;
|
||||
import ru.serega6531.packmate.repository.PatternRepository;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -12,7 +12,7 @@ import ru.serega6531.packmate.model.pojo.ServiceDto;
|
||||
import ru.serega6531.packmate.model.pojo.SubscriptionMessage;
|
||||
import ru.serega6531.packmate.repository.ServiceRepository;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
|
||||
@@ -12,8 +12,6 @@ spring:
|
||||
jdbc:
|
||||
batch_size: 20
|
||||
order_inserts: true
|
||||
temp:
|
||||
use_jdbc_metadata_defaults: false
|
||||
database-platform: org.hibernate.dialect.PostgreSQLDialect
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user