public static void addResponseCookie(FacesContext context, String name, String value, Map<String, Object> properties) {
        if (properties == null) {
            properties = new HashMap<>(3);
        }

        PrimeRequestContext requestContext = PrimeRequestContext.getCurrentInstance(context);
        PrimeApplicationContext applicationContext = requestContext.getApplicationContext();

        boolean isSecure = requestContext.isSecure() && applicationContext.getConfig().isCookiesSecure();

        properties.put("secure", isSecure);

        String sameSite = applicationContext.getConfig().getCookiesSameSite();
        // "None" is only allowed when Secure attribute so default to Lax if unsecure
        if (LangUtils.isBlank(sameSite) || (!isSecure && "None".equalsIgnoreCase(sameSite))) {
            sameSite = "Lax";
        }
        properties.put("SameSite", sameSite);

        context.getExternalContext().addResponseCookie(name, value, properties);
    }
Adds the cookie represented by the arguments to the response. If the current HTTP conversation is secured
over SSL (e.g. https:) then the cookie is set to secure=true and sameSite=Strict.

@param context the FacesContext contains the External context we add the cookie to
@param name To be passed as the first argument to the <code>Cookie</code> constructor.
@param value To be passed as the second argument to the <code>Cookie</code> constructor.
@param properties A <code>Map</code> containing key/value pairs to be passed
as arguments to the setter methods as described above.
primefaces/src/main/java/org/primefaces/util/ResourceUtils.java