#IMS Global - LTI™ Utilities
LTI™ Utilities are a set of utility classes to aid in the development of LTI v1.0 consumers and providers. They deal with much of the heavy lifting and make the process more opaque to the developer.
With Maven:
Include in your project's pom.xml:
<dependency>
<groupId>org.imsglobal</groupId>
<artifactId>basiclti-util</artifactId>
<version>1.1.2</version>
</dependency>This library provides support for:
Tool Providers:
- Verifying an LTI launch request
- Sending LTI 1.1 Outcomes request (xml-based)
- AspectJ launch verifiers for easy integration with Spring-web.
Tool Consumerss:
- Creating a valid LTI launch request
Some exploratory support for LTIv2:
- Parsing Tool Profiles
- Validating Tool Capabilities & Services
Verifying an LTI launch request.
HttpServletRequestrequest; // java servlet requestLtiVerifierltiVerifier = newLtiOauthVerifier();
Stringkey = request.getParameter("oauth_consumer_key");
Stringsecret = // retrieve corresponding secret for key from dbLtiVerificationResultltiResult = ltiVerifier.verify(request, secret);Sending LTI 1.1 Outcomes request (xml-based).
//send Request directlyIMSPOXRequest.sendReplaceResult(url, key, secret, sourcedid, score);
//or build the request to send later:HttpPostrequest = IMSPOXRequest.buildReplaceResult(url, key, secret, sourcedid, score, true);AspectJ launch verifiers for easy integration with Spring-web.
Spring Controller (LTI Producer):
@Lti@RequestMapping(value = "/lti", method = RequestMethod.POST)
publicStringltiEntry(HttpServletRequestrequest, LtiVerificationResultresult) {
if(!result.getSuccess()){
return"error";
} else {
return"success";
}
}KeyService Implementation:
publicclassMockKeyServiceimplementsLtiKeySecretService {
publicStringgetSecretForKey(Stringkey) {
return"secret";
}
}Spring Context xml:
<aop:aspectj-autoproxy/>
<beanid="myAspect"class="org.imsglobal.aspect.LtiLaunchVerifier">
<constructor-arg>
<beanclass="com.example.MockKeyService"/>
</constructor-arg>
</bean>Building an LTI launch request.
LtiSignerltiSigner = newLtiOauthSigner();
Map<String, String> signedParameters = signParameters(parameters, key, secret, url, "POST");You are welcome to contribute code to this work, but before we accept your PR, must sign a Contributors Agreement. To request a Contributors Agreement, please contact info@imsglobal.org
© 2014 IMS Global Learning Consortium, Inc. All Rights Reserved.