Index: lams_common/src/java/org/lamsfoundation/lams/integration/security/SsoHandler.java =================================================================== diff -u -r2ba6145dadb96f28c465211dc34b4558278067b9 -rec066a30b3900769785b89bd007b1fb1f4bedd7f --- lams_common/src/java/org/lamsfoundation/lams/integration/security/SsoHandler.java (.../SsoHandler.java) (revision 2ba6145dadb96f28c465211dc34b4558278067b9) +++ lams_common/src/java/org/lamsfoundation/lams/integration/security/SsoHandler.java (.../SsoHandler.java) (revision ec066a30b3900769785b89bd007b1fb1f4bedd7f) @@ -77,12 +77,6 @@ // recreate session here in case it was invalidated in login.jsp by sysadmin's LoginAs HttpSession session = request.getSession(); - // LoginRequestServlet (integrations) and LoginAsAction (sysadmin) set this parameter - String redirectURL = request.getParameter("redirectURL"); - if (!StringUtils.isBlank(redirectURL)) { - SsoHandler.handleRedirectBack(context, redirectURL); - } - /* Fetch UserDTO before completing request so putting it later in session is done ASAP * Response is sent in another thread and if UserDTO is not present in session when browser completes redirect, * it results in error. Winning this race is the easiest option. Index: lams_common/src/java/org/lamsfoundation/lams/integration/util/LoginRequestDispatcher.java =================================================================== diff -u -r567018f37ff59abaa5c6acf8a50209543857542f -rec066a30b3900769785b89bd007b1fb1f4bedd7f --- lams_common/src/java/org/lamsfoundation/lams/integration/util/LoginRequestDispatcher.java (.../LoginRequestDispatcher.java) (revision 567018f37ff59abaa5c6acf8a50209543857542f) +++ lams_common/src/java/org/lamsfoundation/lams/integration/util/LoginRequestDispatcher.java (.../LoginRequestDispatcher.java) (revision ec066a30b3900769785b89bd007b1fb1f4bedd7f) @@ -91,8 +91,10 @@ // with lesson id parameter public static final String METHOD_LEARNER_STRICT_AUTHENTICATION = "learnerStrictAuth"; - public static final String PARAM_LESSON_ID = "lsid"; + public static final String PARAM_LEARNING_DESIGN_ID = "ldId"; + public static final String PARAM_LESSON_ID = "lsid"; + private static final String URL_DEFAULT = "/index.jsp"; private static final String URL_AUTHOR = "/home.do?method=author"; @@ -109,14 +111,22 @@ /** * This method is called within LoginRequestValve and LoginRequestServlet. - * It simply fetch the method parameter from HttpServletRequest and build - * the url to redirect user to. + * If there is a redirectURL parameter then this becomes the redirect, otherwise it + * fetches the method parameter from HttpServletRequest and builds the redirect url. + * If the method parameter is used and a lessonId is supplied, then the user is added + * to the LessonClass. * * @param request * @return */ + public static String getRequestURL(HttpServletRequest request) throws ServletException { + // get the location from an explicit parameter if it exists + String redirect = request.getParameter("redirectURL"); + if ( redirect != null ) + return request.getContextPath() + "/" + redirect; + String method = request.getParameter(PARAM_METHOD); String lessonId = request.getParameter(PARAM_LESSON_ID); String mode = request.getParameter(PARAM_MODE); @@ -139,6 +149,7 @@ String requestSrc = request.getParameter(PARAM_REQUEST_SRC); String notifyCloseURL = request.getParameter(AttributeNames.PARAM_NOTIFY_CLOSE_URL); String isPostMessageToParent = request.getParameter(PARAM_IS_POST_MESSAGE_TO_PARENT); + String ldID = request.getParameter(PARAM_LEARNING_DESIGN_ID); // Custom CSV string to be used for tool adapters String customCSV = request.getParameter(PARAM_CUSTOM_CSV); @@ -148,6 +159,7 @@ // append the extra parameters if they are present in the request try { + parameters = ldID != null ? parameters + "&learningDesignID" + "=" + ldID : parameters; parameters = customCSV != null ? parameters + "&" + PARAM_CUSTOM_CSV + "=" + customCSV : parameters; parameters = extLmsId != null ? parameters + "&" + PARAM_EXT_LMS_ID + "=" + extLmsId : parameters; parameters = requestSrc != null ? parameters + "&" + PARAM_REQUEST_SRC + "="