X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Fauth%2FHttpRequestCallbackHandler.java;h=934fdd96bdf86ae7fa047507fc6c68acd3e58c25;hb=beec30ca4ad6e0a27b3fe984d987b98988e14e76;hp=bcc403fa996c4060cc4e3baa27158a40392cf298;hpb=d66d81530f1da58e2e2c5d25e0a5dc30ad32b848;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/auth/HttpRequestCallbackHandler.java b/org.argeo.cms/src/org/argeo/cms/auth/HttpRequestCallbackHandler.java index bcc403fa9..934fdd96b 100644 --- a/org.argeo.cms/src/org/argeo/cms/auth/HttpRequestCallbackHandler.java +++ b/org.argeo.cms/src/org/argeo/cms/auth/HttpRequestCallbackHandler.java @@ -6,28 +6,35 @@ import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.LanguageCallback; import javax.security.auth.callback.UnsupportedCallbackException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; /** * Callback handler populating {@link HttpRequestCallback}s with the provided * {@link HttpServletRequest}, and ignoring any other callback. */ public class HttpRequestCallbackHandler implements CallbackHandler { - final private HttpServletRequest request; - final private HttpServletResponse response; + final private HttpRequest request; + final private HttpResponse response; + final private HttpSession httpSession; - public HttpRequestCallbackHandler(HttpServletRequest request, HttpServletResponse response) { + public HttpRequestCallbackHandler(HttpRequest request, HttpResponse response) { this.request = request; + this.httpSession = request.getSession(); this.response = response; } + public HttpRequestCallbackHandler(HttpSession httpSession) { + this.httpSession = httpSession; + this.request = null; + this.response = null; + } + @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) if (callback instanceof HttpRequestCallback) { ((HttpRequestCallback) callback).setRequest(request); ((HttpRequestCallback) callback).setResponse(response); + ((HttpRequestCallback) callback).setHttpSession(httpSession); } else if (callback instanceof LanguageCallback) { ((LanguageCallback) callback).setLocale(request.getLocale()); }