Git Product home page Git Product logo

basiclti-util-java's Introduction

#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.

HttpServletRequest request; // java servlet request
LtiVerifier ltiVerifier = new LtiOauthVerifier();
String key = request.getParameter("oauth_consumer_key");
String secret = // retrieve corresponding secret for key from db
LtiVerificationResult ltiResult = ltiVerifier.verify(request, secret);

Sending LTI 1.1 Outcomes request (xml-based).

//send Request directly
IMSPOXRequest.sendReplaceResult(url, key, secret, sourcedid, score);

//or build the request to send later:
HttpPost request = 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)
public String ltiEntry(HttpServletRequest request, LtiVerificationResult result) {
    if(!result.getSuccess()){
        return "error";
    } else {
        return "success";
    }
}

KeyService Implementation:

public class MockKeyService implements LtiKeySecretService {
    public String getSecretForKey(String key) {
        return "secret";
    }
}

Spring Context xml:

<aop:aspectj-autoproxy/>

<bean id="myAspect" class="org.imsglobal.aspect.LtiLaunchVerifier">
    <constructor-arg>
        <bean class="com.example.MockKeyService"/>
    </constructor-arg>
</bean>

LTI Consumers:

Building an LTI launch request.

LtiSigner ltiSigner = new LtiOauthSigner();
Map<String, String> signedParameters = signParameters(parameters, key, secret, url, "POST");

© 2014 IMS Global Learning Consortium, Inc. All Rights Reserved.

basiclti-util-java's People

Contributors

bennymcbenben avatar bluej100 avatar lmattson avatar pfgray avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.