From 632216d53f4b1ced685e634a6bea56715f8e3e40 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 26 Nov 2015 20:06:05 +0100 Subject: [PATCH] KEYCLOAK-2144 Set locale cookie to http-only --- .../java/org/keycloak/services/util/LocaleHelper.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/services/src/main/java/org/keycloak/services/util/LocaleHelper.java b/services/src/main/java/org/keycloak/services/util/LocaleHelper.java index 0a15bf1e8a..eeefc8106e 100644 --- a/services/src/main/java/org/keycloak/services/util/LocaleHelper.java +++ b/services/src/main/java/org/keycloak/services/util/LocaleHelper.java @@ -113,15 +113,7 @@ public class LocaleHelper { RealmModel realm, String locale) { boolean secure = realm.getSslRequired().isRequired(session.getContext().getUri().getRequestUri().getHost()); - addCookie(LOCALE_COOKIE, locale, AuthenticationManager.getRealmCookiePath(realm, session.getContext().getUri()), null, null, -1, secure, true); - } - - private static void addCookie(String name, String value, String path, String domain, String comment, int maxAge, boolean secure, boolean httpOnly) { - HttpResponse response = ResteasyProviderFactory.getContextData(HttpResponse.class); - StringBuffer cookieBuf = new StringBuffer(); - ServerCookie.appendCookieValue(cookieBuf, 1, name, value, path, domain, comment, maxAge, secure, httpOnly); - String cookie = cookieBuf.toString(); - response.getOutputHeaders().add(HttpHeaders.SET_COOKIE, cookie); + CookieHelper.addCookie(LOCALE_COOKIE, locale, AuthenticationManager.getRealmCookiePath(realm, session.getContext().getUri()), null, null, -1, secure, true); } private static Locale findLocale(Set supportedLocales, String... localeStrings) {