This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void BuildLtiRequestViewBag(Assignment assignment) | |
{ | |
// Start with the basic and required parameters | |
var parameters = BuildBaseLtiRequestData(assignment); | |
// Add recommended and optional parameters | |
AddOptionalParameters(assignment, parameters); | |
// Add version specific parameters | |
if (assignment.LtiVersionId == LtiVersion.Version10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Add optional parameters that are specific to an LTI 1.0 request. | |
/// </summary> | |
/// <param name="assignment">The Assignment to be launched.</param> | |
/// <param name="parameters">The partially filled OAuthParameters object | |
/// that is being used to collect the data.</param> | |
private void AddLti10Parameters(Assignment assignment, OAuthParameters parameters) | |
{ | |
// LTI 1.0 does not include custom parameter substitution, so the custom parameter | |
// values are added as-is. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Calculate the data for a basic LTI 1.x request. | |
/// </summary> | |
/// <param name="assignment">The Assignment to be launched.</param> | |
/// <returns>An OAuthParameters object which includes the required paremters | |
/// for an LTI 1.x request.</returns> | |
private OAuthParameters BuildBaseLtiRequestData(Assignment assignment) | |
{ | |
const string lti_version = "LTI-1p0"; | |
const string lti_message_type = "basic-lti-launch-request"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Add the optional parameters for an LTI 1.x request. | |
/// </summary> | |
/// <param name="assignment">The Assignment to be launched.</param> | |
/// <param name="parameters">The partially filled OAuthParameters object | |
/// that is being used to collect the data.</param> | |
private void AddOptionalParameters(Assignment assignment, OAuthParameters parameters) | |
{ | |
var user = db.Users.Find(WebSecurity.CurrentUserId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Add optional parameters that are specific to an LTI 1.1 request. | |
/// </summary> | |
/// <param name="assignment">The Assignment to be launched.</param> | |
/// <param name="parameters">The partially filled OAuthParameters object | |
/// that is being used to collect the data.</param> | |
private void AddLti11Parameters(Assignment assignment, OAuthParameters parameters) | |
{ | |
// LTI 1.1 does support custom parameter substitution | |
if (!string.IsNullOrWhiteSpace(assignment.CustomParameters)) |