Skip to content

Commit

Permalink
spring 6 (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Sep 26, 2024
1 parent 4a7ed95 commit 32417ed
Show file tree
Hide file tree
Showing 62 changed files with 184 additions and 774 deletions.
67 changes: 38 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
<java.version>21</java.version>

<maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format>
<dependency.spring.version>5.3.39</dependency.spring.version>
<spring.security.version>5.8.14</spring.security.version>
<dependency.spring.version>6.1.13</dependency.spring.version>
<spring.security.version>6.3.3</spring.security.version>
<jdbc.postgresql.version>42.7.3</jdbc.postgresql.version>
<elastic4s.version>7.17.4</elastic4s.version>
<scala.version>2.13.14</scala.version>
<scala.suffix>2.13</scala.suffix>
<activemq.version>5.18.5</activemq.version>
<activemq.version>6.1.3</activemq.version>
<slf4j.version>1.7.22</slf4j.version>
<jquery.validation.version>1.19.5</jquery.validation.version>
<jquery.form.version>4.3.0</jquery.form.version>
<jetty.version>10.0.16</jetty.version>
<jetty.version>12.0.13</jetty.version>
<akka.version>2.6.21</akka.version>
<log4j.version>2.23.1</log4j.version>
<d3js.version>5.9.7</d3js.version>
Expand Down Expand Up @@ -127,11 +127,6 @@
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand Down Expand Up @@ -205,31 +200,31 @@
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0.1</version>
<groupId>jakarta.jms</groupId>
<artifactId>jakarta.jms-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
Expand Down Expand Up @@ -277,6 +272,14 @@
<artifactId>ehcache-core</artifactId>
<version>2.6.11</version>
</dependency>

<!-- костыль для ehcache 2.x -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>5.3.39</version>
</dependency>

<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
Expand All @@ -285,7 +288,7 @@
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>4.0.4</version>
<version>5.1.3</version>
</dependency>

<dependency>
Expand All @@ -304,7 +307,13 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.5</version>
<version>2.14.3</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_${scala.suffix}</artifactId>
<version>2.14.3</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -897,13 +906,13 @@
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-maven-plugin</artifactId>
<version>${jetty.version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-jetty-server</artifactId>
<artifactId>jetty-websocket-jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2019 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -15,12 +15,11 @@

package ru.org.linux.auth;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) {
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ru/org/linux/auth/BanIPController.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package ru.org.linux.auth;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -26,7 +27,6 @@
import ru.org.linux.user.User;
import ru.org.linux.user.UserErrorException;

import javax.servlet.http.HttpServletRequest;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ru/org/linux/auth/LoginController.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2023 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -18,6 +18,7 @@ import akka.actor.ActorSystem
import com.typesafe.scalalogging.StrictLogging
import io.circe.{Encoder, Json}
import io.circe.syntax.*
import jakarta.servlet.http.{Cookie, HttpServletRequest, HttpServletResponse}
import org.springframework.security.authentication.{AccountStatusException, AuthenticationManager, BadCredentialsException, LockedException, UsernamePasswordAuthenticationToken}
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.security.core.userdetails.{UserDetailsService, UsernameNotFoundException}
Expand All @@ -29,7 +30,6 @@ import org.springframework.web.servlet.view.RedirectView
import ru.org.linux.user.UserDao

import java.util.concurrent.CompletionStage
import javax.servlet.http.{Cookie, HttpServletRequest, HttpServletResponse}
import scala.compat.java8.FutureConverters.*
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Promise
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/ru/org/linux/boxlets/AbstractBoxlet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2016 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -15,12 +15,11 @@

package ru.org.linux.boxlets;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class AbstractBoxlet extends AbstractController {
protected abstract ModelAndView getData(HttpServletRequest request
) throws Exception;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ru/org/linux/boxlets/LastMiniNewsBoxlet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2016 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -15,6 +15,7 @@

package ru.org.linux.boxlets;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -23,7 +24,6 @@
import ru.org.linux.topic.LastMiniNewsDao;
import ru.org.linux.user.Profile;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ru/org/linux/boxlets/TagCloudBoxlet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2017 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -15,14 +15,14 @@

package ru.org.linux.boxlets;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import ru.org.linux.tag.TagCloudDao;
import ru.org.linux.tag.TagCloudDao.TagDTO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
Expand All @@ -44,7 +45,6 @@
import scala.Tuple2;

import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import java.beans.PropertyEditorSupport;
import java.util.HashSet;
import java.util.List;
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/ru/org/linux/csrf/CSRFHandlerInterceptor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2023 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -15,15 +15,14 @@
package ru.org.linux.csrf;

import com.google.common.base.Strings;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import ru.org.linux.auth.AccessViolationException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CSRFHandlerInterceptor implements HandlerInterceptor {
private static final Logger logger = LoggerFactory.getLogger(CSRFHandlerInterceptor.class);

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/ru/org/linux/csrf/CSRFProtectionService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2018 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -16,13 +16,13 @@
package ru.org.linux.csrf;

import com.google.common.base.Strings;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.Errors;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.SecureRandom;
import java.util.Base64;

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/ru/org/linux/exception/ExceptionController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2016 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -14,15 +14,15 @@
*/
package ru.org.linux.exception;

import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class ExceptionController {
@Autowired
Expand All @@ -34,7 +34,7 @@ public ModelAndView defaultExceptionHandler(
HttpServletResponse response,
Object handler
) {
Throwable ex = (Throwable) request.getAttribute("javax.servlet.error.exception");
Throwable ex = (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
if (ex == null) {
return new ModelAndView(new RedirectView("/"));
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/ru/org/linux/exception/ExceptionResolver.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2016 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -14,6 +14,8 @@
*/
package ru.org.linux.exception;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -26,9 +28,6 @@
import ru.org.linux.user.UserErrorException;
import ru.org.linux.util.StringUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* Класс. предназначенный для перехвата исключений приложения.
*/
Expand Down
Loading

0 comments on commit 32417ed

Please sign in to comment.