This commit is contained in:
Igor I
2025-03-06 16:51:07 +05:00
parent caceeaefb7
commit 7da4dc698d
5 changed files with 10 additions and 156 deletions

View File

@ -468,7 +468,7 @@ public class MainController implements ServletContextAware {
String sql = """
select
name1
name
from
main.get_access_list(:user_id)
where
@ -648,7 +648,7 @@ public class MainController implements ServletContextAware {
//parameters.addValue("phone",);
parameters.addValue("email",newUserModel.getEmail());
parameters.addValue("e_iin",newUserModel.getIin()); //Для ЭЦП это поле обязательно
parameters.addValue("key",newUserModel.getIin());
parameters.addValue("key",personal_data_key);
parameters.addValue("password",password);
ret = jdbcTemplate.query(sql, parameters, new DBTools.JsonRowMapper());
@ -847,7 +847,7 @@ public class MainController implements ServletContextAware {
}catch (DataAccessException ex){
String uuid = UUID.randomUUID().toString();
logger.error(uuid,ex);
throw new CustomException(10000, trt.trt("Error_executing_SQL_query"),uuid);
throw new CustomException(10000, trt.trt("Internal_Server_Error"),uuid);
}
if(json==null) {
String msg = trt.trt("Invalid_username_and_or_password");
@ -1063,8 +1063,8 @@ public class MainController implements ServletContextAware {
}
}catch (DataAccessException ex){
java.lang.String uuid = UUID.randomUUID().toString();
logger.error("Error executing SQL query", uuid, ex);
throw new CustomException(10000, trt.trt("Error_executing_SQL_query"),uuid);
logger.error(uuid, ex);
throw new CustomException(10000, trt.trt("Internal_Server_Error"),uuid);
}catch (Exception e) {
String uuid = UUID.randomUUID().toString();
logger.error(uuid,e);
@ -1240,12 +1240,8 @@ public class MainController implements ServletContextAware {
@RequestMapping(value = "/logout",method = {RequestMethod.POST,RequestMethod.GET},produces = "application/json;charset=utf-8")
@ResponseBody
public String logout(HttpServletResponse response,HttpServletRequest request) {
//Устанавливает куки
setAccessCookie(response,"");
setRefreshCookie(response, request, "");
return createStrJSONError(0,"",(String)null,(String)null);
}
//------------------------------------------------------------------------------------------------------------------
@ -1634,20 +1630,7 @@ public class MainController implements ServletContextAware {
throw new CustomException(10000, Collections.singletonList(trt.trt("Please_log_in")),null);
}
UserDetails userDetails = (UserDetails) authentication.getPrincipal();
/*if(jwt_a.isEmpty() || countOccurrences(jwt_a, '.')!=2)
{
throw new CustomException(10000, Collections.singletonList(trt.trt("Please_log_in")),null);
}
//Checking the token signature
Jws<Claims> claims = null;
try {
claims = Jwts.parserBuilder()
.setSigningKey(getPublicKey()) //.setSigningKey(key_a)
.build()
.parseClaimsJws(jwt_a);
} catch (Exception e) {
throw new CustomException(10000, Arrays.asList(trt.trt("Please_log_in"), trt.trt("JWT_token_verification_error")),null);
}*/
//If this is a repeat authorization, then we inform the client about it
String result=null;
try(Cache cache = new Cache(redis_host,redis_port,redis_password)) {

View File

@ -51,7 +51,7 @@ public class SecurityConfig {
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
String path = request.getRequestURI();
System.out.println(path); // https://127.0.0.1:8082/logout
return path.equals("/") || path.equals("/login") || path.equals("/logout") || path.equals("/create");
return path.equals("/") || path.equals("/login") || path.equals("/logout") || path.equals("/create") || path.equals("/reset");
}
@Override

View File

@ -12,7 +12,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class Cache implements AutoCloseable {
private static final Logger logger = LogManager.getLogger(Cache.class);
@ -60,4 +59,4 @@ public class Cache implements AutoCloseable {
public void delete(String key) {
jedis.del(key.getBytes());
}
}
}