From bf85df2c101fe70921d2a0ba3b866a9262022a08 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 23 Mar 2012 15:10:55 -0700 Subject: [PATCH] Use final Strings for attribute names. --- .../net/basic/AuthenticatingHttpServlet.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/sourceforge/guacamole/net/basic/AuthenticatingHttpServlet.java b/src/main/java/net/sourceforge/guacamole/net/basic/AuthenticatingHttpServlet.java index bf227f7..b2aa8ff 100644 --- a/src/main/java/net/sourceforge/guacamole/net/basic/AuthenticatingHttpServlet.java +++ b/src/main/java/net/sourceforge/guacamole/net/basic/AuthenticatingHttpServlet.java @@ -44,6 +44,16 @@ public abstract class AuthenticatingHttpServlet extends HttpServlet { private Logger logger = LoggerFactory.getLogger(AuthenticatingHttpServlet.class); /** + * The session attribute holding the map of configurations. + */ + private static final String CONFIGURATIONS_ATTRIBUTE = "GUAC_CONFIGS"; + + /** + * The session attribute holding the credentials authorizing this session. + */ + private static final String CREDENTIALS_ATTRIBUTE = "GUAC_CREDS"; + + /** * The error message to be provided to the client user if authentication * fails for ANY REASON. */ @@ -151,7 +161,7 @@ public abstract class AuthenticatingHttpServlet extends HttpServlet { * @return The credentials associated with the given session. */ protected Credentials getCredentials(HttpSession session) { - return (Credentials) session.getAttribute("GUAC_CREDS"); + return (Credentials) session.getAttribute(CREDENTIALS_ATTRIBUTE); } /** @@ -161,7 +171,7 @@ public abstract class AuthenticatingHttpServlet extends HttpServlet { * @return The configurations associated with the given session. */ protected Map getConfigurations(HttpSession session) { - return (Map) session.getAttribute("GUAC_CONFIGS"); + return (Map) session.getAttribute(CONFIGURATIONS_ATTRIBUTE); } @Override @@ -253,8 +263,8 @@ public abstract class AuthenticatingHttpServlet extends HttpServlet { } // Associate configs and credentials with session - httpSession.setAttribute("GUAC_CONFIGS", configs); - httpSession.setAttribute("GUAC_CREDS", credentials); + httpSession.setAttribute(CONFIGURATIONS_ATTRIBUTE, configs); + httpSession.setAttribute(CREDENTIALS_ATTRIBUTE, credentials); } -- 1.7.10.4