Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/ConfigServlet.java =================================================================== diff -u -r8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4 -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/ConfigServlet.java (.../ConfigServlet.java) (revision 8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/ConfigServlet.java (.../ConfigServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -89,9 +89,6 @@ String secretKey = properties.getProperty(LamsPluginUtil.PROP_LAMS_SECRET_KEY, ""); request.setAttribute("secretKey", secretKey); - String requestSrc = properties.getProperty(LamsPluginUtil.PROP_REQ_SRC); - request.setAttribute("requestSrc", requestSrc); - String lamsServerTimeRefreshInterval = properties.getProperty(LamsPluginUtil.PROP_LAMS_SERVER_TIME_REFRESH_INTERVAL); request.setAttribute("lamsServerTimeRefreshInterval", lamsServerTimeRefreshInterval); @@ -115,15 +112,13 @@ String lamsServerUrl = request.getParameter("lamsServerUrl"); String lamsServerId = request.getParameter("lamsServerId"); String lamsSecretKey = request.getParameter("lamsSecretKey"); - String requestSrc = request.getParameter("requestSrc"); String lamsServerTimeRefreshInterval = request.getParameter("lamsServerTimeRefreshInterval"); String lamsAltServerUrl = request.getParameter("lamsAltServerUrl"); // Save the properties to Blackboard properties.setProperty(LamsPluginUtil.PROP_LAMS_URL, lamsServerUrl); properties.setProperty(LamsPluginUtil.PROP_LAMS_SECRET_KEY, lamsSecretKey); properties.setProperty(LamsPluginUtil.PROP_LAMS_SERVER_ID, lamsServerId); - properties.setProperty(LamsPluginUtil.PROP_REQ_SRC, requestSrc); properties.setProperty(LamsPluginUtil.PROP_LAMS_SERVER_TIME_REFRESH_INTERVAL, lamsServerTimeRefreshInterval); properties.setProperty(LamsPluginUtil.PROP_ALT_LAMS_URL, lamsAltServerUrl); Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookServlet.java =================================================================== diff -u -r535a8b4b59cfcf0932f4f3835915a8635107306c -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookServlet.java (.../GradebookServlet.java) (revision 535a8b4b59cfcf0932f4f3835915a8635107306c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookServlet.java (.../GradebookServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -102,7 +102,7 @@ } //check user rights - String secretKey = LamsPluginUtil.getSecretKey(); + String secretKey = LamsPluginUtil.getServerSecretKey(); String serverId = LamsPluginUtil.getServerId(); if (!LamsSecurityUtil.sha1( timeStamp.toLowerCase() + userName.toLowerCase() + serverId.toLowerCase() @@ -119,7 +119,7 @@ Id userId = user.getId(); //allow lessonComplete.jsp on LAMS side to make an Ajax call to this servlet - String serverUrlWithLamsWord = LamsSecurityUtil.getServerAddress(); + String serverUrlWithLamsWord = LamsPluginUtil.getServerUrl(); URI uri = new URI(serverUrlWithLamsWord); //strip out '/lams/' from the end of the URL String serverUrl = serverUrlWithLamsWord.lastIndexOf(uri.getPath()) == -1 ? serverUrlWithLamsWord @@ -138,7 +138,7 @@ logger.info("Record score for " + lineitem.getName() + " lesson. It now has " + lineitem.getScores().size() + " scores."); - String getLamsMarkURL = LamsSecurityUtil.getServerAddress() + "/services/xml/LessonManager?" + String getLamsMarkURL = LamsPluginUtil.getServerUrl() + "/services/xml/LessonManager?" + LamsSecurityUtil.generateAuthenticateParameters(userName) + "&method=gradebookMarksUser" + "&lsId=" + lamsLessonIdParam Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookSyncFixServlet.java =================================================================== diff -u -r45cb68e6656a9b0cf23271124292469a499632e9 -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookSyncFixServlet.java (.../GradebookSyncFixServlet.java) (revision 45cb68e6656a9b0cf23271124292469a499632e9) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookSyncFixServlet.java (.../GradebookSyncFixServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -44,6 +44,7 @@ import org.lamsfoundation.ld.integration.Constants; import org.lamsfoundation.ld.integration.util.LamsBuildingBlockException; +import org.lamsfoundation.ld.integration.util.LamsPluginUtil; import org.lamsfoundation.ld.integration.util.LamsSecurityUtil; import org.lamsfoundation.ld.integration.util.LineitemUtil; import org.w3c.dom.Document; @@ -97,7 +98,7 @@ } String username = ctx.getUser().getUserName(); - String serviceURL = LamsSecurityUtil.getServerAddress() + "/services/xml/LessonManager?" + String serviceURL = LamsPluginUtil.getServerUrl() + "/services/xml/LessonManager?" + LamsSecurityUtil.generateAuthenticateParameters(username) + "&method=gradebookMarksLesson&lsId=" + lamsLessonIdParam; Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookSyncServlet.java =================================================================== diff -u -r535a8b4b59cfcf0932f4f3835915a8635107306c -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookSyncServlet.java (.../GradebookSyncServlet.java) (revision 535a8b4b59cfcf0932f4f3835915a8635107306c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookSyncServlet.java (.../GradebookSyncServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory; import org.lamsfoundation.ld.integration.Constants; import org.lamsfoundation.ld.integration.util.LamsBuildingBlockException; +import org.lamsfoundation.ld.integration.util.LamsPluginUtil; import org.lamsfoundation.ld.integration.util.LamsSecurityUtil; import org.lamsfoundation.ld.integration.util.LineitemUtil; import org.w3c.dom.Document; @@ -105,7 +106,7 @@ } String username = ctx.getUser().getUserName(); - String serviceURL = LamsSecurityUtil.getServerAddress() + "/services/xml/LessonManager?" + String serviceURL = LamsPluginUtil.getServerUrl() + "/services/xml/LessonManager?" + LamsSecurityUtil.generateAuthenticateParameters(username) + "&method=gradebookMarksLesson&lsId=" + lamsLessonIdParam; Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GroupDataServlet.java =================================================================== diff -u -r535a8b4b59cfcf0932f4f3835915a8635107306c -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GroupDataServlet.java (.../GroupDataServlet.java) (revision 535a8b4b59cfcf0932f4f3835915a8635107306c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GroupDataServlet.java (.../GroupDataServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -79,7 +79,7 @@ return; } - String secretKey = LamsPluginUtil.getSecretKey(); + String secretKey = LamsPluginUtil.getServerSecretKey(); String serverId = LamsPluginUtil.getServerId(); if (!LamsSecurityUtil.sha1( Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java =================================================================== diff -u -r8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4 -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java (.../LamsLearningDesignDeleteServlet.java) (revision 8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignDeleteServlet.java (.../LamsLearningDesignDeleteServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.lamsfoundation.ld.integration.util.LamsPluginUtil; import org.lamsfoundation.ld.integration.util.LamsSecurityUtil; import blackboard.base.InitializationException; @@ -53,8 +54,8 @@ } protected void process(HttpServletRequest request, HttpServletResponse response) { - String serverAddr = LamsSecurityUtil.getServerAddress(); - String serverId = LamsSecurityUtil.getServerID(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverId = LamsPluginUtil.getServerId(); // If lams.properties could not be read, throw exception if (serverAddr == null || serverId == null) { Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java =================================================================== diff -u -r8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4 -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java (.../LamsLearningDesignServlet.java) (revision 8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsLearningDesignServlet.java (.../LamsLearningDesignServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletResponse; import org.lamsfoundation.ld.integration.Constants; +import org.lamsfoundation.ld.integration.util.LamsPluginUtil; import org.lamsfoundation.ld.integration.util.LamsSecurityUtil; import blackboard.base.InitializationException; @@ -54,8 +55,8 @@ } protected void process(HttpServletRequest request, HttpServletResponse response) { - String serverAddr = LamsSecurityUtil.getServerAddress(); - String serverId = LamsSecurityUtil.getServerID(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverId = LamsPluginUtil.getServerId(); // If lams.properties could not be read, throw exception if (serverAddr == null || serverId == null) { Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LessonManagerServlet.java =================================================================== diff -u -r535a8b4b59cfcf0932f4f3835915a8635107306c -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LessonManagerServlet.java (.../LessonManagerServlet.java) (revision 535a8b4b59cfcf0932f4f3835915a8635107306c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LessonManagerServlet.java (.../LessonManagerServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -35,6 +35,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.lamsfoundation.ld.integration.util.BlackboardUtil; +import org.lamsfoundation.ld.integration.util.LamsPluginUtil; import org.lamsfoundation.ld.integration.util.LamsSecurityUtil; import org.lamsfoundation.ld.integration.util.LineitemUtil; import org.xml.sax.SAXException; @@ -146,7 +147,7 @@ private void showStartLessonPage(HttpServletRequest request, HttpServletResponse response, Context ctx) throws InitializationException, BbServiceException, PersistenceException, IOException, ServletException { - String lamsServerUrl = LamsSecurityUtil.getServerAddress(); + String lamsServerUrl = LamsPluginUtil.getServerUrl(); request.setAttribute("lamsServerUrl", lamsServerUrl); // get all user accessible folders and LD descriptions as JSON Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/OpenLamsPageServlet.java =================================================================== diff -u -r535a8b4b59cfcf0932f4f3835915a8635107306c -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/OpenLamsPageServlet.java (.../OpenLamsPageServlet.java) (revision 535a8b4b59cfcf0932f4f3835915a8635107306c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/OpenLamsPageServlet.java (.../OpenLamsPageServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -115,8 +115,6 @@ // construct Login Request URL for authoring LAMS Lessons String authorUrl = LamsSecurityUtil.generateRequestURL(ctx, "author", null); - authorUrl += "&isPostMessageToParent=true"; - response.sendRedirect(authorUrl); } Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/UserDataServlet.java =================================================================== diff -u -r535a8b4b59cfcf0932f4f3835915a8635107306c -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/UserDataServlet.java (.../UserDataServlet.java) (revision 535a8b4b59cfcf0932f4f3835915a8635107306c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/UserDataServlet.java (.../UserDataServlet.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -74,7 +74,7 @@ return; } - String secretKey = LamsPluginUtil.getSecretKey(); + String secretKey = LamsPluginUtil.getServerSecretKey(); String serverId = LamsPluginUtil.getServerId(); if (!LamsSecurityUtil.sha1( Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LamsPluginUtil.java =================================================================== diff -u -r8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4 -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LamsPluginUtil.java (.../LamsPluginUtil.java) (revision 8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LamsPluginUtil.java (.../LamsPluginUtil.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -49,7 +49,6 @@ public static final String PROP_LAMS_SECRET_KEY = "LAMS_SERVER_SKEY"; public static final String PROP_LAMS_SERVER_ID = "LAMS_SERVER_ID"; public static final String PROP_LAMS_URL = "LAMS_SERVER_URL"; - public static final String PROP_REQ_SRC = "BB_REQ_SRC"; public static final String PROP_LAMS_SERVER_TIME_REFRESH_INTERVAL = "LAMS_SERVER_TIME_REFRESH_INTERVAL"; public static final String PROP_ALT_LAMS_URL = "LAMS_ALT_SERVER_URL"; @@ -79,7 +78,6 @@ p.setProperty(PROP_LAMS_URL, ""); p.setProperty(PROP_LAMS_SECRET_KEY, ""); p.setProperty(PROP_LAMS_SERVER_ID, ""); - p.setProperty(PROP_REQ_SRC, ""); p.setProperty(PROP_LAMS_SERVER_TIME_REFRESH_INTERVAL, "24"); } @@ -123,7 +121,7 @@ * * @return the secret key from lams.properties */ - public static String getSecretKey() { + public static String getServerSecretKey() { return getProperties().getProperty(PROP_LAMS_SECRET_KEY); } @@ -142,14 +140,6 @@ public static String getServerId() { return getProperties().getProperty(PROP_LAMS_SERVER_ID); } - - /** - * - * @return the request source from lams.properties - */ - public static String getReqSrc() { - return getProperties().getProperty(PROP_REQ_SRC); - } /** * Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LamsSecurityUtil.java =================================================================== diff -u -r535a8b4b59cfcf0932f4f3835915a8635107306c -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LamsSecurityUtil.java (.../LamsSecurityUtil.java) (revision 535a8b4b59cfcf0932f4f3835915a8635107306c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LamsSecurityUtil.java (.../LamsSecurityUtil.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -93,12 +93,11 @@ * @throws Exception */ public static String generateRequestURL(Context ctx, String method, String lsid) throws PersistenceException, IOException { - String serverAddr = getServerAddress(); - String serverId = getServerID(); - String reqSrc = getReqSrc(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverId = LamsPluginUtil.getServerId(); // If lams.properties could not be read, throw exception - if (serverAddr == null || serverId == null || reqSrc == null) { + if (serverAddr == null || serverId == null) { throw new RuntimeException("Configuration Exception " + serverAddr + ", " + serverId); } @@ -115,26 +114,24 @@ // do to be authorised to use authoring you must be in an organisation. String courseId = setupCourseId(ctx, null, true); - String secretkey = LamsPluginUtil.getSecretKey(); + String serverSecretKey = LamsPluginUtil.getServerSecretKey(); // in case of learnerStrictAuth we should also include lsid value when creating hash: [ts + uid + method + lsid - // + serverID + serverKey] - // regular case: [ts + uid + method + serverID + serverKey] + // + serverID + serverSecretKey] + // regular case: [ts + uid + method + serverID + serverSecretKey] String plaintext = timestamp.toLowerCase().trim() + username.toLowerCase().trim() + method.toLowerCase().trim() + ("learnerStrictAuth".equals(method) ? lsid.toLowerCase().trim() : "") + serverId.toLowerCase().trim() - + secretkey.toLowerCase().trim(); + + serverSecretKey.toLowerCase().trim(); // generate authentication hash code to validate parameters String hash = sha1(plaintext); String url; try { String course = courseId != null ? "&courseid=" + URLEncoder.encode(courseId, "UTF8") : ""; url = serverAddr + "/LoginRequest?" + "&uid=" + URLEncoder.encode(username, "UTF8") + "&method=" + method - + "&ts=" + timestamp + "&sid=" + serverId + "&hash=" + hash + course - + "&country=" + country + "&lang=" + lang + "&requestSrc=" - + URLEncoder.encode(reqSrc, "UTF8") + "&firstName=" + URLEncoder.encode(firstName, "UTF-8") - + "&lastName=" + URLEncoder.encode(lastName, "UTF-8") - + "&email=" + URLEncoder.encode(email, "UTF-8"); + + "&ts=" + timestamp + "&sid=" + serverId + "&hash=" + hash + course + "&country=" + country + + "&lang=" + lang + "&firstName=" + URLEncoder.encode(firstName, "UTF-8") + "&lastName=" + + URLEncoder.encode(lastName, "UTF-8") + "&email=" + URLEncoder.encode(email, "UTF-8"); if ("learnerStrictAuth".equals(method) || "monitor".equals(method)) { url += "&lsid=" + lsid; @@ -155,12 +152,11 @@ * @throws UnsupportedEncodingException */ public static String generateAuthenticateParameters(String username) throws UnsupportedEncodingException { - String serverAddr = getServerAddress(); - String serverId = getServerID(); - String reqSrc = getReqSrc(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverId = LamsPluginUtil.getServerId(); // If lams.properties could not be read, throw exception - if (serverAddr == null || serverId == null || reqSrc == null) { + if (serverAddr == null || serverId == null) { throw new RuntimeException("Configuration Exception " + serverAddr + ", " + serverId); } @@ -182,7 +178,7 @@ * @throws UnsupportedEncodingException */ public static String generateRequestLearningDesignImage(String username) throws UnsupportedEncodingException { - String serverAddr = getServerAddress(); + String serverAddr = LamsPluginUtil.getServerUrl(); //$request = "$CFG->lamslesson_serverurl/services/LearningDesignSVG?serverId=" . $CFG->lamslesson_serverid . "&datetime=" . $datetime_encoded . "&hashValue=" . //$hashvalue . "&username=" . $username . "&courseId=" . $courseid . "&courseName=" . urlencode($coursename) . "&mode=2&country=" . $country . "&lang=" . $lang . @@ -228,10 +224,10 @@ public static String getLearningDesigns(Context ctx, String usernameFromParam, String urlCourseId, String folderId, String method, String type, String search, String page, String size, String sortName, String sortDate) { - String serverAddr = getServerAddress(); + String serverAddr = LamsPluginUtil.getServerUrl(); String courseId = setupCourseId(ctx, urlCourseId, true); - String serverId = getServerID(); + String serverId = LamsPluginUtil.getServerId(); // If lams.properties could not be read, throw exception if (serverAddr == null || serverId == null) { @@ -339,8 +335,8 @@ String courseId = setupCourseId(ctx, urlCourseId, false); - String serverAddr = getServerAddress(); - String serverId = getServerID(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverId = LamsPluginUtil.getServerId(); // If lams.properties could not be read, throw exception if (serverAddr == null || serverId == null) { @@ -429,17 +425,17 @@ */ public static Long startLesson(User user, String courseId, long ldId, String title, String desc, boolean isPreview) { - String serverId = getServerID(); - String serverAddr = getServerAddress(); - String serverKey = getServerKey(); + String serverId = LamsPluginUtil.getServerId(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverSecretKey = LamsPluginUtil.getServerSecretKey(); String username = user.getUserName(); String locale = user.getLocale(); String country = getCountry(locale); String lang = getLanguage(locale); String method = (isPreview) ? "preview" : "start"; - if (courseId == null || serverId == null || serverAddr == null || serverKey == null) { + if (courseId == null || serverId == null || serverAddr == null || serverSecretKey == null) { logger.info("Unable to start lesson, one or more lams configuration properties or the course id is null"); throw new RuntimeException("Unable to start lesson, one or more lams configuration properties or the course id is null. courseId="+courseId); } @@ -510,11 +506,11 @@ */ public static Boolean deleteLesson(String userName, String lsId) throws IOException, ParserConfigurationException, SAXException { - String serverId = getServerID(); - String serverAddr = getServerAddress(); - String serverKey = getServerKey(); + String serverId = LamsPluginUtil.getServerId(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverSecretKey = LamsPluginUtil.getServerSecretKey(); - if (serverId == null || serverAddr == null || serverKey == null) { + if (serverId == null || serverAddr == null || serverSecretKey == null) { throw new RuntimeException("Unable to delete lesson. One or more LAMS configuration properties are null"); } @@ -548,15 +544,15 @@ */ public static Long cloneLesson(User teacher, String courseId, String lsId) { - String serverId = getServerID(); - String serverAddr = getServerAddress(); - String serverKey = getServerKey(); + String serverId = LamsPluginUtil.getServerId(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverSecretKey = LamsPluginUtil.getServerSecretKey(); String username = teacher.getUserName(); String locale = teacher.getLocale(); String country = getCountry(locale); String lang = getLanguage(locale); - if (courseId == null || serverId == null || serverAddr == null || serverKey == null) { + if (courseId == null || serverId == null || serverAddr == null || serverSecretKey == null) { logger.info("Unable to clone lesson, one or more lams configuration properties or the course id is null"); throw new RuntimeException("Unable to clone lesson, one or more lams configuration properties or the course id is null. courseId="+courseId); } @@ -622,15 +618,15 @@ */ public static Long importLearningDesign(User teacher, String courseId, String lsId, String ldId) throws LamsServerException { - String serverId = getServerID(); - String serverAddr = getServerAddress(); - String serverKey = getServerKey(); + String serverId = LamsPluginUtil.getServerId(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverSecretKey = LamsPluginUtil.getServerSecretKey(); String username = teacher.getUserName(); String locale = teacher.getLocale(); String country = getCountry(locale); String lang = getLanguage(locale); - if (courseId == null || serverId == null || serverAddr == null || serverKey == null) { + if (courseId == null || serverId == null || serverAddr == null || serverSecretKey == null) { logger.info("Unable to import lesson, one or more lams configuration properties or the course id is null"); throw new RuntimeException("Unable to import lesson, one or more lams configuration properties or the course id is null. courseId="+courseId); } @@ -700,15 +696,15 @@ * the lesoon id that was just started */ public static void preaddLearnersMonitorsToLesson(User user, Course course, long lessonId) { - String serverId = getServerID(); - String serverAddr = getServerAddress(); - String serverKey = getServerKey(); + String serverId = LamsPluginUtil.getServerId(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverSecretKey = LamsPluginUtil.getServerSecretKey(); String username = user.getUserName(); String locale = user.getLocale(); String country = getCountry(locale); String lang = getLanguage(locale); - if (serverId == null || serverAddr == null || serverKey == null) { + if (serverId == null || serverAddr == null || serverSecretKey == null) { throw new RuntimeException("Unable to start lesson, one or more lams configuration properties is null"); } @@ -857,9 +853,9 @@ * @return the learning session id */ public static LearnerProgressDTO getLearnerProgress(Context ctx, long lsId) { - String serverId = getServerID(); - String serverAddr = getServerAddress(); - String serverKey = getServerKey(); + String serverId = LamsPluginUtil.getServerId(); + String serverAddr = LamsPluginUtil.getServerUrl(); + String serverSecretKey = LamsPluginUtil.getServerSecretKey(); String courseId = ctx.getCourse().getCourseId(); String username = ctx.getUser().getUserName(); @@ -870,7 +866,7 @@ String country = getCountry(locale); String lang = getLanguage(locale); - if (serverId == null || serverAddr == null || serverKey == null) { + if (serverId == null || serverAddr == null || serverSecretKey == null) { throw new RuntimeException("Unable to start lesson, one or more lams configuration properties is null"); } @@ -1034,7 +1030,7 @@ if ((lamsServerTimeDeltaStr == null) || (lastUpdateTime + lamsServerTimeRefreshInterval < now)) { // refresh time from LAMS server - String serverAddr = getServerAddress(); + String serverAddr = LamsPluginUtil.getServerUrl(); String serviceURL = serverAddr + "/services/getServerTime"; logger.info("LAMS Get Server Time request: " + serviceURL); InputStream is = LamsSecurityUtil.callLamsServer(serviceURL); @@ -1062,42 +1058,6 @@ return "" + lamsServerTime; } - - /** - * @return gets server address from the lams.properties file - */ - public static String getServerAddress() { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_URL); - } - - /** - * @return gets alternative server address from the lams.properties file - */ - private static String getAltServerAddress() { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_ALT_LAMS_URL); - } - - - /** - * @return gets server id from the lams.properties file - */ - public static String getServerID() { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_SERVER_ID); - } - - /** - * @return gets server key from the lams.properties file - */ - private static String getServerKey() { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_SECRET_KEY); - } - - /** - * @return gets request source from the lams.properties file - */ - private static String getReqSrc() { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_REQ_SRC); - } /** * @@ -1108,8 +1068,7 @@ long lamsServerTimeRefreshInterval = 24; try { - String lamsServerTimeRefreshIntervalStr = LamsPluginUtil.getProperties().getProperty( - LamsPluginUtil.PROP_LAMS_SERVER_TIME_REFRESH_INTERVAL); + String lamsServerTimeRefreshIntervalStr = LamsPluginUtil.getLamsServerTimeRefreshInterval(); lamsServerTimeRefreshInterval = Long.parseLong(lamsServerTimeRefreshIntervalStr); } catch (NumberFormatException e) { logger.warn("Wrong format of PROP_LAMS_SERVER_TIME_REFRESH_INTERVAL from lams.properties"); @@ -1120,10 +1079,10 @@ // generate authentication hash code to validate parameters private static String generateAuthenticationHash(String datetime, String login, String serverId) { - String secretkey = getServerKey(); + String serverSecretKey = LamsPluginUtil.getServerSecretKey(); String plaintext = datetime.toLowerCase().trim() + login.toLowerCase().trim() + serverId.toLowerCase().trim() - + secretkey.toLowerCase().trim(); + + serverSecretKey.toLowerCase().trim(); String hash = sha1(plaintext); @@ -1132,7 +1091,7 @@ /** * The parameters are: uid - the username on the external system method - either author, monitor or learner ts - - * timestamp sid - serverID str is [ts + uid + method + serverID + serverKey] (Note: all lower case) + * timestamp sid - serverID str is [ts + uid + method + serverID + serverSecretKey] (Note: all lower case) * * @param str * The string to be hashed Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LineitemUtil.java =================================================================== diff -u -r535a8b4b59cfcf0932f4f3835915a8635107306c -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LineitemUtil.java (.../LineitemUtil.java) (revision 535a8b4b59cfcf0932f4f3835915a8635107306c) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/util/LineitemUtil.java (.../LineitemUtil.java) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -144,7 +144,7 @@ //at this moment bbContent contains already updated lessonId String lessonId = bbContent.getLinkRef(); - String serviceURL = LamsSecurityUtil.getServerAddress() + "/services/xml/LessonManager?" + String serviceURL = LamsPluginUtil.getServerUrl() + "/services/xml/LessonManager?" + LamsSecurityUtil.generateAuthenticateParameters(username) + "&method=checkLessonForNumericToolOutputs&lsId=" + lessonId; Index: lams_bb_integration/web/admin/config.jsp =================================================================== diff -u -r8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4 -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/web/admin/config.jsp (.../config.jsp) (revision 8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4) +++ lams_bb_integration/web/admin/config.jsp (.../config.jsp) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -37,9 +37,6 @@ - - - Index: lams_bb_integration/web/admin/configSuccess.jsp =================================================================== diff -u -r8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4 -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/web/admin/configSuccess.jsp (.../configSuccess.jsp) (revision 8fc1a1bffe5907d6f05f859a8f1cb5b2b62709c4) +++ lams_bb_integration/web/admin/configSuccess.jsp (.../configSuccess.jsp) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -33,7 +33,6 @@ LAMS_SERVER_URL: ${param.lamsServerUrl}
LAMS_SERVER_SKEY: ${param.lamsSecretKey}
LAMS_SERVER_ID: ${param.lamsServerId}
- BB_REQ_SRC: ${param.requestSrc}
LAMS_SERVER_TIME_REFRESH_INTERVAL: ${param.lamsServerTimeRefreshInterval}
LAMS_ALT_SERVER_URL: ${param.lamsAltServerUrl} Index: lams_bb_integration/web/modules/create.jsp =================================================================== diff -u -rbcde27583897643e41d2639179fb84da08745102 -r2136e303633dc6cfaf9367e5f279cfcd75105752 --- lams_bb_integration/web/modules/create.jsp (.../create.jsp) (revision bcde27583897643e41d2639179fb84da08745102) +++ lams_bb_integration/web/modules/create.jsp (.../create.jsp) (revision 2136e303633dc6cfaf9367e5f279cfcd75105752) @@ -271,20 +271,6 @@ function back() { history.go(-1); } - - function receiveMessage(event) { - var lamsServerUrl = "${lamsServerUrl}"; - - // verify the sender of this message - if ((lamsServerUrl.substring(0, event.origin.length) === event.origin) && (event.data == "refresh")) { - window.location.reload(); - } - } - if (window.addEventListener){ - window.addEventListener("message", receiveMessage, false); - } else if (window.attachEvent){ - window.attachEvent("message", receiveMessage); - }