8. To convert an existing solution to LTI, the following things are required

1.     Understand the LTI specification: You need to have a good understanding of the LTI specification and how it works.

2.     Identify the LTI components: You need to identify the LTI components that are required for your solution and integrate them into your product.

3.     Implement LTI Provider: You need to implement the LTI Provider component in your product. This involves creating an interface that can communicate with the LMS using the LTI protocol.

4.     Implement LTI Consumer: You need to implement the LTI Consumer component in your product. This involves creating a way to launch the LTI Provider and pass user credentials to it.

5.     Implement LTI Launch URL: You need to implement the LTI Launch URL in your product. This involves creating a URL that includes the necessary parameters to authenticate the user and establish the connection.

6.     Implement LTI Advantage: If you want to take advantage of the additional functionality provided by LTI Advantage, you need to implement the necessary extensions in your product.

7.     Test and validate: You need to test and validate your LTI integration to ensure that it works correctly and is compatible with different LMSs and other education platforms that support LTI.

 

Here is some sample code in Java for developing an application with the LTI specification:

1   Implementing LTI Provider:

import org.imsglobal.lti.launch.LtiVerificationResult;

import org.imsglobal.lti.launch.LtiVerifier;

import org.imsglobal.lti.launch.LtiVerificationException;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

public class MyLtiProvider {

 

  public void handleLaunch(HttpServletRequest request, HttpServletResponse response) throws Exception {

    // Get the LTI parameters from the request

    Map<String, String> parameters = new HashMap<>();

    Enumeration<String> parameterNames = request.getParameterNames();

    while (parameterNames.hasMoreElements()) {

      String name = parameterNames.nextElement();

      String value = request.getParameter(name);

      parameters.put(name, value);

    }

 

    // Verify the LTI launch request

    LtiVerifier ltiVerifier = new LtiVerifier();

    LtiVerificationResult verificationResult = ltiVerifier.verify(request, parameters);

 

    if (!verificationResult.getSuccess()) {

      throw new LtiVerificationException("LTI launch verification failed");

    }

 

    // Process the LTI launch request

    // ...

  }

}

 

2   Implementing LTI Consumer:

public class MyLtiConsumer {

 

  public void launchLtiProvider(String launchUrl, String key, String secret, String userId) throws Exception {

    // Construct the LTI launch request

    Map<String, String> parameters = new HashMap<>();

    parameters.put("lti_version", "LTI-1p0");

    parameters.put("lti_message_type", "basic-lti-launch-request");

    parameters.put("lti_consumer_key", key);

    parameters.put("lti_user_id", userId);

    // Add additional LTI parameters as needed

 

    // Sign the LTI launch request

    LtiSigner signer = new LtiSigner();

    String signature = signer.sign(parameters, launchUrl, "POST", secret);

 

    // Add the signature to the LTI parameters

    parameters.put("oauth_signature", signature);

 

    // Launch the LTI provider

    String launchQueryString = LtiUtils.convertMapToQueryString(parameters);

    String launchUrlWithQueryString = launchUrl + "?" + launchQueryString;

    // Open the launchUrlWithQueryString in a new window or iframe

  }

}

 

3   Implementing LTI Launch URL:

public class MyLtiLaunchUrl {

 

  public String generateLaunchUrl(String baseUrl, String key, String secret, String userId) throws Exception {

    // Construct the LTI launch URL

    String launchUrl = baseUrl + "/lti-launch";

    Map<String, String> parameters = new HashMap<>();

    parameters.put("lti_version", "LTI-1p0");

    parameters.put("lti_message_type", "basic-lti-launch-request");

    parameters.put("lti_consumer_key", key);

    parameters.put("lti_user_id", userId);

    // Add additional LTI parameters as needed

 

    // Sign the LTI launch URL

    LtiSigner signer = new LtiSigner();

    String signature = signer.signUrl(launchUrl, "POST", parameters, secret);

 

    // Add the signature to the LTI launch URL

    String launchQueryString = LtiUtils.convertMapToQueryString(parameters);

    String launchUrlWithQueryString = launchUrl + "?" + launchQueryString + "&oauth_signature=" + signature;

 

    return launchUrlWithQueryString;

  }

}

 

4   Implementing LTI Advantage:

public class MyLtiAdvantage {

 

  public void handleDeepLinkingRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {

    // Get the LTI Advantage JWT