Index: lams_central/src/java/org/lamsfoundation/lams/web/LoginRequestServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/LoginRequestServlet.java,v diff -u -r1.27 -r1.28 --- lams_central/src/java/org/lamsfoundation/lams/web/LoginRequestServlet.java 4 Aug 2015 20:56:00 -0000 1.27 +++ lams_central/src/java/org/lamsfoundation/lams/web/LoginRequestServlet.java 5 Aug 2015 17:45:37 -0000 1.28 @@ -85,7 +85,6 @@ * @throws IOException * if an error occurred */ - @SuppressWarnings("unchecked") @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession hses = request.getSession(true); @@ -115,8 +114,8 @@ // LDEV-2196 preserve character encoding if necessary if (request.getCharacterEncoding() == null) { - LoginRequestServlet.log - .debug("request.getCharacterEncoding is empty, parsing username and courseName as 8859_1 to UTF-8..."); + LoginRequestServlet.log.debug( + "request.getCharacterEncoding is empty, parsing username and courseName as 8859_1 to UTF-8..."); extUsername = new String(extUsername.getBytes("8859_1"), "UTF-8"); if (courseName != null) { courseName = new String(courseName.getBytes("8859_1"), "UTF-8"); @@ -134,10 +133,10 @@ langIsoCode, countryIsoCode, email, prefix, isUpdateUserDetails); } - //in case of request for learner with strict authentication check cache should also contain lsid + // in case of request for learner with strict authentication check cache should also contain lsid String lsId = null; if (LoginRequestDispatcher.METHOD_LEARNER_STRICT_AUTHENTICATION.equals(method)) { - + lsId = request.getParameter(LoginRequestDispatcher.PARAM_LESSON_ID); if (lsId == null) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Login Failed - lsId parameter missing"); @@ -146,6 +145,12 @@ } Authenticator.authenticateLoginRequest(serverMap, timestamp, extUsername, method, lsId, hash); + if (extCourseId != null) { + // check if organisation, ExtCourseClassMap and user roles exist and up-to-date, and if not update them + getService().getExtCourseClassMap(serverMap, userMap, extCourseId, countryIsoCode, langIsoCode, + courseName, method, prefix); + } + User user = userMap.getUser(); String login = user.getLogin(); // The "extUser" attribute works as a flag to indicate if the user has logged in @@ -163,12 +168,6 @@ hses = recreateSession(request, response); } - if (extCourseId != null) { - //check if organisation, ExtCourseClassMap and user roles exist and up-to-date, and if not update them - getService().getExtCourseClassMap(serverMap, userMap, extCourseId, countryIsoCode, langIsoCode, - courseName, method, prefix); - } - LoginRequestServlet.log.debug("Session Id - " + hses.getId()); // connect to DB and get password here String pass = getUserPassword(userMap.getUser().getLogin()); @@ -179,7 +178,8 @@ response.sendRedirect("j_security_check?j_username=" + login + "&j_password=" + pass); } catch (AuthenticationException e) { LoginRequestServlet.log.error("Authentication error: ", e); - response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Login Failed - authentication error. " + e.getMessage()); + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, + "Login Failed - authentication error. " + e.getMessage()); } catch (UserInfoFetchException e) { LoginRequestServlet.log.error("User fetch info error: ", e); response.sendError(HttpServletResponse.SC_BAD_GATEWAY, @@ -198,7 +198,7 @@ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } } - + /** * The doPost method of the servlet.
*