-
- HttpSession httpSession = request.getSession(true);
-
- // Retrieve username and password from parms
- String username = request.getParameter("username");
- String password = request.getParameter("password");
-
- // Build credentials object
- Credentials credentials = new Credentials ();
- credentials.setSession(httpSession);
- credentials.setRequest(request);
- credentials.setUsername(username);
- credentials.setPassword(password);
-
- // Get authorized configs
- Map<String, GuacamoleConfiguration> configs;
- try {
- configs = authProvider.getAuthorizedConfigurations(credentials);
- }
- catch (GuacamoleException e) {
- logger.error("Error retrieving configuration(s) for user {}.", username);
- response.sendError(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- if (configs == null) {
- logger.warn("Failed login from {} for user \"{}\".", request.getRemoteAddr(), username);
- response.sendError(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- logger.info("Successful login from {} for user \"{}\".", request.getRemoteAddr(), username);
-
- // Associate configs with session
- httpSession.setAttribute("GUAC_CONFIGS", configs);
-