Skip to content

Commit

Permalink
SAK-29673 - Add support for tool_proxy_guid on registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Jul 9, 2015
1 parent d756437 commit aef65a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ public static String[] postRegisterHTML(Long deployKey, Map<String,Object> tool,

setProperty(ltiProps, BasicLTIConstants.LTI_VERSION, LTI2Constants.LTI2_VERSION_STRING);
setProperty(ltiProps, LTI2Constants.REG_KEY,key);
// Also duplicate reg_key as the proposed Tool Proxy GUID
setProperty(ltiProps, LTI2Constants.TOOL_PROXY_GUID,key);
// TODO: Lets show off and encrypt this secret too...
setProperty(ltiProps, LTI2Constants.REG_PASSWORD,password);
setProperty(ltiProps, BasicLTIUtil.BASICLTI_SUBMIT, getRB(rb, "launch.button", "Press to Launch External Tool"));
Expand Down
16 changes: 15 additions & 1 deletion basiclti/basiclti-docs/resources/docs/sakai-api-test/tp.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ function dataToggle(divName) {

$secret = isset($_SESSION['split_secret']) ? $_SESSION['split_secret'] : 'secret';
$re_register = false;
$tool_proxy_guid = false;
if ( $lti_message_type == "ToolProxyReregistrationRequest" ) {
$reg_key = $_POST['oauth_consumer_key'];
$tool_proxy_guid = isset($_POST['tool_proxy_guid']) ? $_POST['tool_proxy_guid'] : false;
$reg_password = "secret";
$re_register = false;
$context = new BLTI($secret, false, false);
Expand Down Expand Up @@ -294,8 +296,20 @@ function dataToggle(divName) {

$tc_half_shared_secret = false;
if ( $last_http_response == 201 || $last_http_response == 200 ) {

$responseObject = json_decode($response);

$tc_tool_proxy_guid = $responseObject->tool_proxy_guid;
if ( $tc_tool_proxy_guid ) {
echo('<p>Tool consumer returned tool_proxy_guid='.$tc_tool_proxy_guid."</p>\n");
if ( $tool_proxy_guid && $tool_proxy_guid != $tc_tool_proxy_guid ) {
echo('<p style="color: red;">Error: Returned tool_proxy_guid did not match launch tool_proxy_guid='.$tool_proxy_guid."</p>\n");
}
} else {
echo('<p style="color: red;">Error: Tool Consumer did not include tool_proxy_guid in its response.</p>'."\n");
}

if ( $oauth_splitsecret && $tp_half_shared_secret ) {
$responseObject = json_decode($response);
if ( isset($responseObject->tc_half_shared_secret) ) {
$tc_half_shared_secret = $responseObject->tc_half_shared_secret;
echo("<p>tc_half_shared_secret: ".$tc_half_shared_secret."</p>\n");
Expand Down

0 comments on commit aef65a8

Please sign in to comment.