From e594e6a5ad931fba5f9c66b01a39e4bcf3af6916 Mon Sep 17 00:00:00 2001 From: gsd Date: Tue, 14 Mar 2023 17:12:24 +0300 Subject: [PATCH] f3 --- src/main/java/app/utils/SaltedCookie.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/app/utils/SaltedCookie.java b/src/main/java/app/utils/SaltedCookie.java index 907c55c..f4f2379 100644 --- a/src/main/java/app/utils/SaltedCookie.java +++ b/src/main/java/app/utils/SaltedCookie.java @@ -4,6 +4,7 @@ import app.updates.CountriesUpdater; import jakarta.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.util.DigestUtils; @@ -16,10 +17,15 @@ public class SaltedCookie { @Value("${backend.auth.salt}") private String salt; - private HashMap secret_keys = new HashMap<>(); + private HashMap secret_keys; private final Logger logger = LoggerFactory.getLogger(SaltedCookie.class); + @Autowired + public SaltedCookie() { + secret_keys = new HashMap<>(); + } + public String Hashed(String value) { return DigestUtils.md5DigestAsHex(String.format("%s+%s", value, salt).getBytes()); }