Authorization test

This commit is contained in:
2025-08-12 06:57:10 +05:00
parent d7aebd21dc
commit f2d764c7c2

View File

@ -352,10 +352,20 @@ public class MainController implements ServletContextAware {
@RequestMapping(value = "/",method = RequestMethod.GET,produces = "application/json;charset=utf-8")
@ResponseBody
public ResponseEntity<Object> index(
@CookieValue(value = "lng", defaultValue = "1") String language_id
@CookieValue(value = "lng", defaultValue = "1") String language_id,
HttpServletRequest request
) {
Translation trt = new Translation(language_id,jdbcTemplate);
try {
// Извлекаем заголовок Authorization
/*String authorizationHeader = request.getHeader("Authorization");
if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
String token = authorizationHeader.substring(7); // Убираем "Bearer " из строки
System.out.println("Authorization Bearer Token: " + token);
} else {
System.out.println("Authorization Bearer Token: Not found or invalid");
}*/
JSONObject json = new JSONObject();
json.put("error_code",0);
json.put("error_message","");