Index: lams_bb_integration/WEB-INF/bb-manifest.xml =================================================================== diff -u -r740ff4398fd4596bddb7bc662482ebd1eae47afc -r2b13871ed2a4112d82813d265612c7d8a515ed46 --- lams_bb_integration/WEB-INF/bb-manifest.xml (.../bb-manifest.xml) (revision 740ff4398fd4596bddb7bc662482ebd1eae47afc) +++ lams_bb_integration/WEB-INF/bb-manifest.xml (.../bb-manifest.xml) (revision 2b13871ed2a4112d82813d265612c7d8a515ed46) @@ -5,7 +5,7 @@ - + Index: lams_bb_integration/build.xml =================================================================== diff -u -r740ff4398fd4596bddb7bc662482ebd1eae47afc -r2b13871ed2a4112d82813d265612c7d8a515ed46 --- lams_bb_integration/build.xml (.../build.xml) (revision 740ff4398fd4596bddb7bc662482ebd1eae47afc) +++ lams_bb_integration/build.xml (.../build.xml) (revision 2b13871ed2a4112d82813d265612c7d8a515ed46) @@ -2,7 +2,7 @@ - + Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsSecurityUtil.java =================================================================== diff -u -r740ff4398fd4596bddb7bc662482ebd1eae47afc -r2b13871ed2a4112d82813d265612c7d8a515ed46 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsSecurityUtil.java (.../LamsSecurityUtil.java) (revision 740ff4398fd4596bddb7bc662482ebd1eae47afc) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsSecurityUtil.java (.../LamsSecurityUtil.java) (revision 2b13871ed2a4112d82813d265612c7d8a515ed46) @@ -100,11 +100,13 @@ String firstName = ctx.getUser().getGivenName(); String lastName = ctx.getUser().getFamilyName(); String email = ctx.getUser().getEmailAddress(); - String courseId = ctx.getCourse().getCourseId(); String locale = ctx.getUser().getLocale(); String country = getCountry(locale); String lang = getLanguage(locale); + // For template authoring calls we don't need the course. We probably don't need it for authoring in general + String courseId = ctx.getCourse()!=null ? ctx.getCourse().getCourseId() : null; + String secretkey = LamsPluginUtil.getSecretKey(); // in case of learnerStrictAuth we should also include lsid value when creating hash: [ts + uid + method + lsid @@ -120,9 +122,10 @@ 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 + "&courseid=" - + URLEncoder.encode(courseId, "UTF8") + "&country=" + country + "&lang=" + lang + "&requestSrc=" + + "&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"); @@ -281,29 +284,38 @@ * @return the learning session id */ public static Long startLesson(Context ctx, long ldId, String title, String desc, boolean isPreview) { + String serverId = getServerID(); String serverAddr = getServerAddress(); String serverKey = getServerKey(); - String courseId = ctx.getCourse().getCourseId(); String username = ctx.getUser().getUserName(); String locale = ctx.getUser().getLocale(); String country = getCountry(locale); String lang = getLanguage(locale); String method = (isPreview) ? "preview" : "start"; + // courseId not needed for preview but pass it through if we have it. + String courseId = null; + if ( isPreview ) + courseId = ctx.getCourse() != null ? ctx.getCourse().getCourseId() : null; + else + courseId = ctx.getCourse().getCourseId(); + if (serverId == null || serverAddr == null || serverKey == null) { + logger.info("Unable to start lesson, one or more lams configuration properties is null"); throw new RuntimeException("Unable to start lesson, one or more lams configuration properties is null"); } try { String timestamp = new Long(System.currentTimeMillis()).toString(); String hash = generateAuthenticationHash(timestamp, username, serverId); + String course = courseId != null ? "&courseId=" + URLEncoder.encode(courseId, "UTF8") : ""; String serviceURL = serverAddr + "/services/xml/LessonManager?" + "&serverId=" + URLEncoder.encode(serverId, "utf8") + "&datetime=" + timestamp + "&username=" - + URLEncoder.encode(username, "utf8") + "&hashValue=" + hash + "&courseId=" - + URLEncoder.encode(courseId, "utf8") + "&ldId=" + new Long(ldId).toString() + "&country=" + + URLEncoder.encode(username, "utf8") + "&hashValue=" + hash + course + + "&ldId=" + new Long(ldId).toString() + "&country=" + country + "&lang=" + lang + "&method=" + method + "&title=" + URLEncoder.encode(title, "utf8").trim() + "&desc=" + URLEncoder.encode(desc, "utf8").trim();