Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

86 Commits

Repository files navigation

#IMS Global - LTI™ Utilities

Build Status

What is it?

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.

How to use:

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:

  1. Verifying an LTI launch request
  2. Sending LTI 1.1 Outcomes request (xml-based)
  3. AspectJ launch verifiers for easy integration with Spring-web.

Tool Consumerss:

  1. Creating a valid LTI launch request

Some exploratory support for LTIv2:

  1. Parsing Tool Profiles
  2. Validating Tool Capabilities & Services

LTI Providers:

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>

LTI Consumers:

Building an LTI launch request.

LtiSignerltiSigner = newLtiOauthSigner();
Map<String, String> signedParameters = signParameters(parameters, key, secret, url, "POST");

Contributing:

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.

About

No description, website, or topics provided.

Resources

Stars

60 stars

Watchers

17 watching

Forks

Releases

Packages

Used by

Contributors

Languages