lti

package module
v0.0.0-...-6f98074 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 12 Imported by: 0

README

astiusa/lti

GoDoc

This Go-based library allows learning tool developers to easily connect their learning tools with a learning platform.

For an example tool, see lti-example.

Table of Contents

General Information

The IMS Global Learning Consortium developed the Learning Tools Interoperability (LTI) specification to formalize communication between learning tools and learning platforms. This project partially implements version 1.3 of the specification for developers for Go-based learning tools. It simplifies integration with the LTI modified OIDC login flow, the tool launch, and the subsequent access to LTI services.

Technologies Used

Features

  • Flexible options for storing data
  • Simple functions and methods for integrating into your existing tool code
  • Use of standard Go types where possible

Installation

go get github.com/astiusa/lti

Project Status

This project is under active development. At this time, the functionality is not stable and we will almost certainly introduce breaking changes.

Future Work

Many details from the IMS LTI 1.3 specification are unimplemented. Some of the key areas of future work include:

  • Deep linking

Acknowledgements

This project is the answer to our need to connect eSubmit (https://esubmit.cs.macewan.ca) to Moodle. Thank you to the developers of the PHP-based LTI 1.3 Advantage reference library, which served as a reference during our development.

Funding for this project was provided by the MacEwan University Faculty of Arts and Science.

Contact

Created by Ron Dyck and Nicholas M. Boers at MacEwan University.

License

This project is licensed under the MIT License.

We are actively developing this library, and we welcome all pull requests.

Documentation

Overview

Package lti supports the development of LTI 1.3 tools. It provides types and methods to support the OpenID Connect flow, the tool launch, and the use of a platform's 'Names and Role Provisioning Services' and 'Assignment and Grade Services.'

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLaunchContextKey

func GetLaunchContextKey() launch.ContextKeyType

GetLaunchContextKey returns the context key used for attaching the launch ID to the request context.

func LaunchIDFromContext

func LaunchIDFromContext(ctx context.Context) string

LaunchIDFromContext takes the context of an *http.Request (after a successful launch), and it returns the launch ID that was attached to that context.

func LaunchIDFromRequest

func LaunchIDFromRequest(r *http.Request) string

LaunchIDFromRequest takes an *http.Request (after a successful launch), and it returns the launch ID that was attached to that request.

func NewConnector

func NewConnector(cfg datastore.Config, launchID, keyID string) (*connector.Connector, error)

NewConnector returns a *connector.Connector (on success) that can be used for accessing LTI services. These services include Names and Role Provisioning Services (NRPS) and Assignment and Grade Services (AGS). The returned connector needs to be successfully `upgraded' (which returns a new type) before it can be used for these services.

func NewDatastoreConfig

func NewDatastoreConfig() datastore.Config

NewDatastoreConfig returns a new datastore configuration. Unless specified otherwise, all of the data stores will be internal/nonpersistent.

func NewLaunch

func NewLaunch(cfg datastore.Config, next http.HandlerFunc) *launch.Launch

NewLaunch returns a pointer to a new Launch object. This object is an http.Handler so it can be easily associated with a tool URI, e.g., /services/lti/launch/. Its second argument, `next', is the HTTP handler to run on a successful launch.

After a successful launch, further LTI requests must include the launch ID in their requests. To support a variety of tool implementation, the launch ID is attached to the *http.Request context immediately prior to calling `next'. Convenience functions, like `LaunchIDFromRequest' and `LaunchIDFromContext', also available in this package, simplify the retrieval of this launch ID.

func NewLogin

func NewLogin(cfg datastore.Config) *login.Login

NewLogin returns a pointer to a new Login object. This object is an http.Handler so it can easily be associated with tool URI, e.g., /services/lti/login/. It also provides other methods related to the redirect back to the platform.

func NewSQLDatastore

func NewSQLDatastore(db *sql.DB, config dssql.Config) *dssql.Store

NewSQLDatastore returns a new SQL datastore using the provided configuration. The configuration provides the table and field names used in queries on that database.

func NewSQLDatastoreConfig

func NewSQLDatastoreConfig() dssql.Config

NewSQLDatastoreConfig returns a new SQL datastore configuration containing the library's default table and field names. These table and field names can be modified before calling NewSQLDatastore.

Types

type JSONWebKeySet

type JSONWebKeySet struct {
	Identifier string
	PrivateKey string
}

JSONWebKeySet provides configuration for a keyset handler implemented on this type. The ServeHTTP method is implemented for this type to allow it to serve as an http.Handler.

func NewKeySet

func NewKeySet(identifier, privateKey string) *JSONWebKeySet

NewKeySet returns a *JSONWebKeySet that provides the key used to verify the sender authenticity of JSON Web Tokens exchanged as part of accessing LTI services between Platforms and Tools. This object is an http.handler so it can be easily associated with a keyset URI, e.g., /services/lti/keyset.

func (*JSONWebKeySet) ServeHTTP

func (j *JSONWebKeySet) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP makes the JSONWebKeySet type a handler to provide a JSON Web Key Set response for key fetch requests.

type KeySet

type KeySet struct {
	Keys [1]jwk.Key `json:"keys"`
}

KeySet is encoded to provide the public key to be fetched in order to verify the authenticity of JSON Web Tokens sent from this library.

Directories

Path Synopsis
Package connector provides LTI Advantage services built upon a successful Launch.
Package connector provides LTI Advantage services built upon a successful Launch.
Package datastore implements the interfaces and types for all the different storers used in LTI.
Package datastore implements the interfaces and types for all the different storers used in LTI.
nonpersistent
Package nonpersistent implements an in-memory (non-persistent) data store.
Package nonpersistent implements an in-memory (non-persistent) data store.
sql
Package sql implements a persistent SQL data store.
Package sql implements a persistent SQL data store.
Package launch provides functions and methods for LTI's tool launch.
Package launch provides functions and methods for LTI's tool launch.
Package login provides functions and methods for LTI's modified OpenID Connect login flow.
Package login provides functions and methods for LTI's modified OpenID Connect login flow.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL