|
|
|
|
@ -23,16 +23,16 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class JwtUtils {
|
|
|
|
|
|
|
|
|
|
@Value("${bezkoder.app.jwtSecret}")
|
|
|
|
|
@Value("${cuuva.app.jwtSecret}")
|
|
|
|
|
private String jwtSecret;
|
|
|
|
|
|
|
|
|
|
@Value("${bezkoder.app.jwtExpirationMs}")
|
|
|
|
|
@Value("${cuuva.app.jwtExpirationMs}")
|
|
|
|
|
private int jwtExpirationMs;
|
|
|
|
|
|
|
|
|
|
@Value("${bezkoder.app.jwtCookieName}")
|
|
|
|
|
@Value("${cuuva.app.jwtCookieName}")
|
|
|
|
|
private String jwtCookie;
|
|
|
|
|
|
|
|
|
|
@Value("${bezkoder.app.jwtRefreshCookieName}")
|
|
|
|
|
@Value("${cuuva.app.jwtRefreshCookieName}")
|
|
|
|
|
private String jwtRefreshCookie;
|
|
|
|
|
|
|
|
|
|
public ResponseCookie generateJwtCookie(UserDetailsImpl userPrincipal) {
|
|
|
|
|
@ -108,8 +108,18 @@ public class JwtUtils {
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private String getCookieValueByName(HttpServletRequest request, String name) {
|
|
|
|
|
// Cookie cookie = WebUtils.getCookie(request, name);
|
|
|
|
|
// return cookie != null ? cookie.getValue() : null;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
private String getCookieValueByName(HttpServletRequest request, String name) {
|
|
|
|
|
Cookie cookie = WebUtils.getCookie(request, name);
|
|
|
|
|
return cookie != null ? cookie.getValue() : null;
|
|
|
|
|
if (cookie == null) {
|
|
|
|
|
System.out.println("Cookie with name '" + name + "' not found");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
System.out.println("Found cookie: " + cookie.getName() + " = " + cookie.getValue());
|
|
|
|
|
return cookie.getValue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|