Giter Site home page Giter Site logo

oxctl / lti-launch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kstateome/lti-launch

0.0 7.0 2.0 241 KB

Java support for Spring Security to authenticate using LTI Launch (1.1). Primarily supporting Canvas (Instructure).

License: GNU Lesser General Public License v3.0

Java 100.00%
lti java spring-security spring

lti-launch's Introduction

LTI Launch

LTI Launch is a project designed to assist in the development of Java based LTI applications that work with the Canvas LMS. It provides functionality to authenticate the OAuth signature of an LTI launch request. After the launch request is verified, the user is forwarded to an initial view specified by the implementing application.

Build

Java CI with Maven

Technologies Used

  • Java 8
  • Maven (Compatible with 3.5.2, requires 3.1+)
  • Spring 5.1.13
  • Spring Security OAuth

Set Up

The best way to understand how to use this is to look at the sample application https://github.com/oxctl/lti-demo

Usage

The lookup of tool consumers when handling an LTI launch is done by ToolConsumerService and there is simple implementation in SingleToolConsumerService.

Releasing

This project is deployed to the central repository, once ready to release you can have the release plugin tag everything:

mvn -Prelease release:clean release:prepare

then if that completes successfully a release bundle can be pushed to the staging area of the Sonatype OSS repository with:

mvn -Prelease release:perform

We don't automatically close the staged artifacts so after checking that the files are ok you can login to the repository and release it.

LTI Variables

The project uses several variables from the LTI launch:

  • custom_canvas_user_login_id - If set this will be used as the username on the created principal.
  • lis_person_sourcedid - If the canvas specific username isn't found this will be used as the username on the created principal.
  • context_id - If set this will be used to say the context for which the principal is valid.
  • resource_id - If context_id is unset then this will be used to give the principal a context.
  • roles - The roles are extracted from this value and set on the returned principal.
  • custom_canvas_user_isrootaccountadmin - If true then the ROLE_ROOT_ADMIN role is added to the principal.

This library also allows any project uses this to prevent LTI launches from different domains. Todo this it uses some more LTI variables to detect this:

  • custom_canvas_api_domain - If set this value is used to determine where the LTI launch came from.
  • launch_presentation_return_url - If custom_canvas_api_domain isn't set then this is used to determine where the LTI launch came from.

Troubleshooting

Invalid signature for signature method HMAC-SHA1

If you are having problems with OAuth signatures not matching you should enable debug logging on edu.ksu.lti.launch.spring.config.LtiAuthenticationFilter and this will output the string that is being checked and the signature that it should match.

A common problems is that the request is made as HTTPS to a proxy infront of the application and is then passed through as HTTP and this causes a signature mismatch because the the request URL that is checked doesn't matche the request URL that the signature was generated against.

Debugging LTI signatures

A helpful online tool to check the LTI signature is: https://lti.tools/oauth/ This allows you to enter the parameters you are going to send and check that the signature it generates is the same as you are expecting.

License

This software is licensed under the LGPL v3 license. Please see the License.txt file in this repository for license details.

Multi Node Deployment

Currently nonces are store in memory, this means that in a multi node deployment the same launch can be replayed against multiple nodes as there is no syncing of nonces between them.

History

This project is currently a fork from the Kansas State University lti-launch codebase and owes it's existence to that project.

lti-launch's People

Contributors

buckett avatar dependabot[bot] avatar dmalia1 avatar jamessnelson avatar japshvincent avatar jesusorrksu avatar killsto avatar mpellicer avatar rebeccamiller-which avatar sebastianchristopher avatar toebee avatar zoglmannk avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lti-launch's Issues

The LtiPrincipal should be LtiUser or similar

There is a problem with LtiPrincipal in that you can't have this injected into controllers in the Spring MVC world. This is because when you have a method like:

   public Reponse doSomething(LtiPrincipal ltiPrincipal) {
   }

the ServletRequestMethodArgumentResolver tries to use the Authentication object (LtiAuthenticationToken) instead and then throws an error when it can't be cast.

There are some stackoverflow posts about this:

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.